diff options
author | Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> | 2024-03-28 22:49:11 +0300 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2024-04-08 17:16:55 +0300 |
commit | 48b9c4862bd303628b2e772591f2ef958e02a316 (patch) | |
tree | 19328dc612c68aa73dea34a4cca7c3198963bdbf /drivers/acpi/bus.c | |
parent | 403ad17c06509794fdf6e4d4b3070bd5b56e2a8e (diff) | |
download | linux-48b9c4862bd303628b2e772591f2ef958e02a316.tar.xz |
ACPI: store owner from modules with acpi_bus_register_driver()
Modules registering driver with acpi_bus_register_driver() often forget to
set .owner field. The field is used by some of other kernel parts for
reference counting (try_module_get()), so it is expected that drivers
will set it.
Solve the problem by moving this task away from the drivers to the core
ACPI bus code, just like we did for platform_driver in
commit 9447057eaff8 ("platform_device: use a macro instead of
platform_driver_register").
Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi/bus.c')
-rw-r--r-- | drivers/acpi/bus.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/acpi/bus.c b/drivers/acpi/bus.c index a87b10eef77d..844c46447914 100644 --- a/drivers/acpi/bus.c +++ b/drivers/acpi/bus.c @@ -995,25 +995,26 @@ EXPORT_SYMBOL_GPL(acpi_driver_match_device); -------------------------------------------------------------------------- */ /** - * acpi_bus_register_driver - register a driver with the ACPI bus + * __acpi_bus_register_driver - register a driver with the ACPI bus * @driver: driver being registered + * @owner: owning module/driver * * 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) +int __acpi_bus_register_driver(struct acpi_driver *driver, struct module *owner) { if (acpi_disabled) return -ENODEV; driver->drv.name = driver->name; driver->drv.bus = &acpi_bus_type; - driver->drv.owner = driver->owner; + driver->drv.owner = owner; return driver_register(&driver->drv); } -EXPORT_SYMBOL(acpi_bus_register_driver); +EXPORT_SYMBOL(__acpi_bus_register_driver); /** * acpi_bus_unregister_driver - unregisters a driver with the ACPI bus |