aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/bus.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/base/bus.c')
-rw-r--r--drivers/base/bus.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 2d207ad30336..450942acca1a 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -505,14 +505,11 @@ void bus_attach_device(struct device *dev)
505 int ret = 0; 505 int ret = 0;
506 506
507 if (bus) { 507 if (bus) {
508 dev->is_registered = 1;
509 if (bus->p->drivers_autoprobe) 508 if (bus->p->drivers_autoprobe)
510 ret = device_attach(dev); 509 ret = device_attach(dev);
511 WARN_ON(ret < 0); 510 WARN_ON(ret < 0);
512 if (ret >= 0) 511 if (ret >= 0)
513 klist_add_tail(&dev->knode_bus, &bus->p->klist_devices); 512 klist_add_tail(&dev->knode_bus, &bus->p->klist_devices);
514 else
515 dev->is_registered = 0;
516 } 513 }
517} 514}
518 515
@@ -533,10 +530,8 @@ void bus_remove_device(struct device *dev)
533 sysfs_remove_link(&dev->bus->p->devices_kset->kobj, 530 sysfs_remove_link(&dev->bus->p->devices_kset->kobj,
534 dev->bus_id); 531 dev->bus_id);
535 device_remove_attrs(dev->bus, dev); 532 device_remove_attrs(dev->bus, dev);
536 if (dev->is_registered) { 533 klist_del(&dev->knode_bus);
537 dev->is_registered = 0; 534
538 klist_del(&dev->knode_bus);
539 }
540 pr_debug("bus: '%s': remove device %s\n", 535 pr_debug("bus: '%s': remove device %s\n",
541 dev->bus->name, dev->bus_id); 536 dev->bus->name, dev->bus_id);
542 device_release_driver(dev); 537 device_release_driver(dev);