From f9f852df2faf76a2667949ddb4947d4b8f99f02f Mon Sep 17 00:00:00 2001 From: Kay Sievers Date: Sat, 7 Oct 2006 21:54:55 +0200 Subject: Driver core: add device_type to struct device This allows us to add type specific attributes, uevent vars and release funtions. A subsystem can carry different types of devices like the "block" subsys has disks and partitions. Both types create a different set of attributes, but belong to the same subsystem. This corresponds to the low level objects: kobject -> device (object/device data) kobj_type -> device_type (type of object/device we are embedded in) kset -> class/bus (list of objects/devices of a subsystem) Signed-off-by: Kay Sievers Signed-off-by: Greg Kroah-Hartman --- include/linux/device.h | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'include/linux/device.h') diff --git a/include/linux/device.h b/include/linux/device.h index da722191311..e1e164f81ee 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -328,6 +328,13 @@ extern struct class_device *class_device_create(struct class *cls, __attribute__((format(printf,5,6))); extern void class_device_destroy(struct class *cls, dev_t devt); +struct device_type { + struct device_attribute *attrs; + int (*uevent)(struct device *dev, char **envp, int num_envp, + char *buffer, int buffer_size); + void (*release)(struct device *dev); +}; + /* interface for exporting device attributes */ struct device_attribute { struct attribute attr; @@ -356,6 +363,7 @@ struct device { struct kobject kobj; char bus_id[BUS_ID_SIZE]; /* position on parent bus */ + struct device_type *type; unsigned is_registered:1; struct device_attribute uevent_attr; struct device_attribute *devt_attr; -- cgit v1.2.3