struct bus_type, struct device, struct device_driver
1 struct bus_type { 2 char * name; 3 4 struct subsystem subsys; 5 struct kset drivers; 6 struct kset devices; 7 8 struct bus_attribute * bus_attrs; 9 struct device_attribute * dev_attrs; 10 struct driver_attribute * drv_attrs; 11 12 int (*match)(struct device * dev, struct device_driver * drv); 13 int (*hotplug) (struct device *dev, char **envp, 14 int num_envp, char *buffer, int buffer_size); 15 int (*suspend)(struct device * dev, u32 state); 16 int (*resume)(struct device * dev); 17 };
1 struct device { 2 struct list_head node; /* node in sibling list */ 3 struct list_head bus_list; /* node in bus's list */ 4 struct list_head driver_list; 5 struct list_head children; 6 struct device * parent; 7 8 struct kobject kobj; 9 char bus_id[BUS_ID_SIZE]; /* position on parent bus */ 10 11 struct bus_type * bus; /* type of bus device is on */ 12 struct device_driver *driver; /* which driver has allocated this 13 device */ 14 void *driver_data; /* data private to the driver */ 15 void *platform_data; /* Platform specific data (e.g. ACPI, 16 BIOS data relevant to device) */ 17 struct dev_pm_info power; 18 19 u32 detach_state; /* State to enter when device is 20 detached from its driver. */ 21 22 u64 *dma_mask; /* dma mask (if dma'able device) */ 23 u64 coherent_dma_mask;/* Like dma_mask, but for 24 alloc_coherent mappings as 25 not all hardware supports 26 64 bit addresses for consistent 27 allocations such descriptors. */ 28 29 struct list_head dma_pools; /* dma pools (if dma'ble) */ 30 31 struct dma_coherent_mem *dma_mem; /* internal for coherent mem 32 override */ 33 34 void (*release)(struct device * dev); 35 };
1 struct device_driver { 2 char * name; 3 struct bus_type * bus; 4 5 struct semaphore unload_sem; 6 struct kobject kobj; 7 struct list_head devices; 8 9 struct module * owner; 10 11 int (*probe) (struct device * dev); 12 int (*remove) (struct device * dev); 13 void (*shutdown) (struct device * dev); 14 int (*suspend) (struct device * dev, u32 state, u32 level); 15 int (*resume) (struct device * dev, u32 level); 16 };
1 struct list_head { 2 struct list_head *next, *prev; 3 };