diff options
author | Dave Young <hidave.darkstar@gmail.com> | 2008-01-22 02:27:08 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-01-24 23:40:44 -0500 |
commit | fd04897bb20be29d60f7e426a053545aebeaa61a (patch) | |
tree | 7cd86b2d9de79a70bdeb32997240af5e28be6d03 /include | |
parent | 63b6971a0876b744e2fcf3c9df15d130501e1deb (diff) |
Driver Core: add class iteration api
Add the following class iteration functions for driver use:
class_for_each_device
class_find_device
class_for_each_child
class_find_child
Signed-off-by: Dave Young <hidave.darkstar@gmail.com>
Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/device.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/include/linux/device.h b/include/linux/device.h index 92ba3a874627..cdaf57bf4d19 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -177,8 +177,7 @@ struct class { | |||
177 | struct list_head devices; | 177 | struct list_head devices; |
178 | struct list_head interfaces; | 178 | struct list_head interfaces; |
179 | struct kset class_dirs; | 179 | struct kset class_dirs; |
180 | struct semaphore sem; /* locks both the children and interfaces lists */ | 180 | struct semaphore sem; /* locks children, devices, interfaces */ |
181 | |||
182 | struct class_attribute * class_attrs; | 181 | struct class_attribute * class_attrs; |
183 | struct class_device_attribute * class_dev_attrs; | 182 | struct class_device_attribute * class_dev_attrs; |
184 | struct device_attribute * dev_attrs; | 183 | struct device_attribute * dev_attrs; |
@@ -196,6 +195,12 @@ struct class { | |||
196 | 195 | ||
197 | extern int __must_check class_register(struct class *); | 196 | extern int __must_check class_register(struct class *); |
198 | extern void class_unregister(struct class *); | 197 | extern void class_unregister(struct class *); |
198 | extern int class_for_each_device(struct class *class, void *data, | ||
199 | int (*fn)(struct device *dev, void *data)); | ||
200 | extern struct device *class_find_device(struct class *class, void *data, | ||
201 | int (*match)(struct device *, void *)); | ||
202 | extern struct class_device *class_find_child(struct class *class, void *data, | ||
203 | int (*match)(struct class_device *, void *)); | ||
199 | 204 | ||
200 | 205 | ||
201 | struct class_attribute { | 206 | struct class_attribute { |