X-Git-Url: http://ftp.safe.ca/?a=blobdiff_plain;f=drivers%2Fbase%2Fbase.h;h=b528145a078f34e5c384e71f01311b53450410a0;hb=e36b9d16c6a6d0f59803b3ef04ff3c22c3844c10;hp=670b95a1a510bb0a203df724b39723dff96fdcf3;hpb=184f1f779d5a2e62de4a0b34842ddf8546beca8f;p=safe%2Fjmp%2Flinux-2.6 diff --git a/drivers/base/base.h b/drivers/base/base.h index 670b95a..b528145 100644 --- a/drivers/base/base.h +++ b/drivers/base/base.h @@ -40,12 +40,11 @@ struct driver_private { /** * struct class_private - structure to hold the private to the driver core portions of the class structure. * - * @subsys - the struct kset that defines this class. This is the main kobject - * @children - list of class_devices associated with this class + * @class_subsys - the struct kset that defines this class. This is the main kobject * @class_devices - list of devices associated with this class * @class_interfaces - list of class_interfaces associated with this class - * @class_dirs - - * @sem - semaphore to protect the children, devices, and interfaces lists. + * @class_dirs - "glue" directory for virtual devices associated with this class + * @class_mutex - mutex to protect the children, devices, and interfaces lists. * @class - pointer back to the struct class that this structure is associated * with. * @@ -54,14 +53,41 @@ struct driver_private { * core should ever touch these fields. */ struct class_private { - struct kset subsys; - struct list_head class_devices; + struct kset class_subsys; + struct klist class_devices; struct list_head class_interfaces; struct kset class_dirs; - struct semaphore sem; + struct mutex class_mutex; struct class *class; }; -#define to_class(obj) container_of(obj, struct class_private, subsys.kobj) +#define to_class(obj) \ + container_of(obj, struct class_private, class_subsys.kobj) + +/** + * struct device_private - structure to hold the private to the driver core portions of the device structure. + * + * @klist_children - klist containing all children of this device + * @knode_parent - node in sibling list + * @knode_driver - node in driver list + * @knode_bus - node in bus list + * @device - pointer back to the struct class that this structure is + * associated with. + * + * Nothing outside of the driver core should ever touch these fields. + */ +struct device_private { + struct klist klist_children; + struct klist_node knode_parent; + struct klist_node knode_driver; + struct klist_node knode_bus; + struct device *device; +}; +#define to_device_private_parent(obj) \ + container_of(obj, struct device_private, knode_parent) +#define to_device_private_driver(obj) \ + container_of(obj, struct device_private, knode_driver) +#define to_device_private_bus(obj) \ + container_of(obj, struct device_private, knode_bus) /* initialisation functions */ extern int devices_init(void); @@ -86,10 +112,13 @@ extern void bus_remove_driver(struct device_driver *drv); extern void driver_detach(struct device_driver *drv); extern int driver_probe_device(struct device_driver *drv, struct device *dev); +static inline int driver_match_device(struct device_driver *drv, + struct device *dev) +{ + return drv->bus->match ? drv->bus->match(dev, drv) : 1; +} extern void sysdev_shutdown(void); -extern int sysdev_suspend(pm_message_t state); -extern int sysdev_resume(void); extern char *make_class_name(const char *name, struct kobject *kobj);