diff options
author | Andrew Morton <akpm@osdl.org> | 2006-08-15 01:43:17 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-09-26 00:08:39 -0400 |
commit | 4a7fb6363f2d1a6c09a10253937f672f3c7929e1 (patch) | |
tree | 46e70fc8baca37ffd901c472ce7ce13338fb4ece | |
parent | 35acfdd7253025e8441883fd8f879f5240844f95 (diff) |
add __must_check to device management code
We're getting a lot of crashes in the sysfs/kobject/device/bus/class code and
they're very hard to diagnose.
I'm suspecting that in some cases this is because drivers aren't checking
return values and aren't handling errors correctly. So the code blithely
blunders on and crashes later in very obscure ways.
There's just no reason to ignore errors which can and do occur. So the patch
sprinkles __must_check all over these APIs.
Causes 1,513 new warnings. Heh.
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | include/linux/device.h | 52 | ||||
-rw-r--r-- | include/linux/kobject.h | 16 | ||||
-rw-r--r-- | include/linux/pci.h | 34 | ||||
-rw-r--r-- | include/linux/sysfs.h | 19 |
4 files changed, 66 insertions, 55 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. */ |
diff --git a/include/linux/kobject.h b/include/linux/kobject.h index 2d229327959e..bcd9cd173c2c 100644 --- a/include/linux/kobject.h +++ b/include/linux/kobject.h | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/types.h> | 20 | #include <linux/types.h> |
21 | #include <linux/list.h> | 21 | #include <linux/list.h> |
22 | #include <linux/sysfs.h> | 22 | #include <linux/sysfs.h> |
23 | #include <linux/compiler.h> | ||
23 | #include <linux/spinlock.h> | 24 | #include <linux/spinlock.h> |
24 | #include <linux/rwsem.h> | 25 | #include <linux/rwsem.h> |
25 | #include <linux/kref.h> | 26 | #include <linux/kref.h> |
@@ -71,12 +72,12 @@ static inline const char * kobject_name(const struct kobject * kobj) | |||
71 | extern void kobject_init(struct kobject *); | 72 | extern void kobject_init(struct kobject *); |
72 | extern void kobject_cleanup(struct kobject *); | 73 | extern void kobject_cleanup(struct kobject *); |
73 | 74 | ||
74 | extern int kobject_add(struct kobject *); | 75 | extern int __must_check kobject_add(struct kobject *); |
75 | extern void kobject_del(struct kobject *); | 76 | extern void kobject_del(struct kobject *); |
76 | 77 | ||
77 | extern int kobject_rename(struct kobject *, const char *new_name); | 78 | extern int __must_check kobject_rename(struct kobject *, const char *new_name); |
78 | 79 | ||
79 | extern int kobject_register(struct kobject *); | 80 | extern int __must_check kobject_register(struct kobject *); |
80 | extern void kobject_unregister(struct kobject *); | 81 | extern void kobject_unregister(struct kobject *); |
81 | 82 | ||
82 | extern struct kobject * kobject_get(struct kobject *); | 83 | extern struct kobject * kobject_get(struct kobject *); |
@@ -128,8 +129,8 @@ struct kset { | |||
128 | 129 | ||
129 | 130 | ||
130 | extern void kset_init(struct kset * k); | 131 | extern void kset_init(struct kset * k); |
131 | extern int kset_add(struct kset * k); | 132 | extern int __must_check kset_add(struct kset * k); |
132 | extern int kset_register(struct kset * k); | 133 | extern int __must_check kset_register(struct kset * k); |
133 | extern void kset_unregister(struct kset * k); | 134 | extern void kset_unregister(struct kset * k); |
134 | 135 | ||
135 | static inline struct kset * to_kset(struct kobject * kobj) | 136 | static inline struct kset * to_kset(struct kobject * kobj) |
@@ -239,7 +240,7 @@ extern struct subsystem hypervisor_subsys; | |||
239 | (obj)->subsys.kset.kobj.kset = &(_subsys).kset | 240 | (obj)->subsys.kset.kobj.kset = &(_subsys).kset |
240 | 241 | ||
241 | extern void subsystem_init(struct subsystem *); | 242 | extern void subsystem_init(struct subsystem *); |
242 | extern int subsystem_register(struct subsystem *); | 243 | extern int __must_check subsystem_register(struct subsystem *); |
243 | extern void subsystem_unregister(struct subsystem *); | 244 | extern void subsystem_unregister(struct subsystem *); |
244 | 245 | ||
245 | static inline struct subsystem * subsys_get(struct subsystem * s) | 246 | static inline struct subsystem * subsys_get(struct subsystem * s) |
@@ -258,7 +259,8 @@ struct subsys_attribute { | |||
258 | ssize_t (*store)(struct subsystem *, const char *, size_t); | 259 | ssize_t (*store)(struct subsystem *, const char *, size_t); |
259 | }; | 260 | }; |
260 | 261 | ||
261 | extern int subsys_create_file(struct subsystem * , struct subsys_attribute *); | 262 | extern int __must_check subsys_create_file(struct subsystem * , |
263 | struct subsys_attribute *); | ||
262 | 264 | ||
263 | #if defined(CONFIG_HOTPLUG) | 265 | #if defined(CONFIG_HOTPLUG) |
264 | void kobject_uevent(struct kobject *kobj, enum kobject_action action); | 266 | void kobject_uevent(struct kobject *kobj, enum kobject_action action); |
diff --git a/include/linux/pci.h b/include/linux/pci.h index 9514bbfe96e2..3ec72551ac31 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h | |||
@@ -49,6 +49,7 @@ | |||
49 | #include <linux/types.h> | 49 | #include <linux/types.h> |
50 | #include <linux/ioport.h> | 50 | #include <linux/ioport.h> |
51 | #include <linux/list.h> | 51 | #include <linux/list.h> |
52 | #include <linux/compiler.h> | ||
52 | #include <linux/errno.h> | 53 | #include <linux/errno.h> |
53 | #include <linux/device.h> | 54 | #include <linux/device.h> |
54 | 55 | ||
@@ -403,7 +404,7 @@ extern struct list_head pci_root_buses; /* list of all known PCI buses */ | |||
403 | extern struct list_head pci_devices; /* list of all devices */ | 404 | extern struct list_head pci_devices; /* list of all devices */ |
404 | 405 | ||
405 | void pcibios_fixup_bus(struct pci_bus *); | 406 | void pcibios_fixup_bus(struct pci_bus *); |
406 | int pcibios_enable_device(struct pci_dev *, int mask); | 407 | int __must_check pcibios_enable_device(struct pci_dev *, int mask); |
407 | char *pcibios_setup (char *str); | 408 | char *pcibios_setup (char *str); |
408 | 409 | ||
409 | /* Used only when drivers/pci/setup.c is used */ | 410 | /* Used only when drivers/pci/setup.c is used */ |
@@ -490,19 +491,19 @@ static inline int pci_write_config_dword(struct pci_dev *dev, int where, u32 val | |||
490 | return pci_bus_write_config_dword (dev->bus, dev->devfn, where, val); | 491 | return pci_bus_write_config_dword (dev->bus, dev->devfn, where, val); |
491 | } | 492 | } |
492 | 493 | ||
493 | int pci_enable_device(struct pci_dev *dev); | 494 | int __must_check pci_enable_device(struct pci_dev *dev); |
494 | int pci_enable_device_bars(struct pci_dev *dev, int mask); | 495 | int __must_check pci_enable_device_bars(struct pci_dev *dev, int mask); |
495 | void pci_disable_device(struct pci_dev *dev); | 496 | void pci_disable_device(struct pci_dev *dev); |
496 | void pci_set_master(struct pci_dev *dev); | 497 | void pci_set_master(struct pci_dev *dev); |
497 | #define HAVE_PCI_SET_MWI | 498 | #define HAVE_PCI_SET_MWI |
498 | int pci_set_mwi(struct pci_dev *dev); | 499 | int __must_check pci_set_mwi(struct pci_dev *dev); |
499 | void pci_clear_mwi(struct pci_dev *dev); | 500 | void pci_clear_mwi(struct pci_dev *dev); |
500 | void pci_intx(struct pci_dev *dev, int enable); | 501 | void pci_intx(struct pci_dev *dev, int enable); |
501 | int pci_set_dma_mask(struct pci_dev *dev, u64 mask); | 502 | int pci_set_dma_mask(struct pci_dev *dev, u64 mask); |
502 | int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask); | 503 | int pci_set_consistent_dma_mask(struct pci_dev *dev, u64 mask); |
503 | void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno); | 504 | void pci_update_resource(struct pci_dev *dev, struct resource *res, int resno); |
504 | int pci_assign_resource(struct pci_dev *dev, int i); | 505 | int __must_check pci_assign_resource(struct pci_dev *dev, int i); |
505 | int pci_assign_resource_fixed(struct pci_dev *dev, int i); | 506 | int __must_check pci_assign_resource_fixed(struct pci_dev *dev, int i); |
506 | void pci_restore_bars(struct pci_dev *dev); | 507 | void pci_restore_bars(struct pci_dev *dev); |
507 | 508 | ||
508 | /* ROM control related routines */ | 509 | /* ROM control related routines */ |
@@ -528,23 +529,24 @@ void pdev_sort_resources(struct pci_dev *, struct resource_list *); | |||
528 | void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *), | 529 | void pci_fixup_irqs(u8 (*)(struct pci_dev *, u8 *), |
529 | int (*)(struct pci_dev *, u8, u8)); | 530 | int (*)(struct pci_dev *, u8, u8)); |
530 | #define HAVE_PCI_REQ_REGIONS 2 | 531 | #define HAVE_PCI_REQ_REGIONS 2 |
531 | int pci_request_regions(struct pci_dev *, const char *); | 532 | int __must_check pci_request_regions(struct pci_dev *, const char *); |
532 | void pci_release_regions(struct pci_dev *); | 533 | void pci_release_regions(struct pci_dev *); |
533 | int pci_request_region(struct pci_dev *, int, const char *); | 534 | int __must_check pci_request_region(struct pci_dev *, int, const char *); |
534 | void pci_release_region(struct pci_dev *, int); | 535 | void pci_release_region(struct pci_dev *, int); |
535 | 536 | ||
536 | /* drivers/pci/bus.c */ | 537 | /* drivers/pci/bus.c */ |
537 | int pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res, | 538 | int __must_check pci_bus_alloc_resource(struct pci_bus *bus, |
538 | resource_size_t size, resource_size_t align, | 539 | struct resource *res, resource_size_t size, |
539 | resource_size_t min, unsigned int type_mask, | 540 | resource_size_t align, resource_size_t min, |
540 | void (*alignf)(void *, struct resource *, | 541 | unsigned int type_mask, |
541 | resource_size_t, resource_size_t), | 542 | void (*alignf)(void *, struct resource *, |
542 | void *alignf_data); | 543 | resource_size_t, resource_size_t), |
544 | void *alignf_data); | ||
543 | void pci_enable_bridges(struct pci_bus *bus); | 545 | void pci_enable_bridges(struct pci_bus *bus); |
544 | 546 | ||
545 | /* Proper probing supporting hot-pluggable devices */ | 547 | /* Proper probing supporting hot-pluggable devices */ |
546 | int __pci_register_driver(struct pci_driver *, struct module *); | 548 | int __must_check __pci_register_driver(struct pci_driver *, struct module *); |
547 | static inline int pci_register_driver(struct pci_driver *driver) | 549 | static inline int __must_check pci_register_driver(struct pci_driver *driver) |
548 | { | 550 | { |
549 | return __pci_register_driver(driver, THIS_MODULE); | 551 | return __pci_register_driver(driver, THIS_MODULE); |
550 | } | 552 | } |
diff --git a/include/linux/sysfs.h b/include/linux/sysfs.h index 95f6db54d8d2..02ad790921fd 100644 --- a/include/linux/sysfs.h +++ b/include/linux/sysfs.h | |||
@@ -10,6 +10,7 @@ | |||
10 | #ifndef _SYSFS_H_ | 10 | #ifndef _SYSFS_H_ |
11 | #define _SYSFS_H_ | 11 | #define _SYSFS_H_ |
12 | 12 | ||
13 | #include <linux/compiler.h> | ||
13 | #include <asm/atomic.h> | 14 | #include <asm/atomic.h> |
14 | 15 | ||
15 | struct kobject; | 16 | struct kobject; |
@@ -86,37 +87,39 @@ struct sysfs_dirent { | |||
86 | 87 | ||
87 | #ifdef CONFIG_SYSFS | 88 | #ifdef CONFIG_SYSFS |
88 | 89 | ||
89 | extern int | 90 | extern int __must_check |
90 | sysfs_create_dir(struct kobject *); | 91 | sysfs_create_dir(struct kobject *); |
91 | 92 | ||
92 | extern void | 93 | extern void |
93 | sysfs_remove_dir(struct kobject *); | 94 | sysfs_remove_dir(struct kobject *); |
94 | 95 | ||
95 | extern int | 96 | extern int __must_check |
96 | sysfs_rename_dir(struct kobject *, const char *new_name); | 97 | sysfs_rename_dir(struct kobject *, const char *new_name); |
97 | 98 | ||
98 | extern int | 99 | extern int __must_check |
99 | sysfs_create_file(struct kobject *, const struct attribute *); | 100 | sysfs_create_file(struct kobject *, const struct attribute *); |
100 | 101 | ||
101 | extern int | 102 | extern int __must_check |
102 | sysfs_update_file(struct kobject *, const struct attribute *); | 103 | sysfs_update_file(struct kobject *, const struct attribute *); |
103 | 104 | ||
104 | extern int | 105 | extern int __must_check |
105 | sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, mode_t mode); | 106 | sysfs_chmod_file(struct kobject *kobj, struct attribute *attr, mode_t mode); |
106 | 107 | ||
107 | extern void | 108 | extern void |
108 | sysfs_remove_file(struct kobject *, const struct attribute *); | 109 | sysfs_remove_file(struct kobject *, const struct attribute *); |
109 | 110 | ||
110 | extern int | 111 | extern int __must_check |
111 | sysfs_create_link(struct kobject * kobj, struct kobject * target, const char * name); | 112 | sysfs_create_link(struct kobject * kobj, struct kobject * target, const char * name); |
112 | 113 | ||
113 | extern void | 114 | extern void |
114 | sysfs_remove_link(struct kobject *, const char * name); | 115 | sysfs_remove_link(struct kobject *, const char * name); |
115 | 116 | ||
116 | int sysfs_create_bin_file(struct kobject * kobj, struct bin_attribute * attr); | 117 | int __must_check sysfs_create_bin_file(struct kobject *kobj, |
118 | struct bin_attribute *attr); | ||
117 | void sysfs_remove_bin_file(struct kobject *kobj, struct bin_attribute *attr); | 119 | void sysfs_remove_bin_file(struct kobject *kobj, struct bin_attribute *attr); |
118 | 120 | ||
119 | int sysfs_create_group(struct kobject *, const struct attribute_group *); | 121 | int __must_check sysfs_create_group(struct kobject *, |
122 | const struct attribute_group *); | ||
120 | void sysfs_remove_group(struct kobject *, const struct attribute_group *); | 123 | void sysfs_remove_group(struct kobject *, const struct attribute_group *); |
121 | void sysfs_notify(struct kobject * k, char *dir, char *attr); | 124 | void sysfs_notify(struct kobject * k, char *dir, char *attr); |
122 | 125 | ||