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.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 2d207ad30336..be1cc5143354 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -79,7 +79,7 @@ static void driver_release(struct kobject *kobj)
79{ 79{
80 struct driver_private *drv_priv = to_driver(kobj); 80 struct driver_private *drv_priv = to_driver(kobj);
81 81
82 pr_debug("driver: '%s': %s\n", kobject_name(kobj), __FUNCTION__); 82 pr_debug("driver: '%s': %s\n", kobject_name(kobj), __func__);
83 kfree(drv_priv); 83 kfree(drv_priv);
84} 84}
85 85
@@ -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);
@@ -682,19 +677,19 @@ int bus_add_driver(struct device_driver *drv)
682 error = driver_create_file(drv, &driver_attr_uevent); 677 error = driver_create_file(drv, &driver_attr_uevent);
683 if (error) { 678 if (error) {
684 printk(KERN_ERR "%s: uevent attr (%s) failed\n", 679 printk(KERN_ERR "%s: uevent attr (%s) failed\n",
685 __FUNCTION__, drv->name); 680 __func__, drv->name);
686 } 681 }
687 error = driver_add_attrs(bus, drv); 682 error = driver_add_attrs(bus, drv);
688 if (error) { 683 if (error) {
689 /* How the hell do we get out of this pickle? Give up */ 684 /* How the hell do we get out of this pickle? Give up */
690 printk(KERN_ERR "%s: driver_add_attrs(%s) failed\n", 685 printk(KERN_ERR "%s: driver_add_attrs(%s) failed\n",
691 __FUNCTION__, drv->name); 686 __func__, drv->name);
692 } 687 }
693 error = add_bind_files(drv); 688 error = add_bind_files(drv);
694 if (error) { 689 if (error) {
695 /* Ditto */ 690 /* Ditto */
696 printk(KERN_ERR "%s: add_bind_files(%s) failed\n", 691 printk(KERN_ERR "%s: add_bind_files(%s) failed\n",
697 __FUNCTION__, drv->name); 692 __func__, drv->name);
698 } 693 }
699 694
700 kobject_uevent(&priv->kobj, KOBJ_ADD); 695 kobject_uevent(&priv->kobj, KOBJ_ADD);