diff options
author | Marek Vasut <marex@denx.de> | 2013-07-10 03:16:33 +0200 |
---|---|---|
committer | Marek Vasut <marex@denx.de> | 2013-07-29 23:01:31 +0200 |
commit | d76630386d59d203ad4594d7e91be1f2e258ab93 (patch) | |
tree | 44d3a3b8d371fe50c719feb539972e41dc472229 /drivers | |
parent | be7ed2533d4acb9bc67989c4ffddb5814202ba02 (diff) | |
download | u-boot-imx-d76630386d59d203ad4594d7e91be1f2e258ab93.zip u-boot-imx-d76630386d59d203ad4594d7e91be1f2e258ab93.tar.gz u-boot-imx-d76630386d59d203ad4594d7e91be1f2e258ab93.tar.bz2 |
usb: mv_udc: Clean up the initial variable check
Clean up the code that checks the validity of a USB gadget driver
in usb_gadget_register_driver(). Moreover, limit the speed of the
driver to either FULL or HIGH, this is more precise and once we
have xHCI support, also more correct.
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Lei Wen <leiwen@marvell.com>
Cc: Otavio Salvador <otavio@ossystems.com.br>
Cc: Stefano Babic <sbabic@denx.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/gadget/mv_udc.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/usb/gadget/mv_udc.c b/drivers/usb/gadget/mv_udc.c index 6d69d6d..bed5898 100644 --- a/drivers/usb/gadget/mv_udc.c +++ b/drivers/usb/gadget/mv_udc.c @@ -471,13 +471,12 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver) struct mv_udc *udc; int ret; - if (!driver - || driver->speed < USB_SPEED_FULL - || !driver->bind - || !driver->setup) { - DBG("bad parameter.\n"); + if (!driver) + return -EINVAL; + if (!driver->bind || !driver->setup || !driver->disconnect) + return -EINVAL; + if (driver->speed != USB_SPEED_FULL && driver->speed != USB_SPEED_HIGH) return -EINVAL; - } ret = usb_lowlevel_init(0, (void **)&controller.ctrl); if (ret) |