diff options
-rw-r--r-- | drivers/char/ipmi/ipmi_si.h | 1 | ||||
-rw-r--r-- | drivers/char/ipmi/ipmi_si_hardcode.c | 16 | ||||
-rw-r--r-- | drivers/char/ipmi/ipmi_si_hotmod.c | 16 | ||||
-rw-r--r-- | drivers/char/ipmi/ipmi_si_platform.c | 20 |
4 files changed, 23 insertions, 30 deletions
diff --git a/drivers/char/ipmi/ipmi_si.h b/drivers/char/ipmi/ipmi_si.h index 2ae9ebdfab0d..357a229c9012 100644 --- a/drivers/char/ipmi/ipmi_si.h +++ b/drivers/char/ipmi/ipmi_si.h @@ -29,6 +29,7 @@ void ipmi_si_hotmod_exit(void); int ipmi_si_hardcode_match(int addr_space, unsigned long addr); void ipmi_si_platform_init(void); void ipmi_si_platform_shutdown(void); +void ipmi_remove_platform_device_by_name(char *name); extern struct platform_driver ipmi_platform_driver; diff --git a/drivers/char/ipmi/ipmi_si_hardcode.c b/drivers/char/ipmi/ipmi_si_hardcode.c index 540b0871bff0..01946cad3d13 100644 --- a/drivers/char/ipmi/ipmi_si_hardcode.c +++ b/drivers/char/ipmi/ipmi_si_hardcode.c @@ -144,23 +144,9 @@ void __init ipmi_hardcode_init(void) } -static int pdev_match_name(struct device *dev, void *data) -{ - struct platform_device *pdev = to_platform_device(dev); - - return strcmp(pdev->name, "hardcode-ipmi-si") == 0; -} - void ipmi_si_hardcode_exit(void) { - struct device *dev; - - while ((dev = bus_find_device(&platform_bus_type, NULL, NULL, - pdev_match_name))) { - struct platform_device *pdev = to_platform_device(dev); - - platform_device_unregister(pdev); - } + ipmi_remove_platform_device_by_name("hardcode-ipmi-si"); } /* diff --git a/drivers/char/ipmi/ipmi_si_hotmod.c b/drivers/char/ipmi/ipmi_si_hotmod.c index 230b10e7d288..1433055a9705 100644 --- a/drivers/char/ipmi/ipmi_si_hotmod.c +++ b/drivers/char/ipmi/ipmi_si_hotmod.c @@ -239,21 +239,7 @@ out: return rv; } -static int pdev_match_name(struct device *dev, void *data) -{ - struct platform_device *pdev = to_platform_device(dev); - - return strcmp(pdev->name, "hotmod-ipmi-si") == 0; -} - void ipmi_si_hotmod_exit(void) { - struct device *dev; - - while ((dev = bus_find_device(&platform_bus_type, NULL, NULL, - pdev_match_name))) { - struct platform_device *pdev = to_platform_device(dev); - - platform_device_unregister(pdev); - } + ipmi_remove_platform_device_by_name("hotmod-ipmi-si"); } diff --git a/drivers/char/ipmi/ipmi_si_platform.c b/drivers/char/ipmi/ipmi_si_platform.c index 0f493fe83701..54c7ded2a1ff 100644 --- a/drivers/char/ipmi/ipmi_si_platform.c +++ b/drivers/char/ipmi/ipmi_si_platform.c @@ -428,6 +428,26 @@ static int ipmi_remove(struct platform_device *pdev) return ipmi_si_remove_by_dev(&pdev->dev); } +static int pdev_match_name(struct device *dev, void *data) +{ + struct platform_device *pdev = to_platform_device(dev); + const char *name = data; + + return strcmp(pdev->name, name) == 0; +} + +void ipmi_remove_platform_device_by_name(char *name) +{ + struct device *dev; + + while ((dev = bus_find_device(&platform_bus_type, NULL, name, + pdev_match_name))) { + struct platform_device *pdev = to_platform_device(dev); + + platform_device_unregister(pdev); + } +} + static const struct platform_device_id si_plat_ids[] = { { "dmi-ipmi-si", 0 }, { "hardcode-ipmi-si", 0 }, |