device.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645
  1. /*
  2. * device.h - generic, centralized driver model
  3. *
  4. * Copyright (c) 2001-2003 Patrick Mochel <mochel@osdl.org>
  5. * Copyright (c) 2004-2009 Greg Kroah-Hartman <gregkh@suse.de>
  6. * Copyright (c) 2008-2009 Novell Inc.
  7. *
  8. * This file is released under the GPLv2
  9. *
  10. * See Documentation/driver-model/ for more information.
  11. */
  12. #ifndef _DEVICE_H_
  13. #define _DEVICE_H_
  14. #include <linux/ioport.h>
  15. #include <linux/kobject.h>
  16. #include <linux/klist.h>
  17. #include <linux/list.h>
  18. #include <linux/lockdep.h>
  19. #include <linux/compiler.h>
  20. #include <linux/types.h>
  21. #include <linux/module.h>
  22. #include <linux/pm.h>
  23. #include <linux/semaphore.h>
  24. #include <asm/atomic.h>
  25. #include <asm/device.h>
  26. struct device;
  27. struct device_private;
  28. struct device_driver;
  29. struct driver_private;
  30. struct class;
  31. struct class_private;
  32. struct bus_type;
  33. struct bus_type_private;
  34. struct bus_attribute {
  35. struct attribute attr;
  36. ssize_t (*show)(struct bus_type *bus, char *buf);
  37. ssize_t (*store)(struct bus_type *bus, const char *buf, size_t count);
  38. };
  39. #define BUS_ATTR(_name, _mode, _show, _store) \
  40. struct bus_attribute bus_attr_##_name = __ATTR(_name, _mode, _show, _store)
  41. extern int __must_check bus_create_file(struct bus_type *,
  42. struct bus_attribute *);
  43. extern void bus_remove_file(struct bus_type *, struct bus_attribute *);
  44. struct bus_type {
  45. const char *name;
  46. struct bus_attribute *bus_attrs;
  47. struct device_attribute *dev_attrs;
  48. struct driver_attribute *drv_attrs;
  49. int (*match)(struct device *dev, struct device_driver *drv);
  50. int (*uevent)(struct device *dev, struct kobj_uevent_env *env);
  51. int (*probe)(struct device *dev);
  52. int (*remove)(struct device *dev);
  53. void (*shutdown)(struct device *dev);
  54. int (*suspend)(struct device *dev, pm_message_t state);
  55. int (*resume)(struct device *dev);
  56. const struct dev_pm_ops *pm;
  57. struct bus_type_private *p;
  58. };
  59. extern int __must_check bus_register(struct bus_type *bus);
  60. extern void bus_unregister(struct bus_type *bus);
  61. extern int __must_check bus_rescan_devices(struct bus_type *bus);
  62. /* iterator helpers for buses */
  63. int bus_for_each_dev(struct bus_type *bus, struct device *start, void *data,
  64. int (*fn)(struct device *dev, void *data));
  65. struct device *bus_find_device(struct bus_type *bus, struct device *start,
  66. void *data,
  67. int (*match)(struct device *dev, void *data));
  68. struct device *bus_find_device_by_name(struct bus_type *bus,
  69. struct device *start,
  70. const char *name);
  71. int __must_check bus_for_each_drv(struct bus_type *bus,
  72. struct device_driver *start, void *data,
  73. int (*fn)(struct device_driver *, void *));
  74. void bus_sort_breadthfirst(struct bus_type *bus,
  75. int (*compare)(const struct device *a,
  76. const struct device *b));
  77. /*
  78. * Bus notifiers: Get notified of addition/removal of devices
  79. * and binding/unbinding of drivers to devices.
  80. * In the long run, it should be a replacement for the platform
  81. * notify hooks.
  82. */
  83. struct notifier_block;
  84. extern int bus_register_notifier(struct bus_type *bus,
  85. struct notifier_block *nb);
  86. extern int bus_unregister_notifier(struct bus_type *bus,
  87. struct notifier_block *nb);
  88. /* All 4 notifers below get called with the target struct device *
  89. * as an argument. Note that those functions are likely to be called
  90. * with the device semaphore held in the core, so be careful.
  91. */
  92. #define BUS_NOTIFY_ADD_DEVICE 0x00000001 /* device added */
  93. #define BUS_NOTIFY_DEL_DEVICE 0x00000002 /* device removed */
  94. #define BUS_NOTIFY_BOUND_DRIVER 0x00000003 /* driver bound to device */
  95. #define BUS_NOTIFY_UNBIND_DRIVER 0x00000004 /* driver about to be
  96. unbound */
  97. #define BUS_NOTIFY_UNBOUND_DRIVER 0x00000005 /* driver is unbound
  98. from the device */
  99. extern struct kset *bus_get_kset(struct bus_type *bus);
  100. extern struct klist *bus_get_device_klist(struct bus_type *bus);
  101. struct device_driver {
  102. const char *name;
  103. struct bus_type *bus;
  104. struct module *owner;
  105. const char *mod_name; /* used for built-in modules */
  106. bool suppress_bind_attrs; /* disables bind/unbind via sysfs */
  107. int (*probe) (struct device *dev);
  108. int (*remove) (struct device *dev);
  109. void (*shutdown) (struct device *dev);
  110. int (*suspend) (struct device *dev, pm_message_t state);
  111. int (*resume) (struct device *dev);
  112. const struct attribute_group **groups;
  113. const struct dev_pm_ops *pm;
  114. struct driver_private *p;
  115. };
  116. extern int __must_check driver_register(struct device_driver *drv);
  117. extern void driver_unregister(struct device_driver *drv);
  118. extern struct device_driver *get_driver(struct device_driver *drv);
  119. extern void put_driver(struct device_driver *drv);
  120. extern struct device_driver *driver_find(const char *name,
  121. struct bus_type *bus);
  122. extern int driver_probe_done(void);
  123. extern void wait_for_device_probe(void);
  124. /* sysfs interface for exporting driver attributes */
  125. struct driver_attribute {
  126. struct attribute attr;
  127. ssize_t (*show)(struct device_driver *driver, char *buf);
  128. ssize_t (*store)(struct device_driver *driver, const char *buf,
  129. size_t count);
  130. };
  131. #define DRIVER_ATTR(_name, _mode, _show, _store) \
  132. struct driver_attribute driver_attr_##_name = \
  133. __ATTR(_name, _mode, _show, _store)
  134. extern int __must_check driver_create_file(struct device_driver *driver,
  135. const struct driver_attribute *attr);
  136. extern void driver_remove_file(struct device_driver *driver,
  137. const struct driver_attribute *attr);
  138. extern int __must_check driver_add_kobj(struct device_driver *drv,
  139. struct kobject *kobj,
  140. const char *fmt, ...);
  141. extern int __must_check driver_for_each_device(struct device_driver *drv,
  142. struct device *start,
  143. void *data,
  144. int (*fn)(struct device *dev,
  145. void *));
  146. struct device *driver_find_device(struct device_driver *drv,
  147. struct device *start, void *data,
  148. int (*match)(struct device *dev, void *data));
  149. /*
  150. * device classes
  151. */
  152. struct class {
  153. const char *name;
  154. struct module *owner;
  155. struct class_attribute *class_attrs;
  156. struct device_attribute *dev_attrs;
  157. struct kobject *dev_kobj;
  158. int (*dev_uevent)(struct device *dev, struct kobj_uevent_env *env);
  159. char *(*devnode)(struct device *dev, mode_t *mode);
  160. void (*class_release)(struct class *class);
  161. void (*dev_release)(struct device *dev);
  162. int (*suspend)(struct device *dev, pm_message_t state);
  163. int (*resume)(struct device *dev);
  164. const struct dev_pm_ops *pm;
  165. struct class_private *p;
  166. };
  167. struct class_dev_iter {
  168. struct klist_iter ki;
  169. const struct device_type *type;
  170. };
  171. extern struct kobject *sysfs_dev_block_kobj;
  172. extern struct kobject *sysfs_dev_char_kobj;
  173. extern int __must_check __class_register(struct class *class,
  174. struct lock_class_key *key);
  175. extern void class_unregister(struct class *class);
  176. /* This is a #define to keep the compiler from merging different
  177. * instances of the __key variable */
  178. #define class_register(class) \
  179. ({ \
  180. static struct lock_class_key __key; \
  181. __class_register(class, &__key); \
  182. })
  183. struct class_compat;
  184. struct class_compat *class_compat_register(const char *name);
  185. void class_compat_unregister(struct class_compat *cls);
  186. int class_compat_create_link(struct class_compat *cls, struct device *dev,
  187. struct device *device_link);
  188. void class_compat_remove_link(struct class_compat *cls, struct device *dev,
  189. struct device *device_link);
  190. extern void class_dev_iter_init(struct class_dev_iter *iter,
  191. struct class *class,
  192. struct device *start,
  193. const struct device_type *type);
  194. extern struct device *class_dev_iter_next(struct class_dev_iter *iter);
  195. extern void class_dev_iter_exit(struct class_dev_iter *iter);
  196. extern int class_for_each_device(struct class *class, struct device *start,
  197. void *data,
  198. int (*fn)(struct device *dev, void *data));
  199. extern struct device *class_find_device(struct class *class,
  200. struct device *start, void *data,
  201. int (*match)(struct device *, void *));
  202. struct class_attribute {
  203. struct attribute attr;
  204. ssize_t (*show)(struct class *class, char *buf);
  205. ssize_t (*store)(struct class *class, const char *buf, size_t count);
  206. };
  207. #define CLASS_ATTR(_name, _mode, _show, _store) \
  208. struct class_attribute class_attr_##_name = __ATTR(_name, _mode, _show, _store)
  209. extern int __must_check class_create_file(struct class *class,
  210. const struct class_attribute *attr);
  211. extern void class_remove_file(struct class *class,
  212. const struct class_attribute *attr);
  213. struct class_interface {
  214. struct list_head node;
  215. struct class *class;
  216. int (*add_dev) (struct device *, struct class_interface *);
  217. void (*remove_dev) (struct device *, struct class_interface *);
  218. };
  219. extern int __must_check class_interface_register(struct class_interface *);
  220. extern void class_interface_unregister(struct class_interface *);
  221. extern struct class * __must_check __class_create(struct module *owner,
  222. const char *name,
  223. struct lock_class_key *key);
  224. extern void class_destroy(struct class *cls);
  225. /* This is a #define to keep the compiler from merging different
  226. * instances of the __key variable */
  227. #define class_create(owner, name) \
  228. ({ \
  229. static struct lock_class_key __key; \
  230. __class_create(owner, name, &__key); \
  231. })
  232. /*
  233. * The type of device, "struct device" is embedded in. A class
  234. * or bus can contain devices of different types
  235. * like "partitions" and "disks", "mouse" and "event".
  236. * This identifies the device type and carries type-specific
  237. * information, equivalent to the kobj_type of a kobject.
  238. * If "name" is specified, the uevent will contain it in
  239. * the DEVTYPE variable.
  240. */
  241. struct device_type {
  242. const char *name;
  243. const struct attribute_group **groups;
  244. int (*uevent)(struct device *dev, struct kobj_uevent_env *env);
  245. char *(*devnode)(struct device *dev, mode_t *mode);
  246. void (*release)(struct device *dev);
  247. const struct dev_pm_ops *pm;
  248. };
  249. /* interface for exporting device attributes */
  250. struct device_attribute {
  251. struct attribute attr;
  252. ssize_t (*show)(struct device *dev, struct device_attribute *attr,
  253. char *buf);
  254. ssize_t (*store)(struct device *dev, struct device_attribute *attr,
  255. const char *buf, size_t count);
  256. };
  257. #define DEVICE_ATTR(_name, _mode, _show, _store) \
  258. struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
  259. extern int __must_check device_create_file(struct device *device,
  260. const struct device_attribute *entry);
  261. extern void device_remove_file(struct device *dev,
  262. const struct device_attribute *attr);
  263. extern int __must_check device_create_bin_file(struct device *dev,
  264. const struct bin_attribute *attr);
  265. extern void device_remove_bin_file(struct device *dev,
  266. const struct bin_attribute *attr);
  267. extern int device_schedule_callback_owner(struct device *dev,
  268. void (*func)(struct device *dev), struct module *owner);
  269. /* This is a macro to avoid include problems with THIS_MODULE */
  270. #define device_schedule_callback(dev, func) \
  271. device_schedule_callback_owner(dev, func, THIS_MODULE)
  272. /* device resource management */
  273. typedef void (*dr_release_t)(struct device *dev, void *res);
  274. typedef int (*dr_match_t)(struct device *dev, void *res, void *match_data);
  275. #ifdef CONFIG_DEBUG_DEVRES
  276. extern void *__devres_alloc(dr_release_t release, size_t size, gfp_t gfp,
  277. const char *name);
  278. #define devres_alloc(release, size, gfp) \
  279. __devres_alloc(release, size, gfp, #release)
  280. #else
  281. extern void *devres_alloc(dr_release_t release, size_t size, gfp_t gfp);
  282. #endif
  283. extern void devres_free(void *res);
  284. extern void devres_add(struct device *dev, void *res);
  285. extern void *devres_find(struct device *dev, dr_release_t release,
  286. dr_match_t match, void *match_data);
  287. extern void *devres_get(struct device *dev, void *new_res,
  288. dr_match_t match, void *match_data);
  289. extern void *devres_remove(struct device *dev, dr_release_t release,
  290. dr_match_t match, void *match_data);
  291. extern int devres_destroy(struct device *dev, dr_release_t release,
  292. dr_match_t match, void *match_data);
  293. /* devres group */
  294. extern void * __must_check devres_open_group(struct device *dev, void *id,
  295. gfp_t gfp);
  296. extern void devres_close_group(struct device *dev, void *id);
  297. extern void devres_remove_group(struct device *dev, void *id);
  298. extern int devres_release_group(struct device *dev, void *id);
  299. /* managed kzalloc/kfree for device drivers, no kmalloc, always use kzalloc */
  300. extern void *devm_kzalloc(struct device *dev, size_t size, gfp_t gfp);
  301. extern void devm_kfree(struct device *dev, void *p);
  302. struct device_dma_parameters {
  303. /*
  304. * a low level driver may set these to teach IOMMU code about
  305. * sg limitations.
  306. */
  307. unsigned int max_segment_size;
  308. unsigned long segment_boundary_mask;
  309. };
  310. struct device {
  311. struct device *parent;
  312. struct device_private *p;
  313. struct kobject kobj;
  314. const char *init_name; /* initial name of the device */
  315. struct device_type *type;
  316. struct semaphore sem; /* semaphore to synchronize calls to
  317. * its driver.
  318. */
  319. struct bus_type *bus; /* type of bus device is on */
  320. struct device_driver *driver; /* which driver has allocated this
  321. device */
  322. void *platform_data; /* Platform specific data, device
  323. core doesn't touch it */
  324. struct dev_pm_info power;
  325. #ifdef CONFIG_NUMA
  326. int numa_node; /* NUMA node this device is close to */
  327. #endif
  328. u64 *dma_mask; /* dma mask (if dma'able device) */
  329. u64 coherent_dma_mask;/* Like dma_mask, but for
  330. alloc_coherent mappings as
  331. not all hardware supports
  332. 64 bit addresses for consistent
  333. allocations such descriptors. */
  334. struct device_dma_parameters *dma_parms;
  335. struct list_head dma_pools; /* dma pools (if dma'ble) */
  336. struct dma_coherent_mem *dma_mem; /* internal for coherent mem
  337. override */
  338. /* arch specific additions */
  339. struct dev_archdata archdata;
  340. dev_t devt; /* dev_t, creates the sysfs "dev" */
  341. spinlock_t devres_lock;
  342. struct list_head devres_head;
  343. struct klist_node knode_class;
  344. struct class *class;
  345. const struct attribute_group **groups; /* optional groups */
  346. void (*release)(struct device *dev);
  347. };
  348. /* Get the wakeup routines, which depend on struct device */
  349. #include <linux/pm_wakeup.h>
  350. static inline const char *dev_name(const struct device *dev)
  351. {
  352. return kobject_name(&dev->kobj);
  353. }
  354. extern int dev_set_name(struct device *dev, const char *name, ...)
  355. __attribute__((format(printf, 2, 3)));
  356. #ifdef CONFIG_NUMA
  357. static inline int dev_to_node(struct device *dev)
  358. {
  359. return dev->numa_node;
  360. }
  361. static inline void set_dev_node(struct device *dev, int node)
  362. {
  363. dev->numa_node = node;
  364. }
  365. #else
  366. static inline int dev_to_node(struct device *dev)
  367. {
  368. return -1;
  369. }
  370. static inline void set_dev_node(struct device *dev, int node)
  371. {
  372. }
  373. #endif
  374. static inline unsigned int dev_get_uevent_suppress(const struct device *dev)
  375. {
  376. return dev->kobj.uevent_suppress;
  377. }
  378. static inline void dev_set_uevent_suppress(struct device *dev, int val)
  379. {
  380. dev->kobj.uevent_suppress = val;
  381. }
  382. static inline int device_is_registered(struct device *dev)
  383. {
  384. return dev->kobj.state_in_sysfs;
  385. }
  386. static inline void device_enable_async_suspend(struct device *dev)
  387. {
  388. if (dev->power.status == DPM_ON)
  389. dev->power.async_suspend = true;
  390. }
  391. static inline void device_disable_async_suspend(struct device *dev)
  392. {
  393. if (dev->power.status == DPM_ON)
  394. dev->power.async_suspend = false;
  395. }
  396. static inline bool device_async_suspend_enabled(struct device *dev)
  397. {
  398. return !!dev->power.async_suspend;
  399. }
  400. void driver_init(void);
  401. /*
  402. * High level routines for use by the bus drivers
  403. */
  404. extern int __must_check device_register(struct device *dev);
  405. extern void device_unregister(struct device *dev);
  406. extern void device_initialize(struct device *dev);
  407. extern int __must_check device_add(struct device *dev);
  408. extern void device_del(struct device *dev);
  409. extern int device_for_each_child(struct device *dev, void *data,
  410. int (*fn)(struct device *dev, void *data));
  411. extern struct device *device_find_child(struct device *dev, void *data,
  412. int (*match)(struct device *dev, void *data));
  413. extern int device_rename(struct device *dev, char *new_name);
  414. extern int device_move(struct device *dev, struct device *new_parent,
  415. enum dpm_order dpm_order);
  416. extern const char *device_get_devnode(struct device *dev,
  417. mode_t *mode, const char **tmp);
  418. extern void *dev_get_drvdata(const struct device *dev);
  419. extern void dev_set_drvdata(struct device *dev, void *data);
  420. /*
  421. * Root device objects for grouping under /sys/devices
  422. */
  423. extern struct device *__root_device_register(const char *name,
  424. struct module *owner);
  425. static inline struct device *root_device_register(const char *name)
  426. {
  427. return __root_device_register(name, THIS_MODULE);
  428. }
  429. extern void root_device_unregister(struct device *root);
  430. static inline void *dev_get_platdata(const struct device *dev)
  431. {
  432. return dev->platform_data;
  433. }
  434. /*
  435. * Manual binding of a device to driver. See drivers/base/bus.c
  436. * for information on use.
  437. */
  438. extern int __must_check device_bind_driver(struct device *dev);
  439. extern void device_release_driver(struct device *dev);
  440. extern int __must_check device_attach(struct device *dev);
  441. extern int __must_check driver_attach(struct device_driver *drv);
  442. extern int __must_check device_reprobe(struct device *dev);
  443. /*
  444. * Easy functions for dynamically creating devices on the fly
  445. */
  446. extern struct device *device_create_vargs(struct class *cls,
  447. struct device *parent,
  448. dev_t devt,
  449. void *drvdata,
  450. const char *fmt,
  451. va_list vargs);
  452. extern struct device *device_create(struct class *cls, struct device *parent,
  453. dev_t devt, void *drvdata,
  454. const char *fmt, ...)
  455. __attribute__((format(printf, 5, 6)));
  456. extern void device_destroy(struct class *cls, dev_t devt);
  457. /*
  458. * Platform "fixup" functions - allow the platform to have their say
  459. * about devices and actions that the general device layer doesn't
  460. * know about.
  461. */
  462. /* Notify platform of device discovery */
  463. extern int (*platform_notify)(struct device *dev);
  464. extern int (*platform_notify_remove)(struct device *dev);
  465. /**
  466. * get_device - atomically increment the reference count for the device.
  467. *
  468. */
  469. extern struct device *get_device(struct device *dev);
  470. extern void put_device(struct device *dev);
  471. extern void wait_for_device_probe(void);
  472. #ifdef CONFIG_DEVTMPFS
  473. extern int devtmpfs_create_node(struct device *dev);
  474. extern int devtmpfs_delete_node(struct device *dev);
  475. extern int devtmpfs_mount(const char *mntdir);
  476. #else
  477. static inline int devtmpfs_create_node(struct device *dev) { return 0; }
  478. static inline int devtmpfs_delete_node(struct device *dev) { return 0; }
  479. static inline int devtmpfs_mount(const char *mountpoint) { return 0; }
  480. #endif
  481. /* drivers/base/power/shutdown.c */
  482. extern void device_shutdown(void);
  483. /* drivers/base/sys.c */
  484. extern void sysdev_shutdown(void);
  485. /* debugging and troubleshooting/diagnostic helpers. */
  486. extern const char *dev_driver_string(const struct device *dev);
  487. #define dev_printk(level, dev, format, arg...) \
  488. printk(level "%s %s: " format , dev_driver_string(dev) , \
  489. dev_name(dev) , ## arg)
  490. #define dev_emerg(dev, format, arg...) \
  491. dev_printk(KERN_EMERG , dev , format , ## arg)
  492. #define dev_alert(dev, format, arg...) \
  493. dev_printk(KERN_ALERT , dev , format , ## arg)
  494. #define dev_crit(dev, format, arg...) \
  495. dev_printk(KERN_CRIT , dev , format , ## arg)
  496. #define dev_err(dev, format, arg...) \
  497. dev_printk(KERN_ERR , dev , format , ## arg)
  498. #define dev_warn(dev, format, arg...) \
  499. dev_printk(KERN_WARNING , dev , format , ## arg)
  500. #define dev_notice(dev, format, arg...) \
  501. dev_printk(KERN_NOTICE , dev , format , ## arg)
  502. #define dev_info(dev, format, arg...) \
  503. dev_printk(KERN_INFO , dev , format , ## arg)
  504. #if defined(DEBUG)
  505. #define dev_dbg(dev, format, arg...) \
  506. dev_printk(KERN_DEBUG , dev , format , ## arg)
  507. #elif defined(CONFIG_DYNAMIC_DEBUG)
  508. #define dev_dbg(dev, format, ...) do { \
  509. dynamic_dev_dbg(dev, format, ##__VA_ARGS__); \
  510. } while (0)
  511. #else
  512. #define dev_dbg(dev, format, arg...) \
  513. ({ if (0) dev_printk(KERN_DEBUG, dev, format, ##arg); 0; })
  514. #endif
  515. #ifdef VERBOSE_DEBUG
  516. #define dev_vdbg dev_dbg
  517. #else
  518. #define dev_vdbg(dev, format, arg...) \
  519. ({ if (0) dev_printk(KERN_DEBUG, dev, format, ##arg); 0; })
  520. #endif
  521. /*
  522. * dev_WARN() acts like dev_printk(), but with the key difference
  523. * of using a WARN/WARN_ON to get the message out, including the
  524. * file/line information and a backtrace.
  525. */
  526. #define dev_WARN(dev, format, arg...) \
  527. WARN(1, "Device: %s\n" format, dev_driver_string(dev), ## arg);
  528. /* Create alias, so I can be autoloaded. */
  529. #define MODULE_ALIAS_CHARDEV(major,minor) \
  530. MODULE_ALIAS("char-major-" __stringify(major) "-" __stringify(minor))
  531. #define MODULE_ALIAS_CHARDEV_MAJOR(major) \
  532. MODULE_ALIAS("char-major-" __stringify(major) "-*")
  533. #endif /* _DEVICE_H_ */