mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-06 05:06:29 +00:00
firmware: coreboot: store owner from modules with coreboot_driver_register()
Modules registering driver with coreboot_driver_register() might
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
code, just like we did for platform_driver in
commit 9447057eaf
("platform_device: use a macro instead of
platform_driver_register").
Moving the .owner setting code to the core this effectively fixes
missing .owner in framebuffer-coreboot, memconsole-coreboot and vpd
drivers.
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20240330-module-owner-coreboot-v1-1-ddba098b6dcf@linaro.org
Signed-off-by: Tzung-Bi Shih <tzungbi@kernel.org>
This commit is contained in:
parent
4cece76496
commit
46c6685e7e
@ -85,13 +85,15 @@ static void coreboot_device_release(struct device *dev)
|
||||
kfree(device);
|
||||
}
|
||||
|
||||
int coreboot_driver_register(struct coreboot_driver *driver)
|
||||
int __coreboot_driver_register(struct coreboot_driver *driver,
|
||||
struct module *owner)
|
||||
{
|
||||
driver->drv.bus = &coreboot_bus_type;
|
||||
driver->drv.owner = owner;
|
||||
|
||||
return driver_register(&driver->drv);
|
||||
}
|
||||
EXPORT_SYMBOL(coreboot_driver_register);
|
||||
EXPORT_SYMBOL(__coreboot_driver_register);
|
||||
|
||||
void coreboot_driver_unregister(struct coreboot_driver *driver)
|
||||
{
|
||||
|
@ -97,8 +97,12 @@ struct coreboot_driver {
|
||||
const struct coreboot_device_id *id_table;
|
||||
};
|
||||
|
||||
/* use a macro to avoid include chaining to get THIS_MODULE */
|
||||
#define coreboot_driver_register(driver) \
|
||||
__coreboot_driver_register(driver, THIS_MODULE)
|
||||
/* Register a driver that uses the data from a coreboot table. */
|
||||
int coreboot_driver_register(struct coreboot_driver *driver);
|
||||
int __coreboot_driver_register(struct coreboot_driver *driver,
|
||||
struct module *owner);
|
||||
|
||||
/* Unregister a driver that uses the data from a coreboot table. */
|
||||
void coreboot_driver_unregister(struct coreboot_driver *driver);
|
||||
|
Loading…
Reference in New Issue
Block a user