aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/driver.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/base/driver.c b/drivers/base/driver.c
index 9a6537f14401..2ef5acf4368b 100644
--- a/drivers/base/driver.c
+++ b/drivers/base/driver.c
@@ -217,12 +217,22 @@ static void driver_remove_groups(struct device_driver *drv,
217int driver_register(struct device_driver *drv) 217int driver_register(struct device_driver *drv)
218{ 218{
219 int ret; 219 int ret;
220 struct device_driver *other;
220 221
221 if ((drv->bus->probe && drv->probe) || 222 if ((drv->bus->probe && drv->probe) ||
222 (drv->bus->remove && drv->remove) || 223 (drv->bus->remove && drv->remove) ||
223 (drv->bus->shutdown && drv->shutdown)) 224 (drv->bus->shutdown && drv->shutdown))
224 printk(KERN_WARNING "Driver '%s' needs updating - please use " 225 printk(KERN_WARNING "Driver '%s' needs updating - please use "
225 "bus_type methods\n", drv->name); 226 "bus_type methods\n", drv->name);
227
228 other = driver_find(drv->name, drv->bus);
229 if (other) {
230 put_driver(other);
231 printk(KERN_ERR "Error: Driver '%s' is already registered, "
232 "aborting...\n", drv->name);
233 return -EEXIST;
234 }
235
226 ret = bus_add_driver(drv); 236 ret = bus_add_driver(drv);
227 if (ret) 237 if (ret)
228 return ret; 238 return ret;