PNP: ACPI: Stop using acpi_device_name()
Subsystems (2)
Rafael J. Wysocki
maintainerPATCH 1/1 PNP: ACPI: Stop using acpi_device_name()
From: "Rafael J. Wysocki" <[email protected]>
Since acpi_device_name() checked by pnpacpi_add_device() is never populated, its length is always zero and the codition checking it is always false.
Accordingly, drop that condition and use acpi_device_bid(device) for setting dev->name in pnpacpi_add_device() unconditionally.
No intentional functional impact.
This will facilitate the removal of device_name from struct acpi_device_pnp in the future.
--- drivers/pnp/pnpacpi/core.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/pnp/pnpacpi/core.c +1 -4
@@ -248,10 +248,7 @@ static int __init pnpacpi_add_device(struct acpi_device *device)if (acpi_has_method (device->handle,"_DIS" )) dev->capabilities |=PNP_DISABLE ; -if (strlen (acpi_device_name (device))) -strscpy (dev->name,acpi_device_name (device),sizeof (dev->name)); -else -strscpy (dev->name,acpi_device_bid (device),sizeof (dev->name)); +strscpy (dev->name,acpi_device_bid (device),sizeof (dev->name));if (dev->active)pnpacpi_parse_allocated_resource (dev);
Signature · 1 line
2.51.0
Quoted 11 lines · Rafael J. Wysocki
Since
acpi_device_name()checked bypnpacpi_add_device()is never populated, its length is always zero and the codition checking it is always false.Accordingly, drop that condition and use
acpi_device_bid(device)for settingdev->nameinpnpacpi_add_device()unconditionally.No intentional functional impact.
This will facilitate the removal of
device_namefrom structacpi_device_pnpin the future.
...
drivers/pnp/pnpacpi/core.c static int __init pnpacpi_add_device(struct acpi_device *device) · line 251
Quoted 5 lines
drivers/pnp/pnpacpi/core.c +1
-4-if (strlen (acpi_device_name (device))) -strscpy (dev->name,acpi_device_name (device),sizeof (dev->name)); -else -strscpy (dev->name,acpi_device_bid (device),sizeof (dev->name)); +strscpy (dev->name,acpi_device_bid (device),sizeof (dev->name));
'dev' here is of struct pnp_dev, so this is the way to fill it. (I was first confused, but after looking into the full context
everything becomes clear.)
Signature · 2 lines
With Best Regards, Andy Shevchenko