summaryrefslogtreecommitdiff
path: root/drivers/firmware/google/coreboot_table.c
diff options
context:
space:
mode:
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>2024-03-30 22:49:47 +0300
committerTzung-Bi Shih <tzungbi@kernel.org>2024-04-03 10:09:26 +0300
commit46c6685e7e886b7fa098465f8bfd139a253365e4 (patch)
treecab0246ad93fe2a7b64edf6cc0961bb1446f1511 /drivers/firmware/google/coreboot_table.c
parent4cece764965020c22cff7665b18a012006359095 (diff)
downloadlinux-46c6685e7e886b7fa098465f8bfd139a253365e4.tar.xz
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 9447057eaff8 ("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>
Diffstat (limited to 'drivers/firmware/google/coreboot_table.c')
-rw-r--r--drivers/firmware/google/coreboot_table.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/firmware/google/coreboot_table.c b/drivers/firmware/google/coreboot_table.c
index d4b6e581a6c6..fa7752f6e89b 100644
--- a/drivers/firmware/google/coreboot_table.c
+++ b/drivers/firmware/google/coreboot_table.c
@@ -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)
{