[PATCH v1 3/4] ACPI: glue: Fix up and adjust acpi_unbind_one()
From: Rafael J. Wysocki
Date: Thu Sep 10 2026 - 14:01:00 EST
From: "Rafael J. Wysocki" <rafael.j.wysocki@xxxxxxxxx>
Since none of the acpi_unbind_one() callers check its return value and
it always returns 0 anyway, make it void.
Also notice that unlocking physical_node_lock for the given ACPI device
should be carried out before dropping the reference to it in case that
reference is the last one (highly unlikely), so rearrange the code to
make that happen.
Fixes: 3e3327837c18 ("ACPI: Use list_for_each_entry() in acpi_unbind_one()")
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@xxxxxxxxx>
---
drivers/acpi/glue.c | 10 ++++++----
include/acpi/acpi_bus.h | 2 +-
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c
index 89336a5fa78b..1981ebfb5ce0 100644
--- a/drivers/acpi/glue.c
+++ b/drivers/acpi/glue.c
@@ -322,13 +322,13 @@ int acpi_bind_one(struct device *dev, struct acpi_device *acpi_dev)
}
EXPORT_SYMBOL_GPL(acpi_bind_one);
-int acpi_unbind_one(struct device *dev)
+void acpi_unbind_one(struct device *dev)
{
struct acpi_device *acpi_dev = ACPI_COMPANION(dev);
struct acpi_device_physical_node *entry;
if (!acpi_dev)
- return 0;
+ return;
mutex_lock(&acpi_dev->physical_node_lock);
@@ -343,15 +343,17 @@ int acpi_unbind_one(struct device *dev)
sysfs_remove_link(&acpi_dev->dev.kobj, physnode_name);
sysfs_remove_link(&dev->kobj, "firmware_node");
ACPI_COMPANION_SET(dev, NULL);
+
+ mutex_unlock(&acpi_dev->physical_node_lock);
+
/* Drop references taken by acpi_bind_one(). */
put_device(dev);
acpi_dev_put(acpi_dev);
kfree(entry);
- break;
+ return;
}
mutex_unlock(&acpi_dev->physical_node_lock);
- return 0;
}
EXPORT_SYMBOL_GPL(acpi_unbind_one);
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index a10a591c18b2..93b00635ba3d 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -665,7 +665,7 @@ struct acpi_bus_type {
int register_acpi_bus_type(struct acpi_bus_type *);
int unregister_acpi_bus_type(struct acpi_bus_type *);
int acpi_bind_one(struct device *dev, struct acpi_device *adev);
-int acpi_unbind_one(struct device *dev);
+void acpi_unbind_one(struct device *dev);
enum acpi_bridge_type {
ACPI_BRIDGE_TYPE_PCIE = 1,
--
2.51.0