diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2006-06-14 15:14:34 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-06-21 15:40:49 -0400 |
commit | 23681e479129854305da1da32f7f1eaf635ef22c (patch) | |
tree | 5677e3d851e8d65feeb64c9852e4dbb60e75ff41 /include | |
parent | aa49b9136e3d44cc264811d77eef4ded88456717 (diff) |
[PATCH] Driver core: allow struct device to have a dev_t
This is the first step in moving class_device to being replaced by
struct device. It allows struct device to export a dev_t and makes it
easy to dynamically create and destroy struct device as long as they are
associated with a specific class.
Cc: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/device.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/linux/device.h b/include/linux/device.h index ade10dd6b779..b473f4278910 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -142,6 +142,7 @@ struct class { | |||
142 | 142 | ||
143 | struct subsystem subsys; | 143 | struct subsystem subsys; |
144 | struct list_head children; | 144 | struct list_head children; |
145 | struct list_head devices; | ||
145 | struct list_head interfaces; | 146 | struct list_head interfaces; |
146 | struct semaphore sem; /* locks both the children and interfaces lists */ | 147 | struct semaphore sem; /* locks both the children and interfaces lists */ |
147 | 148 | ||
@@ -305,6 +306,7 @@ struct device { | |||
305 | struct kobject kobj; | 306 | struct kobject kobj; |
306 | char bus_id[BUS_ID_SIZE]; /* position on parent bus */ | 307 | char bus_id[BUS_ID_SIZE]; /* position on parent bus */ |
307 | struct device_attribute uevent_attr; | 308 | struct device_attribute uevent_attr; |
309 | struct device_attribute *devt_attr; | ||
308 | 310 | ||
309 | struct semaphore sem; /* semaphore to synchronize calls to | 311 | struct semaphore sem; /* semaphore to synchronize calls to |
310 | * its driver. | 312 | * its driver. |
@@ -332,6 +334,11 @@ struct device { | |||
332 | struct dma_coherent_mem *dma_mem; /* internal for coherent mem | 334 | struct dma_coherent_mem *dma_mem; /* internal for coherent mem |
333 | override */ | 335 | override */ |
334 | 336 | ||
337 | /* class_device migration path */ | ||
338 | struct list_head node; | ||
339 | struct class *class; /* optional*/ | ||
340 | dev_t devt; /* dev_t, creates the sysfs "dev" */ | ||
341 | |||
335 | void (*release)(struct device * dev); | 342 | void (*release)(struct device * dev); |
336 | }; | 343 | }; |
337 | 344 | ||
@@ -373,6 +380,13 @@ extern int device_attach(struct device * dev); | |||
373 | extern void driver_attach(struct device_driver * drv); | 380 | extern void driver_attach(struct device_driver * drv); |
374 | extern void device_reprobe(struct device *dev); | 381 | extern void device_reprobe(struct device *dev); |
375 | 382 | ||
383 | /* | ||
384 | * Easy functions for dynamically creating devices on the fly | ||
385 | */ | ||
386 | extern struct device *device_create(struct class *cls, struct device *parent, | ||
387 | dev_t devt, char *fmt, ...) | ||
388 | __attribute__((format(printf,4,5))); | ||
389 | extern void device_destroy(struct class *cls, dev_t devt); | ||
376 | 390 | ||
377 | /* | 391 | /* |
378 | * Platform "fixup" functions - allow the platform to have their say | 392 | * Platform "fixup" functions - allow the platform to have their say |