mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-13 23:34:05 +08:00
usb: gadget: dbgp: Fix endpoint config after USB disconnect
SET_FEATURE request with DEBUG_MODE only worked the first time after module initialisation. Per the USB 2.0 debug device specification, said request is to be treated as if it were a SET_CONFIGURATION request, i.e. endpoint must be re-configured. As configure_endpoints() may now get called multiple times, move it outside __init and move serial_alloc_tty() call into __init. Code has assumption that endpoint mapping remains unchanged with consecutive calls of configure_endpoints(). Signed-off-by: Kyösti Mälkki <kyosti.malkki@gmail.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
This commit is contained in:
parent
8b9ca2767b
commit
6876d58f2f
@ -237,7 +237,7 @@ static void dbgp_unbind(struct usb_gadget *gadget)
|
|||||||
static unsigned char tty_line;
|
static unsigned char tty_line;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int __init dbgp_configure_endpoints(struct usb_gadget *gadget)
|
static int dbgp_configure_endpoints(struct usb_gadget *gadget)
|
||||||
{
|
{
|
||||||
int stp;
|
int stp;
|
||||||
|
|
||||||
@ -273,19 +273,10 @@ static int __init dbgp_configure_endpoints(struct usb_gadget *gadget)
|
|||||||
|
|
||||||
dbgp.serial->in->desc = &i_desc;
|
dbgp.serial->in->desc = &i_desc;
|
||||||
dbgp.serial->out->desc = &o_desc;
|
dbgp.serial->out->desc = &o_desc;
|
||||||
|
|
||||||
if (gserial_alloc_line(&tty_line)) {
|
|
||||||
stp = 3;
|
|
||||||
goto fail_3;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
fail_3:
|
|
||||||
dbgp.o_ep->driver_data = NULL;
|
|
||||||
#else
|
|
||||||
return 0;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
|
||||||
fail_2:
|
fail_2:
|
||||||
dbgp.i_ep->driver_data = NULL;
|
dbgp.i_ep->driver_data = NULL;
|
||||||
fail_1:
|
fail_1:
|
||||||
@ -324,10 +315,17 @@ static int __init dbgp_bind(struct usb_gadget *gadget,
|
|||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (gserial_alloc_line(&tty_line)) {
|
||||||
|
stp = 4;
|
||||||
|
err = -ENODEV;
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
err = dbgp_configure_endpoints(gadget);
|
err = dbgp_configure_endpoints(gadget);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
stp = 4;
|
stp = 5;
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -383,6 +381,10 @@ static int dbgp_setup(struct usb_gadget *gadget,
|
|||||||
#ifdef CONFIG_USB_G_DBGP_PRINTK
|
#ifdef CONFIG_USB_G_DBGP_PRINTK
|
||||||
err = dbgp_enable_ep();
|
err = dbgp_enable_ep();
|
||||||
#else
|
#else
|
||||||
|
err = dbgp_configure_endpoints(gadget);
|
||||||
|
if (err < 0) {
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
err = gserial_connect(dbgp.serial, tty_line);
|
err = gserial_connect(dbgp.serial, tty_line);
|
||||||
#endif
|
#endif
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user