aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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) {