aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/device.h
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2008-01-25 00:04:46 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2008-01-25 00:04:46 -0500
commitd462943afee8bff610258a82dba666e8ab72c9c8 (patch)
tree9046b34170b01ca0a134be0e7ad498f97611e121 /include/linux/device.h
parent5ed2c832ed256b18d90c2462369c62fd79312e6c (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.h283
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
41struct bus_attribute { 42struct 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) \
48struct bus_attribute bus_attr_##_name = __ATTR(_name,_mode,_show,_store) 49struct bus_attribute bus_attr_##_name = __ATTR(_name, _mode, _show, _store)
49 50
50extern int __must_check bus_create_file(struct bus_type *, 51extern int __must_check bus_create_file(struct bus_type *,
51 struct bus_attribute *); 52 struct bus_attribute *);
52extern void bus_remove_file(struct bus_type *, struct bus_attribute *); 53extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
53 54
54struct bus_type { 55struct 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
74extern int __must_check bus_register(struct bus_type * bus); 75extern int __must_check bus_register(struct bus_type *bus);
75extern void bus_unregister(struct bus_type * bus); 76extern void bus_unregister(struct bus_type *bus);
76 77
77extern int __must_check bus_rescan_devices(struct bus_type * bus); 78extern int __must_check bus_rescan_devices(struct bus_type *bus);
78 79
79/* iterator helpers for buses */ 80/* iterator helpers for buses */
80 81
81int bus_for_each_dev(struct bus_type * bus, struct device * start, void * data, 82int 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));
83struct device * bus_find_device(struct bus_type *bus, struct device *start, 84struct 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
86int __must_check bus_for_each_drv(struct bus_type *bus, 88int __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
134extern int __must_check driver_register(struct device_driver * drv); 136extern int __must_check driver_register(struct device_driver *drv);
135extern void driver_unregister(struct device_driver * drv); 137extern void driver_unregister(struct device_driver *drv);
136 138
137extern struct device_driver * get_driver(struct device_driver * drv); 139extern struct device_driver *get_driver(struct device_driver *drv);
138extern void put_driver(struct device_driver * drv); 140extern void put_driver(struct device_driver *drv);
139extern struct device_driver *driver_find(const char *name, struct bus_type *bus); 141extern struct device_driver *driver_find(const char *name,
142 struct bus_type *bus);
140extern int driver_probe_done(void); 143extern int driver_probe_done(void);
141 144
142/* sysfs interface for exporting driver attributes */ 145/* sysfs interface for exporting driver attributes */
143 146
144struct driver_attribute { 147struct 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) \
151struct driver_attribute driver_attr_##_name = __ATTR(_name,_mode,_show,_store) 155struct driver_attribute driver_attr_##_name = \
156 __ATTR(_name, _mode, _show, _store)
152 157
153extern int __must_check driver_create_file(struct device_driver *, 158extern int __must_check driver_create_file(struct device_driver *driver,
154 struct driver_attribute *); 159 struct driver_attribute *attr);
155extern void driver_remove_file(struct device_driver *, struct driver_attribute *); 160extern void driver_remove_file(struct device_driver *driver,
161 struct driver_attribute *attr);
156 162
157extern int __must_check driver_add_kobj(struct device_driver *drv, 163extern 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
161extern int __must_check driver_for_each_device(struct device_driver * drv, 167extern 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,
164struct 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 *)); 172struct 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 */
171struct class { 179struct 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
196extern int __must_check class_register(struct class *); 204extern int __must_check class_register(struct class *class);
197extern void class_unregister(struct class *); 205extern void class_unregister(struct class *class);
198extern int class_for_each_device(struct class *class, void *data, 206extern 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));
200extern struct device *class_find_device(struct class *class, void *data, 208extern 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
206struct class_attribute { 214struct 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) \
213struct class_attribute class_attr_##_name = __ATTR(_name,_mode,_show,_store) 221struct class_attribute class_attr_##_name = __ATTR(_name, _mode, _show, _store)
214 222
215extern int __must_check class_create_file(struct class *, 223extern int __must_check class_create_file(struct class *class,
216 const struct class_attribute *); 224 const struct class_attribute *attr);
217extern void class_remove_file(struct class *, const struct class_attribute *); 225extern void class_remove_file(struct class *class,
226 const struct class_attribute *attr);
218 227
219struct class_device_attribute { 228struct 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) \
226struct class_device_attribute class_device_attr_##_name = \ 235struct class_device_attribute class_device_attr_##_name = \
227 __ATTR(_name,_mode,_show,_store) 236 __ATTR(_name, _mode, _show, _store)
228 237
229extern int __must_check class_device_create_file(struct class_device *, 238extern 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
272static inline void * 281static inline void *class_get_devdata(struct class_device *dev)
273class_get_devdata (struct class_device *dev)
274{ 282{
275 return dev->class_data; 283 return dev->class_data;
276} 284}
277 285
278static inline void 286static inline void class_set_devdata(struct class_device *dev, void *data)
279class_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 *);
288extern int __must_check class_device_add(struct class_device *); 295extern int __must_check class_device_add(struct class_device *);
289extern void class_device_del(struct class_device *); 296extern void class_device_del(struct class_device *);
290 297
291extern struct class_device * class_device_get(struct class_device *); 298extern struct class_device *class_device_get(struct class_device *);
292extern void class_device_put(struct class_device *); 299extern void class_device_put(struct class_device *);
293 300
294extern void class_device_remove_file(struct class_device *, 301extern void class_device_remove_file(struct class_device *,
295 const struct class_device_attribute *); 302 const struct class_device_attribute *);
296extern int __must_check class_device_create_bin_file(struct class_device *, 303extern 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)));
322extern void class_device_destroy(struct class *cls, dev_t devt); 329extern 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) \
352struct device_attribute dev_attr_##_name = __ATTR(_name,_mode,_show,_store) 359struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
353 360
354extern int __must_check device_create_file(struct device *device, 361extern int __must_check device_create_file(struct device *device,
355 struct device_attribute * entry); 362 struct device_attribute *entry);
356extern void device_remove_file(struct device * dev, struct device_attribute * attr); 363extern void device_remove_file(struct device *dev,
364 struct device_attribute *attr);
357extern int __must_check device_create_bin_file(struct device *dev, 365extern int __must_check device_create_bin_file(struct device *dev,
358 struct bin_attribute *attr); 366 struct bin_attribute *attr);
359extern void device_remove_bin_file(struct device *dev, 367extern void device_remove_bin_file(struct device *dev,
360 struct bin_attribute *attr); 368 struct bin_attribute *attr);
361extern int device_schedule_callback_owner(struct device *dev, 369extern 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);
370typedef int (*dr_match_t)(struct device *dev, void *res, void *match_data); 378typedef int (*dr_match_t)(struct device *dev, void *res, void *match_data);
371 379
372#ifdef CONFIG_DEBUG_DEVRES 380#ifdef CONFIG_DEBUG_DEVRES
373extern void * __devres_alloc(dr_release_t release, size_t size, gfp_t gfp, 381extern 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
378extern void * devres_alloc(dr_release_t release, size_t size, gfp_t gfp); 386extern void *devres_alloc(dr_release_t release, size_t size, gfp_t gfp);
379#endif 387#endif
380extern void devres_free(void *res); 388extern void devres_free(void *res);
381extern void devres_add(struct device *dev, void *res); 389extern void devres_add(struct device *dev, void *res);
382extern void * devres_find(struct device *dev, dr_release_t release, 390extern void *devres_find(struct device *dev, dr_release_t release,
383 dr_match_t match, void *match_data);
384extern 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);
386extern void * devres_remove(struct device *dev, dr_release_t release, 392extern 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);
394extern void *devres_remove(struct device *dev, dr_release_t release,
395 dr_match_t match, void *match_data);
388extern int devres_destroy(struct device *dev, dr_release_t release, 396extern 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
402struct device { 410struct 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
475static inline void * 483static inline void *dev_get_drvdata(struct device *dev)
476dev_get_drvdata (struct device *dev)
477{ 484{
478 return dev->driver_data; 485 return dev->driver_data;
479} 486}
480 487
481static inline void 488static inline void dev_set_drvdata(struct device *dev, void *data)
482dev_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 */
497extern int __must_check device_register(struct device * dev); 503extern int __must_check device_register(struct device *dev);
498extern void device_unregister(struct device * dev); 504extern void device_unregister(struct device *dev);
499extern void device_initialize(struct device * dev); 505extern void device_initialize(struct device *dev);
500extern int __must_check device_add(struct device * dev); 506extern int __must_check device_add(struct device *dev);
501extern void device_del(struct device * dev); 507extern void device_del(struct device *dev);
502extern int device_for_each_child(struct device *, void *, 508extern int device_for_each_child(struct device *dev, void *data,
503 int (*fn)(struct device *, void *)); 509 int (*fn)(struct device *dev, void *data));
504extern struct device *device_find_child(struct device *, void *data, 510extern struct device *device_find_child(struct device *dev, void *data,
505 int (*match)(struct device *, void *)); 511 int (*match)(struct device *dev, void *data));
506extern int device_rename(struct device *dev, char *new_name); 512extern int device_rename(struct device *dev, char *new_name);
507extern int device_move(struct device *dev, struct device *new_parent); 513extern 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 */
513extern int __must_check device_bind_driver(struct device *dev); 519extern int __must_check device_bind_driver(struct device *dev);
514extern void device_release_driver(struct device * dev); 520extern void device_release_driver(struct device *dev);
515extern int __must_check device_attach(struct device * dev); 521extern int __must_check device_attach(struct device *dev);
516extern int __must_check driver_attach(struct device_driver *drv); 522extern int __must_check driver_attach(struct device_driver *drv);
517extern int __must_check device_reprobe(struct device *dev); 523extern 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 */
522extern struct device *device_create(struct class *cls, struct device *parent, 528extern 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)));
525extern void device_destroy(struct class *cls, dev_t devt); 531extern void device_destroy(struct class *cls, dev_t devt);
526#ifdef CONFIG_PM_SLEEP 532#ifdef CONFIG_PM_SLEEP
527extern void destroy_suspended_device(struct class *cls, dev_t devt); 533extern 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 */
541extern int (*platform_notify)(struct device * dev); 547extern int (*platform_notify)(struct device *dev);
542 548
543extern int (*platform_notify_remove)(struct device * dev); 549extern 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 */
550extern struct device * get_device(struct device * dev); 556extern struct device *get_device(struct device *dev);
551extern void put_device(struct device * dev); 557extern 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. */
561extern const char *dev_driver_string(struct device *dev); 567extern 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
584static inline int __attribute__ ((format (printf, 2, 3))) 591static inline int __attribute__ ((format (printf, 2, 3)))
585dev_dbg(struct device * dev, const char * fmt, ...) 592dev_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
594static inline int __attribute__ ((format (printf, 2, 3))) 601static inline int __attribute__ ((format (printf, 2, 3)))
595dev_vdbg(struct device * dev, const char * fmt, ...) 602dev_vdbg(struct device *dev, const char *fmt, ...)
596{ 603{
597 return 0; 604 return 0;
598} 605}