1 From 2dc4f2819aec1cdd3012cb28396a625d2efb00fd Mon Sep 17 00:00:00 2001
2 From: Cesar Eduardo Barros <cesarb@cesarb.net>
3 Date: Mon, 4 Aug 2008 08:34:50 +0100
4 Subject: [PATCH] device model: Allow the creation of symlinks on /sys/bus/*/devices
6 Allows the direct creation of symlinks on /sys/bus/*/devices. This is needed
7 for a compat symlink from gta01-pm-gps.0 to neo1973-pm-gps.0 on the Openmoko
10 Signed-off-by: Cesar Eduardo Barros <cesarb@cesarb.net>
12 drivers/base/bus.c | 23 +++++++++++++++++++++++
13 include/linux/device.h | 5 +++++
14 2 files changed, 28 insertions(+), 0 deletions(-)
16 diff --git a/drivers/base/bus.c b/drivers/base/bus.c
17 index ef522ae..96d495d 100644
18 --- a/drivers/base/bus.c
19 +++ b/drivers/base/bus.c
20 @@ -141,6 +141,29 @@ void bus_remove_file(struct bus_type *bus, struct bus_attribute *attr)
22 EXPORT_SYMBOL_GPL(bus_remove_file);
24 +int bus_create_device_link(struct bus_type *bus, struct kobject *target,
29 + error = sysfs_create_link(&bus->p->devices_kset->kobj, target,
36 +EXPORT_SYMBOL_GPL(bus_create_device_link);
38 +void bus_remove_device_link(struct bus_type *bus, const char *name)
41 + sysfs_remove_link(&bus->p->devices_kset->kobj, name);
45 +EXPORT_SYMBOL_GPL(bus_remove_device_link);
47 static struct kobj_type bus_ktype = {
48 .sysfs_ops = &bus_sysfs_ops,
50 diff --git a/include/linux/device.h b/include/linux/device.h
51 index 6a2d04c..d29b005 100644
52 --- a/include/linux/device.h
53 +++ b/include/linux/device.h
54 @@ -51,6 +51,11 @@ extern int __must_check bus_create_file(struct bus_type *,
55 struct bus_attribute *);
56 extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
58 +extern int __must_check bus_create_device_link(struct bus_type *bus,
59 + struct kobject *target,
61 +extern void bus_remove_device_link(struct bus_type *bus, const char *name);
65 struct bus_attribute *bus_attrs;