aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2008-03-13 17:07:03 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2008-04-19 22:10:26 -0400
commit3f62e5700b2a679ae987b32a68126dd6dcf2488f (patch)
tree4f8eda958d328b6fc068409c0fb464bc7c21266b /drivers/base
parent9a3df1f7de0ecaf77a1dde86f2a4dc020f37f87e (diff)
Driver core: make device_is_registered() work for class devices
device_is_registered() can use the kobject value for this, so it will now work with devices that are associated with only a class, not a bus and a driver. Cc: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base')
-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);