diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2008-01-25 00:04:46 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-01-25 00:04:46 -0500 |
commit | d462943afee8bff610258a82dba666e8ab72c9c8 (patch) | |
tree | 9046b34170b01ca0a134be0e7ad498f97611e121 /include/linux/device.h | |
parent | 5ed2c832ed256b18d90c2462369c62fd79312e6c (diff) |
Driver core: fix coding style issues in device.h
Finally clean up the odd spaces and other mess in device.h
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include/linux/device.h')
-rw-r--r-- | include/linux/device.h | 283 |
1 files changed, 145 insertions, 138 deletions
diff --git a/include/linux/device.h b/include/linux/device.h index cdaf57bf4d19..1880208964d6 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
@@ -25,7 +25,8 @@ | |||
25 | #include <asm/device.h> | 25 | #include <asm/device.h> |
26 | 26 | ||
27 | #define DEVICE_NAME_SIZE 50 | 27 | #define DEVICE_NAME_SIZE 50 |
28 | #define DEVICE_NAME_HALF __stringify(20) /* Less than half to accommodate slop */ | 28 | /* DEVICE_NAME_HALF is really less than half to accommodate slop */ |
29 | #define DEVICE_NAME_HALF __stringify(20) | ||
29 | #define DEVICE_ID_SIZE 32 | 30 | #define DEVICE_ID_SIZE 32 |
30 | #define BUS_ID_SIZE KOBJ_NAME_LEN | 31 | #define BUS_ID_SIZE KOBJ_NAME_LEN |
31 | 32 | ||
@@ -40,52 +41,53 @@ struct bus_type_private; | |||
40 | 41 | ||
41 | struct bus_attribute { | 42 | struct bus_attribute { |
42 | struct attribute attr; | 43 | struct attribute attr; |
43 | ssize_t (*show)(struct bus_type *, char * buf); | 44 | ssize_t (*show)(struct bus_type *bus, char *buf); |
44 | ssize_t (*store)(struct bus_type *, const char * buf, size_t count); | 45 | ssize_t (*store)(struct bus_type *bus, const char *buf, size_t count); |
45 | }; | 46 | }; |
46 | 47 | ||
47 | #define BUS_ATTR(_name,_mode,_show,_store) \ | 48 | #define BUS_ATTR(_name, _mode, _show, _store) \ |
48 | struct bus_attribute bus_attr_##_name = __ATTR(_name,_mode,_show,_store) | 49 | struct bus_attribute bus_attr_##_name = __ATTR(_name, _mode, _show, _store) |
49 | 50 | ||
50 | extern int __must_check bus_create_file(struct bus_type *, | 51 | extern int __must_check bus_create_file(struct bus_type *, |
51 | struct bus_attribute *); | 52 | struct bus_attribute *); |
52 | extern void bus_remove_file(struct bus_type *, struct bus_attribute *); | 53 | extern void bus_remove_file(struct bus_type *, struct bus_attribute *); |
53 | 54 | ||
54 | struct bus_type { | 55 | struct bus_type { |
55 | const char * name; | 56 | const char *name; |
56 | struct bus_attribute * bus_attrs; | 57 | struct bus_attribute *bus_attrs; |
57 | struct device_attribute * dev_attrs; | 58 | struct device_attribute *dev_attrs; |
58 | struct driver_attribute * drv_attrs; | 59 | struct driver_attribute *drv_attrs; |
59 | 60 | ||
60 | int (*match)(struct device * dev, struct device_driver * drv); | 61 | int (*match)(struct device *dev, struct device_driver *drv); |
61 | int (*uevent)(struct device *dev, struct kobj_uevent_env *env); | 62 | int (*uevent)(struct device *dev, struct kobj_uevent_env *env); |
62 | int (*probe)(struct device * dev); | 63 | int (*probe)(struct device *dev); |
63 | int (*remove)(struct device * dev); | 64 | int (*remove)(struct device *dev); |
64 | void (*shutdown)(struct device * dev); | 65 | void (*shutdown)(struct device *dev); |
65 | 66 | ||
66 | int (*suspend)(struct device * dev, pm_message_t state); | 67 | int (*suspend)(struct device *dev, pm_message_t state); |
67 | int (*suspend_late)(struct device * dev, pm_message_t state); | 68 | int (*suspend_late)(struct device *dev, pm_message_t state); |
68 | int (*resume_early)(struct device * dev); | 69 | int (*resume_early)(struct device *dev); |
69 | int (*resume)(struct device * dev); | 70 | int (*resume)(struct device *dev); |
70 | 71 | ||
71 | struct bus_type_private *p; | 72 | struct bus_type_private *p; |
72 | }; | 73 | }; |
73 | 74 | ||
74 | extern int __must_check bus_register(struct bus_type * bus); | 75 | extern int __must_check bus_register(struct bus_type *bus); |
75 | extern void bus_unregister(struct bus_type * bus); | 76 | extern void bus_unregister(struct bus_type *bus); |
76 | 77 | ||
77 | extern int __must_check bus_rescan_devices(struct bus_type * bus); | 78 | extern int __must_check bus_rescan_devices(struct bus_type *bus); |
78 | 79 | ||
79 | /* iterator helpers for buses */ | 80 | /* iterator helpers for buses */ |
80 | 81 | ||
81 | int bus_for_each_dev(struct bus_type * bus, struct device * start, void * data, | 82 | int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data, |
82 | int (*fn)(struct device *, void *)); | 83 | int (*fn)(struct device *dev, void *data)); |
83 | struct device * bus_find_device(struct bus_type *bus, struct device *start, | 84 | struct device *bus_find_device(struct bus_type *bus, struct device *start, |
84 | void *data, int (*match)(struct device *, void *)); | 85 | void *data, |
86 | int (*match)(struct device *dev, void *data)); | ||
85 | 87 | ||
86 | int __must_check bus_for_each_drv(struct bus_type *bus, | 88 | int __must_check bus_for_each_drv(struct bus_type *bus, |
87 | struct device_driver *start, void *data, | 89 | struct device_driver *start, void *data, |
88 | int (*fn)(struct device_driver *, void *)); | 90 | int (*fn)(struct device_driver *, void *)); |
89 | 91 | ||
90 | /* | 92 | /* |
91 | * Bus notifiers: Get notified of addition/removal of devices | 93 | * Bus notifiers: Get notified of addition/removal of devices |
@@ -120,57 +122,63 @@ struct device_driver { | |||
120 | struct module *owner; | 122 | struct module *owner; |
121 | const char *mod_name; /* used for built-in modules */ | 123 | const char *mod_name; /* used for built-in modules */ |
122 | 124 | ||
123 | int (*probe) (struct device * dev); | 125 | int (*probe) (struct device *dev); |
124 | int (*remove) (struct device * dev); | 126 | int (*remove) (struct device *dev); |
125 | void (*shutdown) (struct device * dev); | 127 | void (*shutdown) (struct device *dev); |
126 | int (*suspend) (struct device * dev, pm_message_t state); | 128 | int (*suspend) (struct device *dev, pm_message_t state); |
127 | int (*resume) (struct device * dev); | 129 | int (*resume) (struct device *dev); |
128 | struct attribute_group **groups; | 130 | struct attribute_group **groups; |
129 | 131 | ||
130 | struct driver_private *p; | 132 | struct driver_private *p; |
131 | }; | 133 | }; |
132 | 134 | ||
133 | 135 | ||
134 | extern int __must_check driver_register(struct device_driver * drv); | 136 | extern int __must_check driver_register(struct device_driver *drv); |
135 | extern void driver_unregister(struct device_driver * drv); | 137 | extern void driver_unregister(struct device_driver *drv); |
136 | 138 | ||
137 | extern struct device_driver * get_driver(struct device_driver * drv); | 139 | extern struct device_driver *get_driver(struct device_driver *drv); |
138 | extern void put_driver(struct device_driver * drv); | 140 | extern void put_driver(struct device_driver *drv); |
139 | extern struct device_driver *driver_find(const char *name, struct bus_type *bus); | 141 | extern struct device_driver *driver_find(const char *name, |
142 | struct bus_type *bus); | ||
140 | extern int driver_probe_done(void); | 143 | extern int driver_probe_done(void); |
141 | 144 | ||
142 | /* sysfs interface for exporting driver attributes */ | 145 | /* sysfs interface for exporting driver attributes */ |
143 | 146 | ||
144 | struct driver_attribute { | 147 | struct driver_attribute { |
145 | struct attribute attr; | 148 | struct attribute attr; |
146 | ssize_t (*show)(struct device_driver *, char * buf); | 149 | ssize_t (*show)(struct device_driver *driver, char *buf); |
147 | ssize_t (*store)(struct device_driver *, const char * buf, size_t count); | 150 | ssize_t (*store)(struct device_driver *driver, const char *buf, |
151 | size_t count); | ||
148 | }; | 152 | }; |
149 | 153 | ||
150 | #define DRIVER_ATTR(_name,_mode,_show,_store) \ | 154 | #define DRIVER_ATTR(_name, _mode, _show, _store) \ |
151 | struct driver_attribute driver_attr_##_name = __ATTR(_name,_mode,_show,_store) | 155 | struct driver_attribute driver_attr_##_name = \ |
156 | __ATTR(_name, _mode, _show, _store) | ||
152 | 157 | ||
153 | extern int __must_check driver_create_file(struct device_driver *, | 158 | extern int __must_check driver_create_file(struct device_driver *driver, |
154 | struct driver_attribute *); | 159 | struct driver_attribute *attr); |
155 | extern void driver_remove_file(struct device_driver *, struct driver_attribute *); | 160 | extern void driver_remove_file(struct device_driver *driver, |
161 | struct driver_attribute *attr); | ||
156 | 162 | ||
157 | extern int __must_check driver_add_kobj(struct device_driver *drv, | 163 | extern int __must_check driver_add_kobj(struct device_driver *drv, |
158 | struct kobject *kobj, | 164 | struct kobject *kobj, |
159 | const char *fmt, ...); | 165 | const char *fmt, ...); |
160 | 166 | ||
161 | extern int __must_check driver_for_each_device(struct device_driver * drv, | 167 | extern int __must_check driver_for_each_device(struct device_driver *drv, |
162 | struct device *start, void *data, | 168 | struct device *start, |
163 | int (*fn)(struct device *, void *)); | 169 | void *data, |
164 | struct device * driver_find_device(struct device_driver *drv, | 170 | int (*fn)(struct device *dev, |
165 | struct device *start, void *data, | 171 | void *)); |
166 | int (*match)(struct device *, void *)); | 172 | struct device *driver_find_device(struct device_driver *drv, |
173 | struct device *start, void *data, | ||
174 | int (*match)(struct device *dev, void *data)); | ||
167 | 175 | ||
168 | /* | 176 | /* |
169 | * device classes | 177 | * device classes |
170 | */ | 178 | */ |
171 | struct class { | 179 | struct class { |
172 | const char * name; | 180 | const char *name; |
173 | struct module * owner; | 181 | struct module *owner; |
174 | 182 | ||
175 | struct kset subsys; | 183 | struct kset subsys; |
176 | struct list_head children; | 184 | struct list_head children; |
@@ -178,23 +186,23 @@ struct class { | |||
178 | struct list_head interfaces; | 186 | struct list_head interfaces; |
179 | struct kset class_dirs; | 187 | struct kset class_dirs; |
180 | struct semaphore sem; /* locks children, devices, interfaces */ | 188 | struct semaphore sem; /* locks children, devices, interfaces */ |
181 | struct class_attribute * class_attrs; | 189 | struct class_attribute *class_attrs; |
182 | struct class_device_attribute * class_dev_attrs; | 190 | struct class_device_attribute *class_dev_attrs; |
183 | struct device_attribute * dev_attrs; | 191 | struct device_attribute *dev_attrs; |
184 | 192 | ||
185 | int (*uevent)(struct class_device *dev, struct kobj_uevent_env *env); | 193 | int (*uevent)(struct class_device *dev, struct kobj_uevent_env *env); |
186 | int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env); | 194 | int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env); |
187 | 195 | ||
188 | void (*release)(struct class_device *dev); | 196 | void (*release)(struct class_device *dev); |
189 | void (*class_release)(struct class *class); | 197 | void (*class_release)(struct class *class); |
190 | void (*dev_release)(struct device *dev); | 198 | void (*dev_release)(struct device *dev); |
191 | 199 | ||
192 | int (*suspend)(struct device *, pm_message_t state); | 200 | int (*suspend)(struct device *dev, pm_message_t state); |
193 | int (*resume)(struct device *); | 201 | int (*resume)(struct device *dev); |
194 | }; | 202 | }; |
195 | 203 | ||
196 | extern int __must_check class_register(struct class *); | 204 | extern int __must_check class_register(struct class *class); |
197 | extern void class_unregister(struct class *); | 205 | extern void class_unregister(struct class *class); |
198 | extern int class_for_each_device(struct class *class, void *data, | 206 | extern int class_for_each_device(struct class *class, void *data, |
199 | int (*fn)(struct device *dev, void *data)); | 207 | int (*fn)(struct device *dev, void *data)); |
200 | extern struct device *class_find_device(struct class *class, void *data, | 208 | extern struct device *class_find_device(struct class *class, void *data, |
@@ -204,27 +212,28 @@ extern struct class_device *class_find_child(struct class *class, void *data, | |||
204 | 212 | ||
205 | 213 | ||
206 | struct class_attribute { | 214 | struct class_attribute { |
207 | struct attribute attr; | 215 | struct attribute attr; |
208 | ssize_t (*show)(struct class *, char * buf); | 216 | ssize_t (*show)(struct class *class, char *buf); |
209 | ssize_t (*store)(struct class *, const char * buf, size_t count); | 217 | ssize_t (*store)(struct class *class, const char *buf, size_t count); |
210 | }; | 218 | }; |
211 | 219 | ||
212 | #define CLASS_ATTR(_name,_mode,_show,_store) \ | 220 | #define CLASS_ATTR(_name, _mode, _show, _store) \ |
213 | struct class_attribute class_attr_##_name = __ATTR(_name,_mode,_show,_store) | 221 | struct class_attribute class_attr_##_name = __ATTR(_name, _mode, _show, _store) |
214 | 222 | ||
215 | extern int __must_check class_create_file(struct class *, | 223 | extern int __must_check class_create_file(struct class *class, |
216 | const struct class_attribute *); | 224 | const struct class_attribute *attr); |
217 | extern void class_remove_file(struct class *, const struct class_attribute *); | 225 | extern void class_remove_file(struct class *class, |
226 | const struct class_attribute *attr); | ||
218 | 227 | ||
219 | struct class_device_attribute { | 228 | struct class_device_attribute { |
220 | struct attribute attr; | 229 | struct attribute attr; |
221 | ssize_t (*show)(struct class_device *, char * buf); | 230 | ssize_t (*show)(struct class_device *, char *buf); |
222 | ssize_t (*store)(struct class_device *, const char * buf, size_t count); | 231 | ssize_t (*store)(struct class_device *, const char *buf, size_t count); |
223 | }; | 232 | }; |
224 | 233 | ||
225 | #define CLASS_DEVICE_ATTR(_name,_mode,_show,_store) \ | 234 | #define CLASS_DEVICE_ATTR(_name, _mode, _show, _store) \ |
226 | struct class_device_attribute class_device_attr_##_name = \ | 235 | struct class_device_attribute class_device_attr_##_name = \ |
227 | __ATTR(_name,_mode,_show,_store) | 236 | __ATTR(_name, _mode, _show, _store) |
228 | 237 | ||
229 | extern int __must_check class_device_create_file(struct class_device *, | 238 | extern int __must_check class_device_create_file(struct class_device *, |
230 | const struct class_device_attribute *); | 239 | const struct class_device_attribute *); |
@@ -257,26 +266,24 @@ struct class_device { | |||
257 | struct list_head node; | 266 | struct list_head node; |
258 | 267 | ||
259 | struct kobject kobj; | 268 | struct kobject kobj; |
260 | struct class * class; /* required */ | 269 | struct class *class; |
261 | dev_t devt; /* dev_t, creates the sysfs "dev" */ | 270 | dev_t devt; |
262 | struct device * dev; /* not necessary, but nice to have */ | 271 | struct device *dev; |
263 | void * class_data; /* class-specific data */ | 272 | void *class_data; |
264 | struct class_device *parent; /* parent of this child device, if there is one */ | 273 | struct class_device *parent; |
265 | struct attribute_group ** groups; /* optional groups */ | 274 | struct attribute_group **groups; |
266 | 275 | ||
267 | void (*release)(struct class_device *dev); | 276 | void (*release)(struct class_device *dev); |
268 | int (*uevent)(struct class_device *dev, struct kobj_uevent_env *env); | 277 | int (*uevent)(struct class_device *dev, struct kobj_uevent_env *env); |
269 | char class_id[BUS_ID_SIZE]; /* unique to this class */ | 278 | char class_id[BUS_ID_SIZE]; |
270 | }; | 279 | }; |
271 | 280 | ||
272 | static inline void * | 281 | static inline void *class_get_devdata(struct class_device *dev) |
273 | class_get_devdata (struct class_device *dev) | ||
274 | { | 282 | { |
275 | return dev->class_data; | 283 | return dev->class_data; |
276 | } | 284 | } |
277 | 285 | ||
278 | static inline void | 286 | static inline void class_set_devdata(struct class_device *dev, void *data) |
279 | class_set_devdata (struct class_device *dev, void *data) | ||
280 | { | 287 | { |
281 | dev->class_data = data; | 288 | dev->class_data = data; |
282 | } | 289 | } |
@@ -288,10 +295,10 @@ extern void class_device_initialize(struct class_device *); | |||
288 | extern int __must_check class_device_add(struct class_device *); | 295 | extern int __must_check class_device_add(struct class_device *); |
289 | extern void class_device_del(struct class_device *); | 296 | extern void class_device_del(struct class_device *); |
290 | 297 | ||
291 | extern struct class_device * class_device_get(struct class_device *); | 298 | extern struct class_device *class_device_get(struct class_device *); |
292 | extern void class_device_put(struct class_device *); | 299 | extern void class_device_put(struct class_device *); |
293 | 300 | ||
294 | extern void class_device_remove_file(struct class_device *, | 301 | extern void class_device_remove_file(struct class_device *, |
295 | const struct class_device_attribute *); | 302 | const struct class_device_attribute *); |
296 | extern int __must_check class_device_create_bin_file(struct class_device *, | 303 | extern int __must_check class_device_create_bin_file(struct class_device *, |
297 | struct bin_attribute *); | 304 | struct bin_attribute *); |
@@ -318,7 +325,7 @@ extern struct class_device *class_device_create(struct class *cls, | |||
318 | dev_t devt, | 325 | dev_t devt, |
319 | struct device *device, | 326 | struct device *device, |
320 | const char *fmt, ...) | 327 | const char *fmt, ...) |
321 | __attribute__((format(printf,5,6))); | 328 | __attribute__((format(printf, 5, 6))); |
322 | extern void class_device_destroy(struct class *cls, dev_t devt); | 329 | extern void class_device_destroy(struct class *cls, dev_t devt); |
323 | 330 | ||
324 | /* | 331 | /* |
@@ -335,8 +342,8 @@ struct device_type { | |||
335 | struct attribute_group **groups; | 342 | struct attribute_group **groups; |
336 | int (*uevent)(struct device *dev, struct kobj_uevent_env *env); | 343 | int (*uevent)(struct device *dev, struct kobj_uevent_env *env); |
337 | void (*release)(struct device *dev); | 344 | void (*release)(struct device *dev); |
338 | int (*suspend)(struct device * dev, pm_message_t state); | 345 | int (*suspend)(struct device *dev, pm_message_t state); |
339 | int (*resume)(struct device * dev); | 346 | int (*resume)(struct device *dev); |
340 | }; | 347 | }; |
341 | 348 | ||
342 | /* interface for exporting device attributes */ | 349 | /* interface for exporting device attributes */ |
@@ -348,18 +355,19 @@ struct device_attribute { | |||
348 | const char *buf, size_t count); | 355 | const char *buf, size_t count); |
349 | }; | 356 | }; |
350 | 357 | ||
351 | #define DEVICE_ATTR(_name,_mode,_show,_store) \ | 358 | #define DEVICE_ATTR(_name, _mode, _show, _store) \ |
352 | struct device_attribute dev_attr_##_name = __ATTR(_name,_mode,_show,_store) | 359 | struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store) |
353 | 360 | ||
354 | extern int __must_check device_create_file(struct device *device, | 361 | extern int __must_check device_create_file(struct device *device, |
355 | struct device_attribute * entry); | 362 | struct device_attribute *entry); |
356 | extern void device_remove_file(struct device * dev, struct device_attribute * attr); | 363 | extern void device_remove_file(struct device *dev, |
364 | struct device_attribute *attr); | ||
357 | extern int __must_check device_create_bin_file(struct device *dev, | 365 | extern int __must_check device_create_bin_file(struct device *dev, |
358 | struct bin_attribute *attr); | 366 | struct bin_attribute *attr); |
359 | extern void device_remove_bin_file(struct device *dev, | 367 | extern void device_remove_bin_file(struct device *dev, |
360 | struct bin_attribute *attr); | 368 | struct bin_attribute *attr); |
361 | extern int device_schedule_callback_owner(struct device *dev, | 369 | extern int device_schedule_callback_owner(struct device *dev, |
362 | void (*func)(struct device *), struct module *owner); | 370 | void (*func)(struct device *dev), struct module *owner); |
363 | 371 | ||
364 | /* This is a macro to avoid include problems with THIS_MODULE */ | 372 | /* This is a macro to avoid include problems with THIS_MODULE */ |
365 | #define device_schedule_callback(dev, func) \ | 373 | #define device_schedule_callback(dev, func) \ |
@@ -370,21 +378,21 @@ typedef void (*dr_release_t)(struct device *dev, void *res); | |||
370 | typedef int (*dr_match_t)(struct device *dev, void *res, void *match_data); | 378 | typedef int (*dr_match_t)(struct device *dev, void *res, void *match_data); |
371 | 379 | ||
372 | #ifdef CONFIG_DEBUG_DEVRES | 380 | #ifdef CONFIG_DEBUG_DEVRES |
373 | extern void * __devres_alloc(dr_release_t release, size_t size, gfp_t gfp, | 381 | extern void *__devres_alloc(dr_release_t release, size_t size, gfp_t gfp, |
374 | const char *name); | 382 | const char *name); |
375 | #define devres_alloc(release, size, gfp) \ | 383 | #define devres_alloc(release, size, gfp) \ |
376 | __devres_alloc(release, size, gfp, #release) | 384 | __devres_alloc(release, size, gfp, #release) |
377 | #else | 385 | #else |
378 | extern void * devres_alloc(dr_release_t release, size_t size, gfp_t gfp); | 386 | extern void *devres_alloc(dr_release_t release, size_t size, gfp_t gfp); |
379 | #endif | 387 | #endif |
380 | extern void devres_free(void *res); | 388 | extern void devres_free(void *res); |
381 | extern void devres_add(struct device *dev, void *res); | 389 | extern void devres_add(struct device *dev, void *res); |
382 | extern void * devres_find(struct device *dev, dr_release_t release, | 390 | extern void *devres_find(struct device *dev, dr_release_t release, |
383 | dr_match_t match, void *match_data); | ||
384 | extern void * devres_get(struct device *dev, void *new_res, | ||
385 | dr_match_t match, void *match_data); | 391 | dr_match_t match, void *match_data); |
386 | extern void * devres_remove(struct device *dev, dr_release_t release, | 392 | extern void *devres_get(struct device *dev, void *new_res, |
387 | dr_match_t match, void *match_data); | 393 | dr_match_t match, void *match_data); |
394 | extern void *devres_remove(struct device *dev, dr_release_t release, | ||
395 | dr_match_t match, void *match_data); | ||
388 | extern int devres_destroy(struct device *dev, dr_release_t release, | 396 | extern int devres_destroy(struct device *dev, dr_release_t release, |
389 | dr_match_t match, void *match_data); | 397 | dr_match_t match, void *match_data); |
390 | 398 | ||
@@ -401,7 +409,7 @@ extern void devm_kfree(struct device *dev, void *p); | |||
401 | 409 | ||
402 | struct device { | 410 | struct device { |
403 | struct klist klist_children; | 411 | struct klist klist_children; |
404 | struct klist_node knode_parent; /* node in sibling list */ | 412 | struct klist_node knode_parent; /* node in sibling list */ |
405 | struct klist_node knode_driver; | 413 | struct klist_node knode_driver; |
406 | struct klist_node knode_bus; | 414 | struct klist_node knode_bus; |
407 | struct device *parent; | 415 | struct device *parent; |
@@ -416,7 +424,7 @@ struct device { | |||
416 | * its driver. | 424 | * its driver. |
417 | */ | 425 | */ |
418 | 426 | ||
419 | struct bus_type * bus; /* type of bus device is on */ | 427 | struct bus_type *bus; /* type of bus device is on */ |
420 | struct device_driver *driver; /* which driver has allocated this | 428 | struct device_driver *driver; /* which driver has allocated this |
421 | device */ | 429 | device */ |
422 | void *driver_data; /* data private to the driver */ | 430 | void *driver_data; /* data private to the driver */ |
@@ -447,10 +455,10 @@ struct device { | |||
447 | /* class_device migration path */ | 455 | /* class_device migration path */ |
448 | struct list_head node; | 456 | struct list_head node; |
449 | struct class *class; | 457 | struct class *class; |
450 | dev_t devt; /* dev_t, creates the sysfs "dev" */ | 458 | dev_t devt; /* dev_t, creates the sysfs "dev" */ |
451 | struct attribute_group **groups; /* optional groups */ | 459 | struct attribute_group **groups; /* optional groups */ |
452 | 460 | ||
453 | void (*release)(struct device * dev); | 461 | void (*release)(struct device *dev); |
454 | }; | 462 | }; |
455 | 463 | ||
456 | #ifdef CONFIG_NUMA | 464 | #ifdef CONFIG_NUMA |
@@ -472,14 +480,12 @@ static inline void set_dev_node(struct device *dev, int node) | |||
472 | } | 480 | } |
473 | #endif | 481 | #endif |
474 | 482 | ||
475 | static inline void * | 483 | static inline void *dev_get_drvdata(struct device *dev) |
476 | dev_get_drvdata (struct device *dev) | ||
477 | { | 484 | { |
478 | return dev->driver_data; | 485 | return dev->driver_data; |
479 | } | 486 | } |
480 | 487 | ||
481 | static inline void | 488 | static inline void dev_set_drvdata(struct device *dev, void *data) |
482 | dev_set_drvdata (struct device *dev, void *data) | ||
483 | { | 489 | { |
484 | dev->driver_data = data; | 490 | dev->driver_data = data; |
485 | } | 491 | } |
@@ -494,15 +500,15 @@ void driver_init(void); | |||
494 | /* | 500 | /* |
495 | * High level routines for use by the bus drivers | 501 | * High level routines for use by the bus drivers |
496 | */ | 502 | */ |
497 | extern int __must_check device_register(struct device * dev); | 503 | extern int __must_check device_register(struct device *dev); |
498 | extern void device_unregister(struct device * dev); | 504 | extern void device_unregister(struct device *dev); |
499 | extern void device_initialize(struct device * dev); | 505 | extern void device_initialize(struct device *dev); |
500 | extern int __must_check device_add(struct device * dev); | 506 | extern int __must_check device_add(struct device *dev); |
501 | extern void device_del(struct device * dev); | 507 | extern void device_del(struct device *dev); |
502 | extern int device_for_each_child(struct device *, void *, | 508 | extern int device_for_each_child(struct device *dev, void *data, |
503 | int (*fn)(struct device *, void *)); | 509 | int (*fn)(struct device *dev, void *data)); |
504 | extern struct device *device_find_child(struct device *, void *data, | 510 | extern struct device *device_find_child(struct device *dev, void *data, |
505 | int (*match)(struct device *, void *)); | 511 | int (*match)(struct device *dev, void *data)); |
506 | extern int device_rename(struct device *dev, char *new_name); | 512 | extern int device_rename(struct device *dev, char *new_name); |
507 | extern int device_move(struct device *dev, struct device *new_parent); | 513 | extern int device_move(struct device *dev, struct device *new_parent); |
508 | 514 | ||
@@ -511,8 +517,8 @@ extern int device_move(struct device *dev, struct device *new_parent); | |||
511 | * for information on use. | 517 | * for information on use. |
512 | */ | 518 | */ |
513 | extern int __must_check device_bind_driver(struct device *dev); | 519 | extern int __must_check device_bind_driver(struct device *dev); |
514 | extern void device_release_driver(struct device * dev); | 520 | extern void device_release_driver(struct device *dev); |
515 | extern int __must_check device_attach(struct device * dev); | 521 | extern int __must_check device_attach(struct device *dev); |
516 | extern int __must_check driver_attach(struct device_driver *drv); | 522 | extern int __must_check driver_attach(struct device_driver *drv); |
517 | extern int __must_check device_reprobe(struct device *dev); | 523 | extern int __must_check device_reprobe(struct device *dev); |
518 | 524 | ||
@@ -521,7 +527,7 @@ extern int __must_check device_reprobe(struct device *dev); | |||
521 | */ | 527 | */ |
522 | extern struct device *device_create(struct class *cls, struct device *parent, | 528 | extern struct device *device_create(struct class *cls, struct device *parent, |
523 | dev_t devt, const char *fmt, ...) | 529 | dev_t devt, const char *fmt, ...) |
524 | __attribute__((format(printf,4,5))); | 530 | __attribute__((format(printf, 4, 5))); |
525 | extern void device_destroy(struct class *cls, dev_t devt); | 531 | extern void device_destroy(struct class *cls, dev_t devt); |
526 | #ifdef CONFIG_PM_SLEEP | 532 | #ifdef CONFIG_PM_SLEEP |
527 | extern void destroy_suspended_device(struct class *cls, dev_t devt); | 533 | extern void destroy_suspended_device(struct class *cls, dev_t devt); |
@@ -538,17 +544,17 @@ static inline void destroy_suspended_device(struct class *cls, dev_t devt) | |||
538 | * know about. | 544 | * know about. |
539 | */ | 545 | */ |
540 | /* Notify platform of device discovery */ | 546 | /* Notify platform of device discovery */ |
541 | extern int (*platform_notify)(struct device * dev); | 547 | extern int (*platform_notify)(struct device *dev); |
542 | 548 | ||
543 | extern int (*platform_notify_remove)(struct device * dev); | 549 | extern int (*platform_notify_remove)(struct device *dev); |
544 | 550 | ||
545 | 551 | ||
546 | /** | 552 | /** |
547 | * get_device - atomically increment the reference count for the device. | 553 | * get_device - atomically increment the reference count for the device. |
548 | * | 554 | * |
549 | */ | 555 | */ |
550 | extern struct device * get_device(struct device * dev); | 556 | extern struct device *get_device(struct device *dev); |
551 | extern void put_device(struct device * dev); | 557 | extern void put_device(struct device *dev); |
552 | 558 | ||
553 | 559 | ||
554 | /* drivers/base/power/shutdown.c */ | 560 | /* drivers/base/power/shutdown.c */ |
@@ -560,7 +566,8 @@ extern void sysdev_shutdown(void); | |||
560 | /* debugging and troubleshooting/diagnostic helpers. */ | 566 | /* debugging and troubleshooting/diagnostic helpers. */ |
561 | extern const char *dev_driver_string(struct device *dev); | 567 | extern const char *dev_driver_string(struct device *dev); |
562 | #define dev_printk(level, dev, format, arg...) \ | 568 | #define dev_printk(level, dev, format, arg...) \ |
563 | printk(level "%s %s: " format , dev_driver_string(dev) , (dev)->bus_id , ## arg) | 569 | printk(level "%s %s: " format , dev_driver_string(dev) , \ |
570 | (dev)->bus_id , ## arg) | ||
564 | 571 | ||
565 | #define dev_emerg(dev, format, arg...) \ | 572 | #define dev_emerg(dev, format, arg...) \ |
566 | dev_printk(KERN_EMERG , dev , format , ## arg) | 573 | dev_printk(KERN_EMERG , dev , format , ## arg) |
@@ -582,7 +589,7 @@ extern const char *dev_driver_string(struct device *dev); | |||
582 | dev_printk(KERN_DEBUG , dev , format , ## arg) | 589 | dev_printk(KERN_DEBUG , dev , format , ## arg) |
583 | #else | 590 | #else |
584 | static inline int __attribute__ ((format (printf, 2, 3))) | 591 | static inline int __attribute__ ((format (printf, 2, 3))) |
585 | dev_dbg(struct device * dev, const char * fmt, ...) | 592 | dev_dbg(struct device *dev, const char *fmt, ...) |
586 | { | 593 | { |
587 | return 0; | 594 | return 0; |
588 | } | 595 | } |
@@ -592,7 +599,7 @@ dev_dbg(struct device * dev, const char * fmt, ...) | |||
592 | #define dev_vdbg dev_dbg | 599 | #define dev_vdbg dev_dbg |
593 | #else | 600 | #else |
594 | static inline int __attribute__ ((format (printf, 2, 3))) | 601 | static inline int __attribute__ ((format (printf, 2, 3))) |
595 | dev_vdbg(struct device * dev, const char * fmt, ...) | 602 | dev_vdbg(struct device *dev, const char *fmt, ...) |
596 | { | 603 | { |
597 | return 0; | 604 | return 0; |
598 | } | 605 | } |