diff mbox series

drivers: net: Replace acpi_bus_get_device()

Message ID 3151721.aeNJFYEL58@kreacher (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series drivers: net: Replace acpi_bus_get_device() | expand

Checks

Context Check Description
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 17 this patch: 17
netdev/cc_maintainers warning 4 maintainers not CCed: linux-arm-kernel@lists.infradead.org linux@armlinux.org.uk thunder.leizhen@huawei.com rafael.j.wysocki@intel.com
netdev/build_clang success Errors and warnings before: 2 this patch: 2
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 17 this patch: 17
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 47 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/tree_selection success Guessing tree name failed - patch did not apply

Commit Message

Rafael J. Wysocki Feb. 1, 2022, 7:07 p.m. UTC
From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

Replace acpi_bus_get_device() that is going to be dropped with
acpi_fetch_acpi_dev().

No intentional functional impact.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
 drivers/net/ethernet/cavium/thunder/thunder_bgx.c |    4 ++--
 drivers/net/fjes/fjes_main.c                      |   10 +++-------
 drivers/net/mdio/mdio-xgene.c                     |    8 +++-----
 3 files changed, 8 insertions(+), 14 deletions(-)

Comments

Andrew Lunn Feb. 1, 2022, 7:27 p.m. UTC | #1
On Tue, Feb 01, 2022 at 08:07:08PM +0100, Rafael J. Wysocki wrote:
> From: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> 
> Replace acpi_bus_get_device() that is going to be dropped with
> acpi_fetch_acpi_dev().
> 
> No intentional functional impact.
> 
> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
> ---
>  drivers/net/ethernet/cavium/thunder/thunder_bgx.c |    4 ++--
>  drivers/net/fjes/fjes_main.c                      |   10 +++-------
>  drivers/net/mdio/mdio-xgene.c                     |    8 +++-----
>  3 files changed, 8 insertions(+), 14 deletions(-)
> 
> Index: linux-pm/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
> ===================================================================
> --- linux-pm.orig/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
> +++ linux-pm/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
> @@ -1407,9 +1407,9 @@ static acpi_status bgx_acpi_register_phy
>  {
>  	struct bgx *bgx = context;
>  	struct device *dev = &bgx->pdev->dev;
> -	struct acpi_device *adev;
> +	struct acpi_device *adev = acpi_fetch_acpi_dev(handle);

Hi Rafael

Since this is part of the networking subsystem, reverse christmas tree
applies. Yes, this driver gets is wrong here, but we should not make
it even worse. Please put this variable first.

> Index: linux-pm/drivers/net/mdio/mdio-xgene.c
> ===================================================================
> --- linux-pm.orig/drivers/net/mdio/mdio-xgene.c
> +++ linux-pm/drivers/net/mdio/mdio-xgene.c
> @@ -280,15 +280,13 @@ static acpi_status acpi_register_phy(acp
>  				     void *context, void **ret)
>  {
>  	struct mii_bus *mdio = context;
> -	struct acpi_device *adev;
> +	struct acpi_device *adev = acpi_fetch_acpi_dev(handle);

Here as well please.

With those changes, you can add my Reviewed-by:

Thanks
     Andrew
diff mbox series

Patch

Index: linux-pm/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
===================================================================
--- linux-pm.orig/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
+++ linux-pm/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
@@ -1407,9 +1407,9 @@  static acpi_status bgx_acpi_register_phy
 {
 	struct bgx *bgx = context;
 	struct device *dev = &bgx->pdev->dev;
-	struct acpi_device *adev;
+	struct acpi_device *adev = acpi_fetch_acpi_dev(handle);
 
-	if (acpi_bus_get_device(handle, &adev))
+	if (!adev)
 		goto out;
 
 	acpi_get_mac_address(dev, adev, bgx->lmac[bgx->acpi_lmac_idx].mac);
Index: linux-pm/drivers/net/fjes/fjes_main.c
===================================================================
--- linux-pm.orig/drivers/net/fjes/fjes_main.c
+++ linux-pm/drivers/net/fjes/fjes_main.c
@@ -1512,15 +1512,11 @@  static acpi_status
 acpi_find_extended_socket_device(acpi_handle obj_handle, u32 level,
 				 void *context, void **return_value)
 {
-	struct acpi_device *device;
+	struct acpi_device *device = acpi_fetch_acpi_dev(obj_handle);
 	bool *found = context;
-	int result;
 
-	result = acpi_bus_get_device(obj_handle, &device);
-	if (result)
-		return AE_OK;
-
-	if (strcmp(acpi_device_hid(device), ACPI_MOTHERBOARD_RESOURCE_HID))
+	if (!device ||
+	    strcmp(acpi_device_hid(device), ACPI_MOTHERBOARD_RESOURCE_HID))
 		return AE_OK;
 
 	if (!is_extended_socket_device(device))
Index: linux-pm/drivers/net/mdio/mdio-xgene.c
===================================================================
--- linux-pm.orig/drivers/net/mdio/mdio-xgene.c
+++ linux-pm/drivers/net/mdio/mdio-xgene.c
@@ -280,15 +280,13 @@  static acpi_status acpi_register_phy(acp
 				     void *context, void **ret)
 {
 	struct mii_bus *mdio = context;
-	struct acpi_device *adev;
+	struct acpi_device *adev = acpi_fetch_acpi_dev(handle);
 	struct phy_device *phy_dev;
 	const union acpi_object *obj;
 	u32 phy_addr;
 
-	if (acpi_bus_get_device(handle, &adev))
-		return AE_OK;
-
-	if (acpi_dev_get_property(adev, "phy-channel", ACPI_TYPE_INTEGER, &obj))
+	if (!adev ||
+	    acpi_dev_get_property(adev, "phy-channel", ACPI_TYPE_INTEGER, &obj))
 		return AE_OK;
 	phy_addr = obj->integer.value;