diff options
Diffstat (limited to 'include/linux/usb/serial.h')
-rw-r--r-- | include/linux/usb/serial.h | 36 |
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 | ||
303 | extern int usb_serial_register(struct usb_serial_driver *driver); | 303 | extern int usb_serial_register_drivers(struct usb_driver *udriver, |
304 | extern void usb_serial_deregister(struct usb_serial_driver *driver); | 304 | struct usb_serial_driver * const serial_drivers[]); |
305 | extern void usb_serial_deregister_drivers(struct usb_driver *udriver, | ||
306 | struct usb_serial_driver * const serial_drivers[]); | ||
305 | extern void usb_serial_port_softint(struct usb_serial_port *port); | 307 | extern void usb_serial_port_softint(struct usb_serial_port *port); |
306 | 308 | ||
307 | extern int usb_serial_probe(struct usb_interface *iface, | 309 | extern 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, ...) \ | ||
399 | do { \ | ||
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 | ||