The same basic code was in two places.
Signed-off-by: Corey Minyard <cminyard@mvista.com>
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;
}
-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");
}
/*
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");
}
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 },