diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2005-10-28 01:25:43 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-10-28 12:52:51 -0400 |
commit | 51d172d5f3a193e4b8f76179b2e55d7a36b94117 (patch) | |
tree | 4bb508d85d9de2588235caddf197da57a47b5d6e /include | |
parent | a7fd67062efc5b0fc9a61368c607fa92d1d57f9e (diff) |
[PATCH] Driver Core: add the ability for class_device structures to be nested
This patch allows struct class_device to be nested, so that another
struct class_device can be the parent of a new one, instead of only
having the struct class be the parent. This will allow us to
(hopefully) fix up the input and video class subsystem mess.
But please people, don't go crazy and start making huge trees of class
devices, you should only need 2 levels deep to get everything to work
(remember to use a class_interface to get notification of a new class
device being added to the system.)
Oh, this also allows us to have the possibility of potentially, someday,
moving /sys/block into /sys/class. The main hindrance is that pesky
/dev numberspace issue...
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/device.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/include/linux/device.h b/include/linux/device.h index e86a580b72e1..226e550ae2ea 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -213,7 +213,11 @@ struct class_device { | |||
213 | struct class_device_attribute uevent_attr; | 213 | struct class_device_attribute uevent_attr; |
214 | struct device * dev; /* not necessary, but nice to have */ | 214 | struct device * dev; /* not necessary, but nice to have */ |
215 | void * class_data; /* class-specific data */ | 215 | void * class_data; /* class-specific data */ |
216 | struct class_device *parent; /* parent of this child device, if there is one */ | ||
216 | 217 | ||
218 | void (*release)(struct class_device *dev); | ||
219 | int (*hotplug)(struct class_device *dev, char **envp, | ||
220 | int num_envp, char *buffer, int buffer_size); | ||
217 | char class_id[BUS_ID_SIZE]; /* unique to this class */ | 221 | char class_id[BUS_ID_SIZE]; /* unique to this class */ |
218 | }; | 222 | }; |
219 | 223 | ||
@@ -261,9 +265,12 @@ extern void class_interface_unregister(struct class_interface *); | |||
261 | 265 | ||
262 | extern struct class *class_create(struct module *owner, char *name); | 266 | extern struct class *class_create(struct module *owner, char *name); |
263 | extern void class_destroy(struct class *cls); | 267 | extern void class_destroy(struct class *cls); |
264 | extern struct class_device *class_device_create(struct class *cls, dev_t devt, | 268 | extern struct class_device *class_device_create(struct class *cls, |
265 | struct device *device, char *fmt, ...) | 269 | struct class_device *parent, |
266 | __attribute__((format(printf,4,5))); | 270 | dev_t devt, |
271 | struct device *device, | ||
272 | char *fmt, ...) | ||
273 | __attribute__((format(printf,5,6))); | ||
267 | extern void class_device_destroy(struct class *cls, dev_t devt); | 274 | extern void class_device_destroy(struct class *cls, dev_t devt); |
268 | 275 | ||
269 | 276 | ||