[ar71xx] fix GPIO function select bit definitions (based on a patch by Jonas <jmajau...
[openwrt.git] / target / linux / s3c24xx / patches-2.6.26 / 1233-device-model-Allow-the-creation-of-symlinks-on-sys.patch
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
5
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
8 Neo1973 GTA01.
9
10 Signed-off-by: Cesar Eduardo Barros <cesarb@cesarb.net>
11 ---
12 drivers/base/bus.c | 23 +++++++++++++++++++++++
13 include/linux/device.h | 5 +++++
14 2 files changed, 28 insertions(+), 0 deletions(-)
15
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)
21 }
22 EXPORT_SYMBOL_GPL(bus_remove_file);
23
24 +int bus_create_device_link(struct bus_type *bus, struct kobject *target,
25 + const char *name)
26 +{
27 + int error;
28 + if (bus_get(bus)) {
29 + error = sysfs_create_link(&bus->p->devices_kset->kobj, target,
30 + name);
31 + bus_put(bus);
32 + } else
33 + error = -EINVAL;
34 + return error;
35 +}
36 +EXPORT_SYMBOL_GPL(bus_create_device_link);
37 +
38 +void bus_remove_device_link(struct bus_type *bus, const char *name)
39 +{
40 + if (bus_get(bus)) {
41 + sysfs_remove_link(&bus->p->devices_kset->kobj, name);
42 + bus_put(bus);
43 + }
44 +}
45 +EXPORT_SYMBOL_GPL(bus_remove_device_link);
46 +
47 static struct kobj_type bus_ktype = {
48 .sysfs_ops = &bus_sysfs_ops,
49 };
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 *);
57
58 +extern int __must_check bus_create_device_link(struct bus_type *bus,
59 + struct kobject *target,
60 + const char *name);
61 +extern void bus_remove_device_link(struct bus_type *bus, const char *name);
62 +
63 struct bus_type {
64 const char *name;
65 struct bus_attribute *bus_attrs;
66 --
67 1.5.6.3
68
This page took 0.0427149999999999 seconds and 5 git commands to generate.