drivers: net: xgene: Remove acpi_has_method() calls
authorKelsey Skunberg <skunberg.kelsey@gmail.com>
Wed, 24 Jul 2019 06:06:59 +0000 (00:06 -0600)
committerDavid S. Miller <davem@davemloft.net>
Wed, 24 Jul 2019 18:29:33 +0000 (11:29 -0700)
acpi_evaluate_object will already return an error if the needed method
does not exist. Remove unnecessary acpi_has_method() calls and check the
returned acpi_status for failure instead.

Signed-off-by: Kelsey Skunberg <skunberg.kelsey@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c
drivers/net/ethernet/apm/xgene/xgene_enet_xgmac.c

index 61a465097cb80a9a9f0a11be789bd007124b6b77..79924efd4ab7a66c1a2763a1080ba1ee591aaa52 100644 (file)
@@ -694,6 +694,7 @@ bool xgene_ring_mgr_init(struct xgene_enet_pdata *p)
 static int xgene_enet_reset(struct xgene_enet_pdata *pdata)
 {
        struct device *dev = &pdata->pdev->dev;
+       acpi_status status;
 
        if (!xgene_ring_mgr_init(pdata))
                return -ENODEV;
@@ -712,11 +713,9 @@ static int xgene_enet_reset(struct xgene_enet_pdata *pdata)
                udelay(5);
        } else {
 #ifdef CONFIG_ACPI
-               if (acpi_has_method(ACPI_HANDLE(&pdata->pdev->dev), "_RST")) {
-                       acpi_evaluate_object(ACPI_HANDLE(&pdata->pdev->dev),
-                                            "_RST", NULL, NULL);
-               } else if (acpi_has_method(ACPI_HANDLE(&pdata->pdev->dev),
-                                        "_INI")) {
+               status = acpi_evaluate_object(ACPI_HANDLE(&pdata->pdev->dev),
+                                             "_RST", NULL, NULL);
+               if (ACPI_FAILURE(status)) {
                        acpi_evaluate_object(ACPI_HANDLE(&pdata->pdev->dev),
                                             "_INI", NULL, NULL);
                }
index 6453fc2ebb1f10299e40210eaffde14d2d61df51..3b3dc5b25b29c21db22e64d3251e59aba0c1791e 100644 (file)
@@ -437,6 +437,7 @@ static void xgene_sgmac_tx_disable(struct xgene_enet_pdata *p)
 static int xgene_enet_reset(struct xgene_enet_pdata *p)
 {
        struct device *dev = &p->pdev->dev;
+       acpi_status status;
 
        if (!xgene_ring_mgr_init(p))
                return -ENODEV;
@@ -460,12 +461,12 @@ static int xgene_enet_reset(struct xgene_enet_pdata *p)
                }
        } else {
 #ifdef CONFIG_ACPI
-               if (acpi_has_method(ACPI_HANDLE(&p->pdev->dev), "_RST"))
-                       acpi_evaluate_object(ACPI_HANDLE(&p->pdev->dev),
-                                            "_RST", NULL, NULL);
-               else if (acpi_has_method(ACPI_HANDLE(&p->pdev->dev), "_INI"))
+               status = acpi_evaluate_object(ACPI_HANDLE(&p->pdev->dev),
+                                             "_RST", NULL, NULL);
+               if (ACPI_FAILURE(status)) {
                        acpi_evaluate_object(ACPI_HANDLE(&p->pdev->dev),
                                             "_INI", NULL, NULL);
+               }
 #endif
        }
 
index 133eb91c542ee91fa4e926eea2199aecbcdbfe3c..78584089d76d2dcf6d87952a7806e7245ac7df95 100644 (file)
@@ -380,6 +380,7 @@ static void xgene_xgmac_tx_disable(struct xgene_enet_pdata *pdata)
 static int xgene_enet_reset(struct xgene_enet_pdata *pdata)
 {
        struct device *dev = &pdata->pdev->dev;
+       acpi_status status;
 
        if (!xgene_ring_mgr_init(pdata))
                return -ENODEV;
@@ -393,11 +394,9 @@ static int xgene_enet_reset(struct xgene_enet_pdata *pdata)
                udelay(5);
        } else {
 #ifdef CONFIG_ACPI
-               if (acpi_has_method(ACPI_HANDLE(&pdata->pdev->dev), "_RST")) {
-                       acpi_evaluate_object(ACPI_HANDLE(&pdata->pdev->dev),
-                                            "_RST", NULL, NULL);
-               } else if (acpi_has_method(ACPI_HANDLE(&pdata->pdev->dev),
-                                          "_INI")) {
+               status = acpi_evaluate_object(ACPI_HANDLE(&pdata->pdev->dev),
+                                             "_RST", NULL, NULL);
+               if (ACPI_FAILURE(status)) {
                        acpi_evaluate_object(ACPI_HANDLE(&pdata->pdev->dev),
                                             "_INI", NULL, NULL);
                }