diff options
Diffstat (limited to 'include/linux/device.h')
-rw-r--r-- | include/linux/device.h | 52 |
1 files changed, 28 insertions, 24 deletions
diff --git a/include/linux/device.h b/include/linux/device.h index 7d447d7271c5..ad4db72f5733 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/kobject.h> | 15 | #include <linux/kobject.h> |
16 | #include <linux/klist.h> | 16 | #include <linux/klist.h> |
17 | #include <linux/list.h> | 17 | #include <linux/list.h> |
18 | #include <linux/compiler.h> | ||
18 | #include <linux/types.h> | 19 | #include <linux/types.h> |
19 | #include <linux/module.h> | 20 | #include <linux/module.h> |
20 | #include <linux/pm.h> | 21 | #include <linux/pm.h> |
@@ -58,7 +59,7 @@ struct bus_type { | |||
58 | int (*resume)(struct device * dev); | 59 | int (*resume)(struct device * dev); |
59 | }; | 60 | }; |
60 | 61 | ||
61 | extern int bus_register(struct bus_type * bus); | 62 | extern int __must_check bus_register(struct bus_type * bus); |
62 | extern void bus_unregister(struct bus_type * bus); | 63 | extern void bus_unregister(struct bus_type * bus); |
63 | 64 | ||
64 | extern void bus_rescan_devices(struct bus_type * bus); | 65 | extern void bus_rescan_devices(struct bus_type * bus); |
@@ -70,9 +71,9 @@ int bus_for_each_dev(struct bus_type * bus, struct device * start, void * data, | |||
70 | struct device * bus_find_device(struct bus_type *bus, struct device *start, | 71 | struct device * bus_find_device(struct bus_type *bus, struct device *start, |
71 | void *data, int (*match)(struct device *, void *)); | 72 | void *data, int (*match)(struct device *, void *)); |
72 | 73 | ||
73 | int bus_for_each_drv(struct bus_type * bus, struct device_driver * start, | 74 | int __must_check bus_for_each_drv(struct bus_type *bus, |
74 | void * data, int (*fn)(struct device_driver *, void *)); | 75 | struct device_driver *start, void *data, |
75 | 76 | int (*fn)(struct device_driver *, void *)); | |
76 | 77 | ||
77 | /* driverfs interface for exporting bus attributes */ | 78 | /* driverfs interface for exporting bus attributes */ |
78 | 79 | ||
@@ -85,7 +86,8 @@ struct bus_attribute { | |||
85 | #define BUS_ATTR(_name,_mode,_show,_store) \ | 86 | #define BUS_ATTR(_name,_mode,_show,_store) \ |
86 | struct bus_attribute bus_attr_##_name = __ATTR(_name,_mode,_show,_store) | 87 | struct bus_attribute bus_attr_##_name = __ATTR(_name,_mode,_show,_store) |
87 | 88 | ||
88 | extern int bus_create_file(struct bus_type *, struct bus_attribute *); | 89 | extern int __must_check bus_create_file(struct bus_type *, |
90 | struct bus_attribute *); | ||
89 | extern void bus_remove_file(struct bus_type *, struct bus_attribute *); | 91 | extern void bus_remove_file(struct bus_type *, struct bus_attribute *); |
90 | 92 | ||
91 | struct device_driver { | 93 | struct device_driver { |
@@ -107,14 +109,13 @@ struct device_driver { | |||
107 | }; | 109 | }; |
108 | 110 | ||
109 | 111 | ||
110 | extern int driver_register(struct device_driver * drv); | 112 | extern int __must_check driver_register(struct device_driver * drv); |
111 | extern void driver_unregister(struct device_driver * drv); | 113 | extern void driver_unregister(struct device_driver * drv); |
112 | 114 | ||
113 | extern struct device_driver * get_driver(struct device_driver * drv); | 115 | extern struct device_driver * get_driver(struct device_driver * drv); |
114 | extern void put_driver(struct device_driver * drv); | 116 | extern void put_driver(struct device_driver * drv); |
115 | extern struct device_driver *driver_find(const char *name, struct bus_type *bus); | 117 | extern struct device_driver *driver_find(const char *name, struct bus_type *bus); |
116 | 118 | ||
117 | |||
118 | /* driverfs interface for exporting driver attributes */ | 119 | /* driverfs interface for exporting driver attributes */ |
119 | 120 | ||
120 | struct driver_attribute { | 121 | struct driver_attribute { |
@@ -126,16 +127,17 @@ struct driver_attribute { | |||
126 | #define DRIVER_ATTR(_name,_mode,_show,_store) \ | 127 | #define DRIVER_ATTR(_name,_mode,_show,_store) \ |
127 | struct driver_attribute driver_attr_##_name = __ATTR(_name,_mode,_show,_store) | 128 | struct driver_attribute driver_attr_##_name = __ATTR(_name,_mode,_show,_store) |
128 | 129 | ||
129 | extern int driver_create_file(struct device_driver *, struct driver_attribute *); | 130 | extern int __must_check driver_create_file(struct device_driver *, |
131 | struct driver_attribute *); | ||
130 | extern void driver_remove_file(struct device_driver *, struct driver_attribute *); | 132 | extern void driver_remove_file(struct device_driver *, struct driver_attribute *); |
131 | 133 | ||
132 | extern int driver_for_each_device(struct device_driver * drv, struct device * start, | 134 | extern int __must_check driver_for_each_device(struct device_driver * drv, |
133 | void * data, int (*fn)(struct device *, void *)); | 135 | struct device *start, void *data, |
136 | int (*fn)(struct device *, void *)); | ||
134 | struct device * driver_find_device(struct device_driver *drv, | 137 | struct device * driver_find_device(struct device_driver *drv, |
135 | struct device *start, void *data, | 138 | struct device *start, void *data, |
136 | int (*match)(struct device *, void *)); | 139 | int (*match)(struct device *, void *)); |
137 | 140 | ||
138 | |||
139 | /* | 141 | /* |
140 | * device classes | 142 | * device classes |
141 | */ | 143 | */ |
@@ -168,7 +170,7 @@ struct class { | |||
168 | int (*resume)(struct device *); | 170 | int (*resume)(struct device *); |
169 | }; | 171 | }; |
170 | 172 | ||
171 | extern int class_register(struct class *); | 173 | extern int __must_check class_register(struct class *); |
172 | extern void class_unregister(struct class *); | 174 | extern void class_unregister(struct class *); |
173 | 175 | ||
174 | 176 | ||
@@ -181,7 +183,8 @@ struct class_attribute { | |||
181 | #define CLASS_ATTR(_name,_mode,_show,_store) \ | 183 | #define CLASS_ATTR(_name,_mode,_show,_store) \ |
182 | struct class_attribute class_attr_##_name = __ATTR(_name,_mode,_show,_store) | 184 | struct class_attribute class_attr_##_name = __ATTR(_name,_mode,_show,_store) |
183 | 185 | ||
184 | extern int class_create_file(struct class *, const struct class_attribute *); | 186 | extern int __must_check class_create_file(struct class *, |
187 | const struct class_attribute *); | ||
185 | extern void class_remove_file(struct class *, const struct class_attribute *); | 188 | extern void class_remove_file(struct class *, const struct class_attribute *); |
186 | 189 | ||
187 | struct class_device_attribute { | 190 | struct class_device_attribute { |
@@ -194,7 +197,7 @@ struct class_device_attribute { | |||
194 | struct class_device_attribute class_device_attr_##_name = \ | 197 | struct class_device_attribute class_device_attr_##_name = \ |
195 | __ATTR(_name,_mode,_show,_store) | 198 | __ATTR(_name,_mode,_show,_store) |
196 | 199 | ||
197 | extern int class_device_create_file(struct class_device *, | 200 | extern int __must_check class_device_create_file(struct class_device *, |
198 | const struct class_device_attribute *); | 201 | const struct class_device_attribute *); |
199 | 202 | ||
200 | /** | 203 | /** |
@@ -254,10 +257,10 @@ class_set_devdata (struct class_device *dev, void *data) | |||
254 | } | 257 | } |
255 | 258 | ||
256 | 259 | ||
257 | extern int class_device_register(struct class_device *); | 260 | extern int __must_check class_device_register(struct class_device *); |
258 | extern void class_device_unregister(struct class_device *); | 261 | extern void class_device_unregister(struct class_device *); |
259 | extern void class_device_initialize(struct class_device *); | 262 | extern void class_device_initialize(struct class_device *); |
260 | extern int class_device_add(struct class_device *); | 263 | extern int __must_check class_device_add(struct class_device *); |
261 | extern void class_device_del(struct class_device *); | 264 | extern void class_device_del(struct class_device *); |
262 | 265 | ||
263 | extern int class_device_rename(struct class_device *, char *); | 266 | extern int class_device_rename(struct class_device *, char *); |
@@ -267,7 +270,7 @@ extern void class_device_put(struct class_device *); | |||
267 | 270 | ||
268 | extern void class_device_remove_file(struct class_device *, | 271 | extern void class_device_remove_file(struct class_device *, |
269 | const struct class_device_attribute *); | 272 | const struct class_device_attribute *); |
270 | extern int class_device_create_bin_file(struct class_device *, | 273 | extern int __must_check class_device_create_bin_file(struct class_device *, |
271 | struct bin_attribute *); | 274 | struct bin_attribute *); |
272 | extern void class_device_remove_bin_file(struct class_device *, | 275 | extern void class_device_remove_bin_file(struct class_device *, |
273 | struct bin_attribute *); | 276 | struct bin_attribute *); |
@@ -282,7 +285,7 @@ struct class_interface { | |||
282 | void (*remove_dev) (struct device *, struct class_interface *); | 285 | void (*remove_dev) (struct device *, struct class_interface *); |
283 | }; | 286 | }; |
284 | 287 | ||
285 | extern int class_interface_register(struct class_interface *); | 288 | extern int __must_check class_interface_register(struct class_interface *); |
286 | extern void class_interface_unregister(struct class_interface *); | 289 | extern void class_interface_unregister(struct class_interface *); |
287 | 290 | ||
288 | extern struct class *class_create(struct module *owner, const char *name); | 291 | extern struct class *class_create(struct module *owner, const char *name); |
@@ -307,7 +310,8 @@ struct device_attribute { | |||
307 | #define DEVICE_ATTR(_name,_mode,_show,_store) \ | 310 | #define DEVICE_ATTR(_name,_mode,_show,_store) \ |
308 | struct device_attribute dev_attr_##_name = __ATTR(_name,_mode,_show,_store) | 311 | struct device_attribute dev_attr_##_name = __ATTR(_name,_mode,_show,_store) |
309 | 312 | ||
310 | extern int device_create_file(struct device *device, struct device_attribute * entry); | 313 | extern int __must_check device_create_file(struct device *device, |
314 | struct device_attribute * entry); | ||
311 | extern void device_remove_file(struct device * dev, struct device_attribute * attr); | 315 | extern void device_remove_file(struct device * dev, struct device_attribute * attr); |
312 | extern int __must_check device_create_bin_file(struct device *dev, | 316 | extern int __must_check device_create_bin_file(struct device *dev, |
313 | struct bin_attribute *attr); | 317 | struct bin_attribute *attr); |
@@ -380,12 +384,12 @@ static inline int device_is_registered(struct device *dev) | |||
380 | /* | 384 | /* |
381 | * High level routines for use by the bus drivers | 385 | * High level routines for use by the bus drivers |
382 | */ | 386 | */ |
383 | extern int device_register(struct device * dev); | 387 | extern int __must_check device_register(struct device * dev); |
384 | extern void device_unregister(struct device * dev); | 388 | extern void device_unregister(struct device * dev); |
385 | extern void device_initialize(struct device * dev); | 389 | extern void device_initialize(struct device * dev); |
386 | extern int device_add(struct device * dev); | 390 | extern int __must_check device_add(struct device * dev); |
387 | extern void device_del(struct device * dev); | 391 | extern void device_del(struct device * dev); |
388 | extern int device_for_each_child(struct device *, void *, | 392 | extern int __must_check device_for_each_child(struct device *, void *, |
389 | int (*fn)(struct device *, void *)); | 393 | int (*fn)(struct device *, void *)); |
390 | extern int device_rename(struct device *dev, char *new_name); | 394 | extern int device_rename(struct device *dev, char *new_name); |
391 | 395 | ||
@@ -395,7 +399,7 @@ extern int device_rename(struct device *dev, char *new_name); | |||
395 | */ | 399 | */ |
396 | extern void device_bind_driver(struct device * dev); | 400 | extern void device_bind_driver(struct device * dev); |
397 | extern void device_release_driver(struct device * dev); | 401 | extern void device_release_driver(struct device * dev); |
398 | extern int device_attach(struct device * dev); | 402 | extern int __must_check device_attach(struct device * dev); |
399 | extern void driver_attach(struct device_driver * drv); | 403 | extern void driver_attach(struct device_driver * drv); |
400 | extern void device_reprobe(struct device *dev); | 404 | extern void device_reprobe(struct device *dev); |
401 | 405 | ||
@@ -433,7 +437,7 @@ extern void device_shutdown(void); | |||
433 | 437 | ||
434 | 438 | ||
435 | /* drivers/base/firmware.c */ | 439 | /* drivers/base/firmware.c */ |
436 | extern int firmware_register(struct subsystem *); | 440 | extern int __must_check firmware_register(struct subsystem *); |
437 | extern void firmware_unregister(struct subsystem *); | 441 | extern void firmware_unregister(struct subsystem *); |
438 | 442 | ||
439 | /* debugging and troubleshooting/diagnostic helpers. */ | 443 | /* debugging and troubleshooting/diagnostic helpers. */ |