aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormochel@digitalimplant.org <mochel@digitalimplant.org>2005-03-24 16:02:28 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2005-06-20 18:15:18 -0400
commit6eded061b1263847aedac7469339e99579aec5e5 (patch)
tree849eadc1c02df67e2d327880ce2ecc20975a856f
parentd4a7537122fa47a6ce41c5fdab53d844c78d7023 (diff)
[PATCH] Fix up bus code and remove use of rwsem.
- Don't add devices to bus's embedded kset, since it's not used by anyone anymore. - Don't need to take the bus rwsem when calling {device,driver}_attach(), since those functions use the klists and the klists' spinlocks. Signed-off-by: Patrick Mochel <mochel@digitalimplant.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/base/bus.c12
1 files changed, 0 insertions, 12 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index 736dc1f5a316..4eb19525e064 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -17,8 +17,6 @@
17#include "base.h" 17#include "base.h"
18#include "power/power.h" 18#include "power/power.h"
19 19
20#define to_dev(node) container_of(node, struct device, bus_list)
21
22#define to_bus_attr(_attr) container_of(_attr, struct bus_attribute, attr) 20#define to_bus_attr(_attr) container_of(_attr, struct bus_attribute, attr)
23#define to_bus(obj) container_of(obj, struct bus_type, subsys.kset.kobj) 21#define to_bus(obj) container_of(obj, struct bus_type, subsys.kset.kobj)
24 22
@@ -271,11 +269,8 @@ int bus_add_device(struct device * dev)
271 int error = 0; 269 int error = 0;
272 270
273 if (bus) { 271 if (bus) {
274 down_write(&dev->bus->subsys.rwsem);
275 pr_debug("bus %s: add device %s\n", bus->name, dev->bus_id); 272 pr_debug("bus %s: add device %s\n", bus->name, dev->bus_id);
276 list_add_tail(&dev->bus_list, &dev->bus->devices.list);
277 device_attach(dev); 273 device_attach(dev);
278 up_write(&dev->bus->subsys.rwsem);
279 klist_add_tail(&bus->klist_devices, &dev->knode_bus); 274 klist_add_tail(&bus->klist_devices, &dev->knode_bus);
280 device_add_attrs(bus, dev); 275 device_add_attrs(bus, dev);
281 sysfs_create_link(&bus->devices.kobj, &dev->kobj, dev->bus_id); 276 sysfs_create_link(&bus->devices.kobj, &dev->kobj, dev->bus_id);
@@ -300,11 +295,8 @@ void bus_remove_device(struct device * dev)
300 sysfs_remove_link(&dev->bus->devices.kobj, dev->bus_id); 295 sysfs_remove_link(&dev->bus->devices.kobj, dev->bus_id);
301 device_remove_attrs(dev->bus, dev); 296 device_remove_attrs(dev->bus, dev);
302 klist_remove(&dev->knode_bus); 297 klist_remove(&dev->knode_bus);
303 down_write(&dev->bus->subsys.rwsem);
304 pr_debug("bus %s: remove device %s\n", dev->bus->name, dev->bus_id); 298 pr_debug("bus %s: remove device %s\n", dev->bus->name, dev->bus_id);
305 device_release_driver(dev); 299 device_release_driver(dev);
306 list_del_init(&dev->bus_list);
307 up_write(&dev->bus->subsys.rwsem);
308 put_bus(dev->bus); 300 put_bus(dev->bus);
309 } 301 }
310} 302}
@@ -364,9 +356,7 @@ int bus_add_driver(struct device_driver * drv)
364 return error; 356 return error;
365 } 357 }
366 358
367 down_write(&bus->subsys.rwsem);
368 driver_attach(drv); 359 driver_attach(drv);
369 up_write(&bus->subsys.rwsem);
370 klist_add_tail(&bus->klist_drivers, &drv->knode_bus); 360 klist_add_tail(&bus->klist_drivers, &drv->knode_bus);
371 module_add_driver(drv->owner, drv); 361 module_add_driver(drv->owner, drv);
372 362
@@ -390,10 +380,8 @@ void bus_remove_driver(struct device_driver * drv)
390 if (drv->bus) { 380 if (drv->bus) {
391 driver_remove_attrs(drv->bus, drv); 381 driver_remove_attrs(drv->bus, drv);
392 klist_remove(&drv->knode_bus); 382 klist_remove(&drv->knode_bus);
393 down_write(&drv->bus->subsys.rwsem);
394 pr_debug("bus %s: remove driver %s\n", drv->bus->name, drv->name); 383 pr_debug("bus %s: remove driver %s\n", drv->bus->name, drv->name);
395 driver_detach(drv); 384 driver_detach(drv);
396 up_write(&drv->bus->subsys.rwsem);
397 module_remove_driver(drv); 385 module_remove_driver(drv);
398 kobject_unregister(&drv->kobj); 386 kobject_unregister(&drv->kobj);
399 put_bus(drv->bus); 387 put_bus(drv->bus);