summaryrefslogtreecommitdiffstats
path: root/include/driver.h
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2007-10-11 20:20:36 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2007-10-11 20:20:36 +0200
commiteadf71abc77bf97cf5aa7dbe206f4778c4b2480d (patch)
treeb777f0f97d094c836300b11cc390ce10678dd417 /include/driver.h
parent29fc9471f5b0f18df699f8e47c5a1fbeb5398e9e (diff)
downloadbarebox-eadf71abc77bf97cf5aa7dbe206f4778c4b2480d.tar.gz
barebox-eadf71abc77bf97cf5aa7dbe206f4778c4b2480d.tar.xz
Use Linux kernel list for drivers and devices instead of handmade
list.
Diffstat (limited to 'include/driver.h')
-rw-r--r--include/driver.h12
1 files changed, 10 insertions, 2 deletions
diff --git a/include/driver.h b/include/driver.h
index 293a265045..e1b344cfe3 100644
--- a/include/driver.h
+++ b/include/driver.h
@@ -1,6 +1,8 @@
#ifndef DRIVER_H
#define DRIVER_H
+#include <list.h>
+
#define MAX_DRIVER_NAME 16
#define DEVICE_TYPE_UNKNOWN 0
@@ -35,7 +37,7 @@ struct device_d {
struct driver_d *driver; /* The driver for this device */
- struct device_d *next;
+ struct list_head list;
unsigned long type;
@@ -46,7 +48,7 @@ struct driver_d {
char name[MAX_DRIVER_NAME]; /* The name of this driver. Used to match to
* the corresponding device.
*/
- struct driver_d *next;
+ struct list_head list;
int (*probe) (struct device_d *);
int (*remove)(struct device_d *);
@@ -93,6 +95,12 @@ int get_free_deviceid(char *id, char *id_template);
struct device_d *device_from_spec_str(const char *str, char **endp);
char *deviceid_from_spec_str(const char *str, char **endp);
+extern struct list_head device_list;
+#define for_each_device(dev) list_for_each_entry(dev, &device_list, list)
+
+extern struct list_head driver_list;
+#define for_each_driver(drv) list_for_each_entry(drv, &driver_list, list)
+
/* Find a driver with the given name. Currently the filesystem implementation
* uses this to get the driver from the name the user specifies with the
* mount command