ACPI: More acpi_bind_one() cleanups
PATCH 2/2 ACPI: Print diagnostic messages if device links cannot be created
In reply to Rafael J. WysockiFrom: Rafael J. Wysocki <[email protected]>
Although the device links created by acpi_bind_one() are not essential from the kernel functionality point of view, user space may be confused when they are missing, so print diagnostic messages to the kernel log if they can't be created.
--- drivers/acpi/glue.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/acpi/glue.c +7 -0
@@ -252,8 +252,15 @@ int acpi_bind_one(struct device *dev, acacpi_physnode_link_name (physical_node_name, node_id); retval =sysfs_create_link (&acpi_dev->dev.kobj, &dev->kobj, physical_node_name); +if (retval) +dev_err (&acpi_dev->dev,"Failed to create link %s (%d)\n" , + physical_node_name, retval); + retval =sysfs_create_link (&dev->kobj, &acpi_dev->dev.kobj,"firmware_node" ); +if (retval) +dev_err (dev,"Failed to create link firmware_node (%d)\n" , + retval);mutex_unlock (&acpi_dev->physical_node_lock);
cover ACPI: More acpi_bind_one() cleanups
Hi All,
Two more cleanups for acpi_bind_one() on top of linux-pm.git/linux-next follow:
[1/2] Drop unnecessary label from acpi_bind_one(). [2/2] Print diagnostic messages if device links cannot be created.
Thanks,
Rafael
Signature · 2 lines
I speak only for myself. Rafael J. Wysocki, Intel Open Source Technology Center.
PATCH 1/2 ACPI: Drop unnecessary label from acpi_bind_one()
From: Rafael J. Wysocki <[email protected]>
The out_free label in acpi_bind_one() is only jumped to from one place, so in fact it is not necessary, because the code below it can be moved to that place directly. Move that code and drop the label.
--- drivers/acpi/glue.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-)
drivers/acpi/glue.c +7 -12
@@ -225,11 +225,15 @@ int acpi_bind_one(struct device *dev, aclist_for_each_entry (pn, &acpi_dev->physical_node_list, node) {/* Sanity check. */ if (pn->dev == dev) { +mutex_unlock (&acpi_dev->physical_node_lock); +dev_warn (dev,"Already associated with ACPI node\n" ); -if (ACPI_HANDLE (dev) == handle) - retval =0 ; +kfree (physical_node); +if (ACPI_HANDLE (dev) != handle) + goto err; - goto out_free; +put_device (dev); +return 0 ; }if (pn->node_id == node_id) { physnode_list = &pn->node;
@@ -262,15 +266,6 @@ int acpi_bind_one(struct device *dev, acACPI_HANDLE_SET (dev,NULL );put_device (dev);return retval; - - out_free: -mutex_unlock (&acpi_dev->physical_node_lock); -kfree (physical_node); -if (retval) - goto err; - -put_device (dev); -return 0 ; }EXPORT_SYMBOL_GPL (acpi_bind_one);
Quoted 7 lines · Rafael J. Wysocki
Hi All,
Two more cleanups for
acpi_bind_one()on top of linux-pm.git/linux-next follow:[1/2] Drop unnecessary label from
acpi_bind_one(). [2/2] Print diagnostic messages if device links cannot be created.
Looks good.
Thanks,
-Toshi