[PATCH] ACPI: bus: set mod_name in driver registration
From: Shashank Balaji
Date: Thu Apr 16 2026 - 03:39:08 EST
Pass KBUILD_MODNAME through the driver registration macro so that
the driver core can create the module symlink in sysfs for built-in
drivers.
Fixes: 48b9c4862bd3 ("ACPI: store owner from modules with acpi_bus_register_driver()")
Assisted-by: Claude:claude-4.6-opus
Co-developed-by: Rahul Bukte <rahul.bukte@xxxxxxxx>
Signed-off-by: Rahul Bukte <rahul.bukte@xxxxxxxx>
Signed-off-by: Shashank Balaji <shashank.mahadasyam@xxxxxxxx>
---
drivers/acpi/bus.c | 5 ++++-
include/acpi/acpi_bus.h | 5 +++--
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c
index 2ec095e2009e..152ef49e5970 100644
--- a/drivers/acpi/bus.c
+++ b/drivers/acpi/bus.c
@@ -1062,18 +1062,21 @@ EXPORT_SYMBOL_GPL(acpi_driver_match_device);
* __acpi_bus_register_driver - register a driver with the ACPI bus
* @driver: driver being registered
* @owner: owning module/driver
+ * @mod_name: module name string
*
* Registers a driver with the ACPI bus. Searches the namespace for all
* devices that match the driver's criteria and binds. Returns zero for
* success or a negative error status for failure.
*/
-int __acpi_bus_register_driver(struct acpi_driver *driver, struct module *owner)
+int __acpi_bus_register_driver(struct acpi_driver *driver, struct module *owner,
+ const char *mod_name)
{
if (acpi_disabled)
return -ENODEV;
driver->drv.name = driver->name;
driver->drv.bus = &acpi_bus_type;
driver->drv.owner = owner;
+ driver->drv.mod_name = mod_name;
return driver_register(&driver->drv);
}
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index b701b5f972cb..53952ec544e6 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -672,8 +672,9 @@ int acpi_scan_add_handler(struct acpi_scan_handler *handler);
* use a macro to avoid include chaining to get THIS_MODULE
*/
#define acpi_bus_register_driver(drv) \
- __acpi_bus_register_driver(drv, THIS_MODULE)
-int __acpi_bus_register_driver(struct acpi_driver *driver, struct module *owner);
+ __acpi_bus_register_driver(drv, THIS_MODULE, KBUILD_MODNAME)
+int __acpi_bus_register_driver(struct acpi_driver *driver, struct module *owner,
+ const char *mod_name);
void acpi_bus_unregister_driver(struct acpi_driver *driver);
int acpi_bus_scan(acpi_handle handle);
void acpi_bus_trim(struct acpi_device *start);
--
2.43.0