diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2007-12-19 14:54:39 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-01-24 23:40:34 -0500 |
commit | cbe9c595f1de2e2a98403be2c14bfbc2486e84c4 (patch) | |
tree | c3e3a30bb18e1597dda4bc28c11c3add049e1e02 | |
parent | 23b9c1ab5baf368a32b7242bf110ef1f48700d04 (diff) |
Driver: add driver_add_kobj for looney iseries_veth driver
The iseries driver wants to hang kobjects off of its driver, so, to
preserve backwards compatibility, we need to add a call to the driver
core to allow future changes to work properly.
Hopefully no one uses this function in the future and the iseries_veth
driver authors come to their senses so I can remove this hack...
Cc: Dave Larson <larson1@us.ibm.com>
Cc: Santiago Leon <santil@us.ibm.com>
Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/base/driver.c | 24 | ||||
-rw-r--r-- | drivers/net/iseries_veth.c | 2 | ||||
-rw-r--r-- | include/linux/device.h | 4 |
3 files changed, 29 insertions, 1 deletions
diff --git a/drivers/base/driver.c b/drivers/base/driver.c index e3b58407fedc..633ae1d70e14 100644 --- a/drivers/base/driver.c +++ b/drivers/base/driver.c | |||
@@ -124,6 +124,30 @@ void driver_remove_file(struct device_driver * drv, struct driver_attribute * at | |||
124 | 124 | ||
125 | 125 | ||
126 | /** | 126 | /** |
127 | * driver_add_kobj - add a kobject below the specified driver | ||
128 | * | ||
129 | * You really don't want to do this, this is only here due to one looney | ||
130 | * iseries driver, go poke those developers if you are annoyed about | ||
131 | * this... | ||
132 | */ | ||
133 | int driver_add_kobj(struct device_driver *drv, struct kobject *kobj, | ||
134 | const char *fmt, ...) | ||
135 | { | ||
136 | va_list args; | ||
137 | char *name; | ||
138 | |||
139 | va_start(args, fmt); | ||
140 | name = kvasprintf(GFP_KERNEL, fmt, args); | ||
141 | va_end(args); | ||
142 | |||
143 | if (!name) | ||
144 | return -ENOMEM; | ||
145 | |||
146 | return kobject_add_ng(kobj, &drv->kobj, "%s", name); | ||
147 | } | ||
148 | EXPORT_SYMBOL_GPL(driver_add_kobj); | ||
149 | |||
150 | /** | ||
127 | * get_driver - increment driver reference count. | 151 | * get_driver - increment driver reference count. |
128 | * @drv: driver. | 152 | * @drv: driver. |
129 | */ | 153 | */ |
diff --git a/drivers/net/iseries_veth.c b/drivers/net/iseries_veth.c index 90ff4ec5f6fc..1a8299acd3f1 100644 --- a/drivers/net/iseries_veth.c +++ b/drivers/net/iseries_veth.c | |||
@@ -1705,7 +1705,7 @@ static int __init veth_module_init(void) | |||
1705 | 1705 | ||
1706 | kobj = &veth_cnx[i]->kobject; | 1706 | kobj = &veth_cnx[i]->kobject; |
1707 | /* If the add failes, complain but otherwise continue */ | 1707 | /* If the add failes, complain but otherwise continue */ |
1708 | if (0 != kobject_add_ng(kobj, &veth_driver.driver.kobj, | 1708 | if (0 != driver_add_kobj(&veth_driver.driver, kobj, |
1709 | "cnx%.2d", veth_cnx[i]->remote_lp)) | 1709 | "cnx%.2d", veth_cnx[i]->remote_lp)) |
1710 | veth_error("cnx %d: Failed adding to sysfs.\n", i); | 1710 | veth_error("cnx %d: Failed adding to sysfs.\n", i); |
1711 | } | 1711 | } |
diff --git a/include/linux/device.h b/include/linux/device.h index d974dda4aa51..721ee318d57b 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -156,6 +156,10 @@ extern int __must_check driver_create_file(struct device_driver *, | |||
156 | struct driver_attribute *); | 156 | struct driver_attribute *); |
157 | extern void driver_remove_file(struct device_driver *, struct driver_attribute *); | 157 | extern void driver_remove_file(struct device_driver *, struct driver_attribute *); |
158 | 158 | ||
159 | extern int __must_check driver_add_kobj(struct device_driver *drv, | ||
160 | struct kobject *kobj, | ||
161 | const char *fmt, ...); | ||
162 | |||
159 | extern int __must_check driver_for_each_device(struct device_driver * drv, | 163 | extern int __must_check driver_for_each_device(struct device_driver * drv, |
160 | struct device *start, void *data, | 164 | struct device *start, void *data, |
161 | int (*fn)(struct device *, void *)); | 165 | int (*fn)(struct device *, void *)); |