diff options
Diffstat (limited to 'include/linux/device.h')
-rw-r--r-- | include/linux/device.h | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/include/linux/device.h b/include/linux/device.h index de0e73eae6bc..9d54fe13eb2e 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -34,9 +34,24 @@ struct device; | |||
34 | struct device_driver; | 34 | struct device_driver; |
35 | struct class; | 35 | struct class; |
36 | struct class_device; | 36 | struct class_device; |
37 | struct bus_type; | ||
38 | |||
39 | struct bus_attribute { | ||
40 | struct attribute attr; | ||
41 | ssize_t (*show)(struct bus_type *, char * buf); | ||
42 | ssize_t (*store)(struct bus_type *, const char * buf, size_t count); | ||
43 | }; | ||
44 | |||
45 | #define BUS_ATTR(_name,_mode,_show,_store) \ | ||
46 | struct bus_attribute bus_attr_##_name = __ATTR(_name,_mode,_show,_store) | ||
47 | |||
48 | extern int __must_check bus_create_file(struct bus_type *, | ||
49 | struct bus_attribute *); | ||
50 | extern void bus_remove_file(struct bus_type *, struct bus_attribute *); | ||
37 | 51 | ||
38 | struct bus_type { | 52 | struct bus_type { |
39 | const char * name; | 53 | const char * name; |
54 | struct module * owner; | ||
40 | 55 | ||
41 | struct subsystem subsys; | 56 | struct subsystem subsys; |
42 | struct kset drivers; | 57 | struct kset drivers; |
@@ -49,6 +64,8 @@ struct bus_type { | |||
49 | struct bus_attribute * bus_attrs; | 64 | struct bus_attribute * bus_attrs; |
50 | struct device_attribute * dev_attrs; | 65 | struct device_attribute * dev_attrs; |
51 | struct driver_attribute * drv_attrs; | 66 | struct driver_attribute * drv_attrs; |
67 | struct bus_attribute drivers_autoprobe_attr; | ||
68 | struct bus_attribute drivers_probe_attr; | ||
52 | 69 | ||
53 | int (*match)(struct device * dev, struct device_driver * drv); | 70 | int (*match)(struct device * dev, struct device_driver * drv); |
54 | int (*uevent)(struct device *dev, char **envp, | 71 | int (*uevent)(struct device *dev, char **envp, |
@@ -61,6 +78,8 @@ struct bus_type { | |||
61 | int (*suspend_late)(struct device * dev, pm_message_t state); | 78 | int (*suspend_late)(struct device * dev, pm_message_t state); |
62 | int (*resume_early)(struct device * dev); | 79 | int (*resume_early)(struct device * dev); |
63 | int (*resume)(struct device * dev); | 80 | int (*resume)(struct device * dev); |
81 | |||
82 | unsigned int drivers_autoprobe:1; | ||
64 | }; | 83 | }; |
65 | 84 | ||
66 | extern int __must_check bus_register(struct bus_type * bus); | 85 | extern int __must_check bus_register(struct bus_type * bus); |
@@ -102,21 +121,6 @@ extern int bus_unregister_notifier(struct bus_type *bus, | |||
102 | #define BUS_NOTIFY_UNBIND_DRIVER 0x00000004 /* driver about to be | 121 | #define BUS_NOTIFY_UNBIND_DRIVER 0x00000004 /* driver about to be |
103 | unbound */ | 122 | unbound */ |
104 | 123 | ||
105 | /* sysfs interface for exporting bus attributes */ | ||
106 | |||
107 | struct bus_attribute { | ||
108 | struct attribute attr; | ||
109 | ssize_t (*show)(struct bus_type *, char * buf); | ||
110 | ssize_t (*store)(struct bus_type *, const char * buf, size_t count); | ||
111 | }; | ||
112 | |||
113 | #define BUS_ATTR(_name,_mode,_show,_store) \ | ||
114 | struct bus_attribute bus_attr_##_name = __ATTR(_name,_mode,_show,_store) | ||
115 | |||
116 | extern int __must_check bus_create_file(struct bus_type *, | ||
117 | struct bus_attribute *); | ||
118 | extern void bus_remove_file(struct bus_type *, struct bus_attribute *); | ||
119 | |||
120 | struct device_driver { | 124 | struct device_driver { |
121 | const char * name; | 125 | const char * name; |
122 | struct bus_type * bus; | 126 | struct bus_type * bus; |