diff options
| author | Patrick Mochel <mochel@geena.pdx.osdl.net> | 2002-05-24 02:04:42 -0700 |
|---|---|---|
| committer | Patrick Mochel <mochel@geena.pdx.osdl.net> | 2002-05-24 02:04:42 -0700 |
| commit | cfff1d8f5243e04c7d04d36ec7e559b5c41eeb9f (patch) | |
| tree | d7dfaf1a524709842ae19883a6525d13780fdd04 /include/linux | |
| parent | 3e8c3286fd62cb9da5c77f8d56935acb1262de62 (diff) | |
Introduce struct bus_type for describing types of buses
Define bus_register for bus registration
Define get_bus and put_bus for bus refcounting
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/device.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/include/linux/device.h b/include/linux/device.h index ccfd221d5dcd..970b974918d6 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -55,6 +55,29 @@ enum { struct device; + +struct bus_type { + char * name; + rwlock_t lock; + atomic_t refcount; + + list_t node; + list_t devices; +}; + + +extern int bus_register(struct bus_type * bus); + +static inline struct bus_type * get_bus(struct bus_type * bus) +{ + BUG_ON(!atomic_read(&bus->refcount)); + atomic_inc(&bus->refcount); + return bus; +} + +extern void put_bus(struct bus_type * bus); + + struct device_driver { int (*probe) (struct device * dev); int (*remove) (struct device * dev, u32 flags); @@ -66,6 +89,7 @@ struct device_driver { struct device { struct list_head g_list; /* node in depth-first order list */ struct list_head node; /* node in sibling list */ + struct list_head bus_list; /* node in bus's list */ struct list_head children; struct device * parent; |
