Commit 7ec3ea18 authored by Tobias Klauser's avatar Tobias Klauser Committed by Felipe Balbi

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: default avatarTobias Klauser <tklauser@distanz.ch>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent f0175ab5
...@@ -386,6 +386,21 @@ struct usb_composite_driver { ...@@ -386,6 +386,21 @@ struct usb_composite_driver {
extern int usb_composite_probe(struct usb_composite_driver *driver); extern int usb_composite_probe(struct usb_composite_driver *driver);
extern void usb_composite_unregister(struct usb_composite_driver *driver); extern void usb_composite_unregister(struct usb_composite_driver *driver);
/**
* module_usb_composite_driver() - Helper macro for registering a USB gadget
* composite driver
* @__usb_composite_driver: usb_composite_driver struct
*
* Helper macro for USB gadget composite 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()
*/
#define module_usb_composite_driver(__usb_composite_driver) \
module_driver(__usb_composite_driver, usb_composite_probe, \
usb_composite_unregister)
extern void usb_composite_setup_continue(struct usb_composite_dev *cdev); extern void usb_composite_setup_continue(struct usb_composite_dev *cdev);
extern int composite_dev_prepare(struct usb_composite_driver *composite, extern int composite_dev_prepare(struct usb_composite_driver *composite,
struct usb_composite_dev *cdev); struct usb_composite_dev *cdev);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment