Commit 1a84df2d authored by Corey Minyard's avatar Corey Minyard

ipmi_si: Remove hardcode IPMI devices by scanning the platform bus

Instead of keeping track of each one, just scan the platform bus
for hardcode devices and remove them.
Signed-off-by: default avatarCorey Minyard <cminyard@mvista.com>
parent 3bb8ea40
...@@ -74,8 +74,6 @@ MODULE_PARM_DESC(slave_addrs, "Set the default IPMB slave address for" ...@@ -74,8 +74,6 @@ MODULE_PARM_DESC(slave_addrs, "Set the default IPMB slave address for"
" overridden by this parm. This is an array indexed" " overridden by this parm. This is an array indexed"
" by interface number."); " by interface number.");
static struct platform_device *ipmi_hc_pdevs[SI_MAX_PARMS];
static void __init ipmi_hardcode_init_one(const char *si_type_str, static void __init ipmi_hardcode_init_one(const char *si_type_str,
unsigned int i, unsigned int i,
unsigned long addr, unsigned long addr,
...@@ -111,7 +109,7 @@ static void __init ipmi_hardcode_init_one(const char *si_type_str, ...@@ -111,7 +109,7 @@ static void __init ipmi_hardcode_init_one(const char *si_type_str,
p.addr = addr; p.addr = addr;
p.space = addr_space; p.space = addr_space;
ipmi_hc_pdevs[i] = ipmi_platform_add("hardcode-ipmi-si", i, &p); ipmi_platform_add("hardcode-ipmi-si", i, &p);
} }
void __init ipmi_hardcode_init(void) void __init ipmi_hardcode_init(void)
...@@ -145,13 +143,23 @@ void __init ipmi_hardcode_init(void) ...@@ -145,13 +143,23 @@ 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) void ipmi_si_hardcode_exit(void)
{ {
unsigned int i; struct device *dev;
for (i = 0; i < SI_MAX_PARMS; i++) { while ((dev = bus_find_device(&platform_bus_type, NULL, NULL,
if (ipmi_hc_pdevs[i]) pdev_match_name))) {
platform_device_unregister(ipmi_hc_pdevs[i]); struct platform_device *pdev = to_platform_device(dev);
platform_device_unregister(pdev);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment