Skip to contentSkip to conversation

PNP: ACPI: Stop using acpi_device_name()

PATCH In review Rafael J. Wysocki 2 participants 2 messages Jul 6 – Jul 8

Subsystems (2)
lore
Share & tools
lore

Rafael J. Wysocki

author maintainer
#0 lore raw

PATCH 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
index fbf03ff007eb..d8ec0ad2ab4e 100644
@@ -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
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Rafael J. Wysocki

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 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