mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
firmware: coreboot: Make bus registration symmetric
The bus is registered in module_init() but is unregistered when the platform driver remove() function calls coreboot_table_exit(). That isn't symmetric and it causes the bus to appear on systems that compile this code in, even when there isn't any coreboot firmware on the device. Let's move the registration to the coreboot_table_init() function so that it matches the exit path. Cc: Wei-Ning Huang <[email protected]> Cc: Julius Werner <[email protected]> Cc: Brian Norris <[email protected]> Cc: Samuel Holland <[email protected]> Signed-off-by: Stephen Boyd <[email protected]> Reviewed-by: Julius Werner <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
This commit is contained in:
parent
20edec3882
commit
b81e3140e4
1 changed files with 8 additions and 6 deletions
|
|
@ -70,12 +70,6 @@ static struct bus_type coreboot_bus_type = {
|
|||
.remove = coreboot_bus_remove,
|
||||
};
|
||||
|
||||
static int __init coreboot_bus_init(void)
|
||||
{
|
||||
return bus_register(&coreboot_bus_type);
|
||||
}
|
||||
module_init(coreboot_bus_init);
|
||||
|
||||
static void coreboot_device_release(struct device *dev)
|
||||
{
|
||||
struct coreboot_device *device = CB_DEV(dev);
|
||||
|
|
@ -114,6 +108,10 @@ int coreboot_table_init(struct device *dev, void __iomem *ptr)
|
|||
goto out;
|
||||
}
|
||||
|
||||
ret = bus_register(&coreboot_bus_type);
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
ptr_entry = (void *)ptr_header + header.header_bytes;
|
||||
for (i = 0; i < header.table_entries; i++) {
|
||||
memcpy_fromio(&entry, ptr_entry, sizeof(entry));
|
||||
|
|
@ -138,6 +136,10 @@ int coreboot_table_init(struct device *dev, void __iomem *ptr)
|
|||
|
||||
ptr_entry += entry.size;
|
||||
}
|
||||
|
||||
if (ret)
|
||||
bus_unregister(&coreboot_bus_type);
|
||||
|
||||
out:
|
||||
iounmap(ptr);
|
||||
return ret;
|
||||
|
|
|
|||
Loading…
Reference in a new issue