aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base/bus.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2006-09-14 05:23:28 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2006-12-01 17:51:58 -0500
commitb9cafc7d5b8af0c71896f60dfcff40c71bd38a9a (patch)
tree818da5cabe0236b547d1d1fc3a00e4446d439356 /drivers/base/bus.c
parent40fa54226f518a9bc97ed1d711c0016e416e3782 (diff)
CONFIG_SYSFS_DEPRECATED - bus symlinks
Turn off the bus symlinks if CONFIG_SYSFS_DEPRECATED is enabled Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/base/bus.c')
-rw-r--r--drivers/base/bus.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/drivers/base/bus.c b/drivers/base/bus.c
index ed3e8a2be64a..472810f8e6e7 100644
--- a/drivers/base/bus.c
+++ b/drivers/base/bus.c
@@ -355,6 +355,21 @@ static void device_remove_attrs(struct bus_type * bus, struct device * dev)
355 } 355 }
356} 356}
357 357
358#ifdef CONFIG_SYSFS_DEPRECATED
359static int make_deprecated_bus_links(struct device *dev)
360{
361 return sysfs_create_link(&dev->kobj,
362 &dev->bus->subsys.kset.kobj, "bus");
363}
364
365static void remove_deprecated_bus_links(struct device *dev)
366{
367 sysfs_remove_link(&dev->kobj, "bus");
368}
369#else
370static inline int make_deprecated_bus_links(struct device *dev) { return 0; }
371static inline void remove_deprecated_bus_links(struct device *dev) { }
372#endif
358 373
359/** 374/**
360 * bus_add_device - add device to bus 375 * bus_add_device - add device to bus
@@ -381,8 +396,7 @@ int bus_add_device(struct device * dev)
381 &dev->bus->subsys.kset.kobj, "subsystem"); 396 &dev->bus->subsys.kset.kobj, "subsystem");
382 if (error) 397 if (error)
383 goto out_subsys; 398 goto out_subsys;
384 error = sysfs_create_link(&dev->kobj, 399 error = make_deprecated_bus_links(dev);
385 &dev->bus->subsys.kset.kobj, "bus");
386 if (error) 400 if (error)
387 goto out_deprecated; 401 goto out_deprecated;
388 } 402 }
@@ -436,7 +450,7 @@ void bus_remove_device(struct device * dev)
436{ 450{
437 if (dev->bus) { 451 if (dev->bus) {
438 sysfs_remove_link(&dev->kobj, "subsystem"); 452 sysfs_remove_link(&dev->kobj, "subsystem");
439 sysfs_remove_link(&dev->kobj, "bus"); 453 remove_deprecated_bus_links(dev);
440 sysfs_remove_link(&dev->bus->devices.kobj, dev->bus_id); 454 sysfs_remove_link(&dev->bus->devices.kobj, dev->bus_id);
441 device_remove_attrs(dev->bus, dev); 455 device_remove_attrs(dev->bus, dev);
442 if (dev->is_registered) { 456 if (dev->is_registered) {