diff options
| author | Tobias Klauser <tklauser@distanz.ch> | 2014-07-09 12:09:55 -0400 |
|---|---|---|
| committer | Felipe Balbi <balbi@ti.com> | 2014-07-10 09:36:52 -0400 |
| commit | 7ec3ea181d8cffb669982d79664f119ef6a71fc3 (patch) | |
| tree | 1b21a6414f8be7bdc97d7a63ec2a6858942a2c05 /include/linux/usb | |
| parent | f0175ab51993d2dc2728e7b22a16ffb0c8f4cfa0 (diff) | |
usb: gadget: Add helper macro for usb_composite_driver boilerplate
Introduce the module_usb_composite_driver macro as a convenience macro
for USB gadget composite driver modules, similar to module_usb_driver.
It is intended to be used by drivers which init/exit section does
nothing but calling usb_composite_probe/usb_composite_unrregister. By
using this macro it is possible to eliminate a few lines of boilerplate
code per USB gadget composite driver.
Based on f3a6a4b6 ("USB: Add helper macro for usb_driver boilerplate")
which introduced the according macro for USB drivers.
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'include/linux/usb')
| -rw-r--r-- | include/linux/usb/composite.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h index 7373203140e7..c330f5ef42cf 100644 --- a/include/linux/usb/composite.h +++ b/include/linux/usb/composite.h | |||
| @@ -386,6 +386,21 @@ struct usb_composite_driver { | |||
| 386 | 386 | ||
| 387 | extern int usb_composite_probe(struct usb_composite_driver *driver); | 387 | extern int usb_composite_probe(struct usb_composite_driver *driver); |
| 388 | extern void usb_composite_unregister(struct usb_composite_driver *driver); | 388 | extern void usb_composite_unregister(struct usb_composite_driver *driver); |
| 389 | |||
| 390 | /** | ||
| 391 | * module_usb_composite_driver() - Helper macro for registering a USB gadget | ||
| 392 | * composite driver | ||
| 393 | * @__usb_composite_driver: usb_composite_driver struct | ||
| 394 | * | ||
| 395 | * Helper macro for USB gadget composite drivers which do not do anything | ||
| 396 | * special in module init/exit. This eliminates a lot of boilerplate. Each | ||
| 397 | * module may only use this macro once, and calling it replaces module_init() | ||
| 398 | * and module_exit() | ||
| 399 | */ | ||
| 400 | #define module_usb_composite_driver(__usb_composite_driver) \ | ||
| 401 | module_driver(__usb_composite_driver, usb_composite_probe, \ | ||
| 402 | usb_composite_unregister) | ||
| 403 | |||
| 389 | extern void usb_composite_setup_continue(struct usb_composite_dev *cdev); | 404 | extern void usb_composite_setup_continue(struct usb_composite_dev *cdev); |
| 390 | extern int composite_dev_prepare(struct usb_composite_driver *composite, | 405 | extern int composite_dev_prepare(struct usb_composite_driver *composite, |
| 391 | struct usb_composite_dev *cdev); | 406 | struct usb_composite_dev *cdev); |
