diff options
author | Ard Biesheuvel <ardb@kernel.org> | 2022-12-05 09:32:11 +0100 |
---|---|---|
committer | Ard Biesheuvel <ardb@kernel.org> | 2022-12-07 19:08:57 +0100 |
commit | d9f26ae731259c8fb2d62a742c64e454996944a8 (patch) | |
tree | 08a1d422cf241d256acb7e61cb60a9e0c4782278 /drivers/firmware | |
parent | efi: Put Linux specific magic number in the DOS header (diff) | |
parent | Linux 6.1-rc8 (diff) | |
download | linux-d9f26ae731259c8fb2d62a742c64e454996944a8.tar.xz linux-d9f26ae731259c8fb2d62a742c64e454996944a8.zip |
Merge tag 'v6.1-rc8' into efi/next
Linux 6.1-rc8
Diffstat (limited to 'drivers/firmware')
-rw-r--r-- | drivers/firmware/google/coreboot_table.c | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/drivers/firmware/google/coreboot_table.c b/drivers/firmware/google/coreboot_table.c index c52bcaa9def6..9ca21feb9d45 100644 --- a/drivers/firmware/google/coreboot_table.c +++ b/drivers/firmware/google/coreboot_table.c @@ -149,12 +149,8 @@ static int coreboot_table_probe(struct platform_device *pdev) if (!ptr) return -ENOMEM; - ret = bus_register(&coreboot_bus_type); - if (!ret) { - ret = coreboot_table_populate(dev, ptr); - if (ret) - bus_unregister(&coreboot_bus_type); - } + ret = coreboot_table_populate(dev, ptr); + memunmap(ptr); return ret; @@ -169,7 +165,6 @@ static int __cb_dev_unregister(struct device *dev, void *dummy) static int coreboot_table_remove(struct platform_device *pdev) { bus_for_each_dev(&coreboot_bus_type, NULL, NULL, __cb_dev_unregister); - bus_unregister(&coreboot_bus_type); return 0; } @@ -199,6 +194,32 @@ static struct platform_driver coreboot_table_driver = { .of_match_table = of_match_ptr(coreboot_of_match), }, }; -module_platform_driver(coreboot_table_driver); + +static int __init coreboot_table_driver_init(void) +{ + int ret; + + ret = bus_register(&coreboot_bus_type); + if (ret) + return ret; + + ret = platform_driver_register(&coreboot_table_driver); + if (ret) { + bus_unregister(&coreboot_bus_type); + return ret; + } + + return 0; +} + +static void __exit coreboot_table_driver_exit(void) +{ + platform_driver_unregister(&coreboot_table_driver); + bus_unregister(&coreboot_bus_type); +} + +module_init(coreboot_table_driver_init); +module_exit(coreboot_table_driver_exit); + MODULE_AUTHOR("Google, Inc."); MODULE_LICENSE("GPL"); |