Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 289482
b: refs/heads/master
c: d1cddb4
h: refs/heads/master
v: v3
  • Loading branch information
Greg KH committed Feb 28, 2012
1 parent 7396734 commit 54c6245
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 18 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 03892d5fefbe7d4df68466bd4cfda86fac84ebd8
refs/heads/master: d1cddb4a8e9b09c33158acae05c48069d74fa4d0
18 changes: 1 addition & 17 deletions trunk/drivers/usb/serial/pl2303.c
Original file line number Diff line number Diff line change
Expand Up @@ -855,23 +855,7 @@ static struct usb_serial_driver * const serial_drivers[] = {
&pl2303_device, NULL
};

static int __init pl2303_init(void)
{
int retval;

retval = usb_serial_register_drivers(&pl2303_driver, serial_drivers);
if (retval == 0)
printk(KERN_INFO KBUILD_MODNAME ": " DRIVER_DESC "\n");
return retval;
}

static void __exit pl2303_exit(void)
{
usb_serial_deregister_drivers(&pl2303_driver, serial_drivers);
}

module_init(pl2303_init);
module_exit(pl2303_exit);
module_usb_serial_driver(pl2303_driver, serial_drivers);

MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE("GPL");
Expand Down
28 changes: 28 additions & 0 deletions trunk/include/linux/usb/serial.h
Original file line number Diff line number Diff line change
Expand Up @@ -406,5 +406,33 @@ do { \
} \
} while (0)

/*
* module_usb_serial_driver() - Helper macro for registering a USB Serial driver
* @__usb_driver: usb_driver struct to register
* @__serial_drivers: list of usb_serial drivers to register
*
* Helper macro for USB serial drivers which do not do anything special
* in module init/exit. This eliminates a lot of boilerplate. Each
* module may only use this macro once, and calling it replaces
* module_init() and module_exit()
*
* Note, we can't use the generic module_driver() call here, due to the
* two parameters in the usb_serial_* functions, so we roll our own here
* :(
*/
#define module_usb_serial_driver(__usb_driver, __serial_drivers) \
static int __init usb_serial_driver_init(void) \
{ \
return usb_serial_register_drivers(&(__usb_driver), \
(__serial_drivers)); \
} \
module_init(usb_serial_driver_init); \
static void __exit usb_serial_driver_exit(void) \
{ \
return usb_serial_deregister_drivers(&(__usb_driver), \
(__serial_drivers)); \
} \
module_exit(usb_serial_driver_exit);

#endif /* __LINUX_USB_SERIAL_H */

0 comments on commit 54c6245

Please sign in to comment.