Commit b9cafc7d authored by Kay Sievers's avatar Kay Sievers Committed by Greg Kroah-Hartman

CONFIG_SYSFS_DEPRECATED - bus symlinks

Turn off the bus symlinks if CONFIG_SYSFS_DEPRECATED is enabled
Signed-off-by: default avatarKay Sievers <kay.sievers@vrfy.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 40fa5422
...@@ -355,6 +355,21 @@ static void device_remove_attrs(struct bus_type * bus, struct device * dev) ...@@ -355,6 +355,21 @@ static void device_remove_attrs(struct bus_type * bus, struct device * dev)
} }
} }
#ifdef CONFIG_SYSFS_DEPRECATED
static int make_deprecated_bus_links(struct device *dev)
{
return sysfs_create_link(&dev->kobj,
&dev->bus->subsys.kset.kobj, "bus");
}
static void remove_deprecated_bus_links(struct device *dev)
{
sysfs_remove_link(&dev->kobj, "bus");
}
#else
static inline int make_deprecated_bus_links(struct device *dev) { return 0; }
static inline void remove_deprecated_bus_links(struct device *dev) { }
#endif
/** /**
* bus_add_device - add device to bus * bus_add_device - add device to bus
...@@ -381,8 +396,7 @@ int bus_add_device(struct device * dev) ...@@ -381,8 +396,7 @@ int bus_add_device(struct device * dev)
&dev->bus->subsys.kset.kobj, "subsystem"); &dev->bus->subsys.kset.kobj, "subsystem");
if (error) if (error)
goto out_subsys; goto out_subsys;
error = sysfs_create_link(&dev->kobj, error = make_deprecated_bus_links(dev);
&dev->bus->subsys.kset.kobj, "bus");
if (error) if (error)
goto out_deprecated; goto out_deprecated;
} }
...@@ -436,7 +450,7 @@ void bus_remove_device(struct device * dev) ...@@ -436,7 +450,7 @@ void bus_remove_device(struct device * dev)
{ {
if (dev->bus) { if (dev->bus) {
sysfs_remove_link(&dev->kobj, "subsystem"); sysfs_remove_link(&dev->kobj, "subsystem");
sysfs_remove_link(&dev->kobj, "bus"); remove_deprecated_bus_links(dev);
sysfs_remove_link(&dev->bus->devices.kobj, dev->bus_id); sysfs_remove_link(&dev->bus->devices.kobj, dev->bus_id);
device_remove_attrs(dev->bus, dev); device_remove_attrs(dev->bus, dev);
if (dev->is_registered) { if (dev->is_registered) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment