aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/usb/serial.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/usb/serial.h')
-rw-r--r--include/linux/usb/serial.h36
1 files changed, 34 insertions, 2 deletions
diff --git a/include/linux/usb/serial.h b/include/linux/usb/serial.h
index 4267a9c717ba..fbb666b1b670 100644
--- a/include/linux/usb/serial.h
+++ b/include/linux/usb/serial.h
@@ -300,8 +300,10 @@ struct usb_serial_driver {
300#define to_usb_serial_driver(d) \ 300#define to_usb_serial_driver(d) \
301 container_of(d, struct usb_serial_driver, driver) 301 container_of(d, struct usb_serial_driver, driver)
302 302
303extern int usb_serial_register(struct usb_serial_driver *driver); 303extern int usb_serial_register_drivers(struct usb_driver *udriver,
304extern void usb_serial_deregister(struct usb_serial_driver *driver); 304 struct usb_serial_driver * const serial_drivers[]);
305extern void usb_serial_deregister_drivers(struct usb_driver *udriver,
306 struct usb_serial_driver * const serial_drivers[]);
305extern void usb_serial_port_softint(struct usb_serial_port *port); 307extern void usb_serial_port_softint(struct usb_serial_port *port);
306 308
307extern int usb_serial_probe(struct usb_interface *iface, 309extern int usb_serial_probe(struct usb_interface *iface,
@@ -389,5 +391,35 @@ do { \
389 printk(KERN_DEBUG "%s: " format "\n", __FILE__, ##arg); \ 391 printk(KERN_DEBUG "%s: " format "\n", __FILE__, ##arg); \
390} while (0) 392} while (0)
391 393
394/*
395 * Macro for reporting errors in write path to avoid inifinite loop
396 * when port is used as a console.
397 */
398#define dev_err_console(usport, fmt, ...) \
399do { \
400 static bool __print_once; \
401 struct usb_serial_port *__port = (usport); \
402 \
403 if (!__port->port.console || !__print_once) { \
404 __print_once = true; \
405 dev_err(&__port->dev, fmt, ##__VA_ARGS__); \
406 } \
407} while (0)
408
409/*
410 * module_usb_serial_driver() - Helper macro for registering a USB Serial driver
411 * @__usb_driver: usb_driver struct to register
412 * @__serial_drivers: list of usb_serial drivers to register
413 *
414 * Helper macro for USB serial drivers which do not do anything special
415 * in module init/exit. This eliminates a lot of boilerplate. Each
416 * module may only use this macro once, and calling it replaces
417 * module_init() and module_exit()
418 *
419 */
420#define module_usb_serial_driver(__usb_driver, __serial_drivers) \
421 module_driver(__usb_driver, usb_serial_register_drivers, \
422 usb_serial_deregister_drivers, __serial_drivers)
423
392#endif /* __LINUX_USB_SERIAL_H */ 424#endif /* __LINUX_USB_SERIAL_H */
393 425