usb: gadget: udc-core: allow udc class register gadget device

Currently all UDC drivers are calling
device_register() before calling
usb_add_gadget_udc(). In order to avoid
code duplication, we can allow udc-core.c
register that device.

However that would become a really large patch,
so to cope with the meanwhile and allow us
to write bite-sized patches, we're adding
a flag which will be set by UDC driver once
it removes the code for registering the
gadget device.

Once all are converted, the new flag will
be removed.

Reviewed-by: Tomasz Figa <tomasz.figa@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
This commit is contained in:
Felipe Balbi 2013-01-24 14:52:24 +02:00
parent 7eaf8f2a7d
commit f07bd56bbd
2 changed files with 23 additions and 4 deletions

View file

@ -494,6 +494,9 @@ struct usb_gadget_ops {
* only supports HNP on a different root port.
* @b_hnp_enable: OTG device feature flag, indicating that the A-Host
* enabled HNP support.
* @register_my_device: Flag telling udc-core that UDC driver didn't
* register the gadget device to the driver model. Temporary until
* all UDC drivers are fixed up properly.
* @name: Identifies the controller hardware type. Used in diagnostics
* and sometimes configuration.
* @dev: Driver model state for this abstract device.
@ -531,6 +534,7 @@ struct usb_gadget {
unsigned b_hnp_enable:1;
unsigned a_hnp_support:1;
unsigned a_alt_hnp_support:1;
unsigned register_my_device:1;
const char *name;
struct device dev;
unsigned out_epnum;