summaryrefslogtreecommitdiff
path: root/drivers/char/ipmi/ipmi_si_platform.c
diff options
context:
space:
mode:
authorCorey Minyard <cminyard@mvista.com>2019-02-21 17:41:47 -0600
committerCorey Minyard <cminyard@mvista.com>2019-02-22 07:12:41 -0600
commite17c657100d592115fcfad27472cd611fd74b861 (patch)
tree5b993f38038552d304b935234ae1a7eaef58cc94 /drivers/char/ipmi/ipmi_si_platform.c
parentbdb57b7bc16252599cbcb826dfdf7e394dd2af4b (diff)
ipmi_si: Consolidate scanning the platform bus
The same basic code was in two places. Signed-off-by: Corey Minyard <cminyard@mvista.com>
Diffstat (limited to 'drivers/char/ipmi/ipmi_si_platform.c')
-rw-r--r--drivers/char/ipmi/ipmi_si_platform.c20
1 files changed, 20 insertions, 0 deletions
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 },