From fd04897bb20be29d60f7e426a053545aebeaa61a Mon Sep 17 00:00:00 2001 From: Dave Young Date: Tue, 22 Jan 2008 15:27:08 +0800 Subject: 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 Acked-by: Cornelia Huck Signed-off-by: Greg Kroah-Hartman --- include/linux/device.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'include/linux/device.h') diff --git a/include/linux/device.h b/include/linux/device.h index 92ba3a87462..cdaf57bf4d1 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -177,8 +177,7 @@ struct class { struct list_head devices; struct list_head interfaces; struct kset class_dirs; - struct semaphore sem; /* locks both the children and interfaces lists */ - + struct semaphore sem; /* locks children, devices, interfaces */ struct class_attribute * class_attrs; struct class_device_attribute * class_dev_attrs; struct device_attribute * dev_attrs; @@ -196,6 +195,12 @@ struct class { extern int __must_check class_register(struct class *); extern void class_unregister(struct class *); +extern int class_for_each_device(struct class *class, void *data, + int (*fn)(struct device *dev, void *data)); +extern struct device *class_find_device(struct class *class, void *data, + int (*match)(struct device *, void *)); +extern struct class_device *class_find_child(struct class *class, void *data, + int (*match)(struct class_device *, void *)); struct class_attribute { -- cgit v1.2.3-70-g09d2