From e1e5aa9b53be641a87ed3cb98871bb0abdf3e4f2 Mon Sep 17 00:00:00 2001 From: Patrick Mochel Date: Tue, 28 May 2002 19:51:08 -0700 Subject: Device Model: Add helpers bus_for_each_dev and bus_for_each_drv - iterators for accessing bus's lists of devices and drivers - does locking on bus for each list access - does reference counting on objects as it grabs and releases them - calls callback for each object in list --- include/linux/device.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'include/linux') diff --git a/include/linux/device.h b/include/linux/device.h index 2ad1e9ff4f75..b8729d952190 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -54,7 +54,7 @@ enum { }; struct device; - +struct device_driver; struct bus_type { char * name; @@ -82,6 +82,11 @@ static inline struct bus_type * get_bus(struct bus_type * bus) extern void put_bus(struct bus_type * bus); +extern int bus_for_each_dev(struct bus_type * bus, void * data, + int (*callback)(struct device * dev, void * data)); +extern int bus_for_each_drv(struct bus_type * bus, void * data, + int (*callback)(struct device_driver * drv, void * data)); + struct device_driver { char * name; -- cgit v1.2.3