diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2006-06-14 23:14:34 +0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-06-21 23:40:49 +0400 |
commit | 23681e479129854305da1da32f7f1eaf635ef22c (patch) | |
tree | 5677e3d851e8d65feeb64c9852e4dbb60e75ff41 /include/linux/device.h | |
parent | aa49b9136e3d44cc264811d77eef4ded88456717 (diff) | |
download | linux-23681e479129854305da1da32f7f1eaf635ef22c.tar.xz |
[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/linux/device.h')
-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 { struct subsystem subsys; struct list_head children; + struct list_head devices; struct list_head interfaces; struct semaphore sem; /* locks both the children and interfaces lists */ @@ -305,6 +306,7 @@ struct device { struct kobject kobj; char bus_id[BUS_ID_SIZE]; /* position on parent bus */ struct device_attribute uevent_attr; + struct device_attribute *devt_attr; struct semaphore sem; /* semaphore to synchronize calls to * its driver. @@ -332,6 +334,11 @@ struct device { struct dma_coherent_mem *dma_mem; /* internal for coherent mem override */ + /* class_device migration path */ + struct list_head node; + struct class *class; /* optional*/ + dev_t devt; /* dev_t, creates the sysfs "dev" */ + void (*release)(struct device * dev); }; @@ -373,6 +380,13 @@ extern int device_attach(struct device * dev); extern void driver_attach(struct device_driver * drv); extern void device_reprobe(struct device *dev); +/* + * Easy functions for dynamically creating devices on the fly + */ +extern struct device *device_create(struct class *cls, struct device *parent, + dev_t devt, char *fmt, ...) + __attribute__((format(printf,4,5))); +extern void device_destroy(struct class *cls, dev_t devt); /* * Platform "fixup" functions - allow the platform to have their say |