diff options
author | Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | 2012-09-20 07:36:45 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2012-09-23 21:15:13 +0200 |
commit | ed942bc08581b9c6fe6cba0ec8d7601e19d475a2 (patch) | |
tree | 58b6299c5b75ddd848dcfa9fb69ca584e4103f29 /include | |
parent | 72b0a6503f8519980a4734bcdbb35a9ec6cd6347 (diff) | |
download | barebox-ed942bc08581b9c6fe6cba0ec8d7601e19d475a2.tar.gz barebox-ed942bc08581b9c6fe6cba0ec8d7601e19d475a2.tar.xz |
driver: search device and driver based on the bus instead of all
This will allow reduce the number of driver and device to search on.
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/driver.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/driver.h b/include/driver.h index 05670046f8..4a24295276 100644 --- a/include/driver.h +++ b/include/driver.h @@ -92,6 +92,7 @@ struct device_d { struct driver_d *driver; /*! The driver for this device */ struct list_head list; /* The list of all devices */ + struct list_head bus_list; /* our bus */ struct list_head children; /* our children */ struct list_head sibling; struct list_head active; /* The list of all devices which have a driver */ @@ -119,6 +120,7 @@ struct driver_d { const char *name; struct list_head list; + struct list_head bus_list; /* our bus */ /*! Called if an instance of a device is found */ int (*probe) (struct device_d *); @@ -381,6 +383,8 @@ struct bus_type { void (*remove)(struct device_d *dev); struct list_head list; + struct list_head device_list; + struct list_head driver_list; }; int bus_register(struct bus_type *bus); @@ -391,6 +395,14 @@ extern struct list_head bus_list; */ #define for_each_bus(bus) list_for_each_entry(bus, &bus_list, list) +/* Iterate over all devices of a bus + */ +#define bus_for_each_device(bus, dev) list_for_each_entry(dev, &bus->device_list, bus_list) + +/* Iterate over all drivers of a bus + */ +#define bus_for_each_driver(bus, drv) list_for_each_entry(drv, &bus->driver_list, bus_list) + extern struct bus_type platform_bus; struct file_operations { |