mirror of
https://github.com/nxp-imx/linux-imx.git
synced 2026-06-25 11:43:20 +02:00
USB: serial: mos7720: fix parallel probe
commitfde1faf872upstream. A static usb-serial-driver structure that is used to initialise the interrupt URB was modified during probe depending on the currently probed device type, something which could break a parallel probe of a device of a different type. Fix this up by overriding the default completion callback for MCS7715 devices in attach() instead. We may want to use two usb-serial driver instances for the two types later. Fixes:fb088e335d("USB: serial: add support for serial port on the moschip 7715") Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
This commit is contained in:
parent
f14ea824e4
commit
52eebd5e64
|
|
@ -73,8 +73,6 @@ struct moschip_port {
|
|||
|
||||
static int debug;
|
||||
|
||||
static struct usb_serial_driver moschip7720_2port_driver;
|
||||
|
||||
#define USB_VENDOR_ID_MOSCHIP 0x9710
|
||||
#define MOSCHIP_DEVICE_ID_7720 0x7720
|
||||
#define MOSCHIP_DEVICE_ID_7715 0x7715
|
||||
|
|
@ -1001,25 +999,6 @@ static void mos7720_bulk_out_data_callback(struct urb *urb)
|
|||
tty_kref_put(tty);
|
||||
}
|
||||
|
||||
/*
|
||||
* mos77xx_probe
|
||||
* this function installs the appropriate read interrupt endpoint callback
|
||||
* depending on whether the device is a 7720 or 7715, thus avoiding costly
|
||||
* run-time checks in the high-frequency callback routine itself.
|
||||
*/
|
||||
static int mos77xx_probe(struct usb_serial *serial,
|
||||
const struct usb_device_id *id)
|
||||
{
|
||||
if (id->idProduct == MOSCHIP_DEVICE_ID_7715)
|
||||
moschip7720_2port_driver.read_int_callback =
|
||||
mos7715_interrupt_callback;
|
||||
else
|
||||
moschip7720_2port_driver.read_int_callback =
|
||||
mos7720_interrupt_callback;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mos77xx_calc_num_ports(struct usb_serial *serial)
|
||||
{
|
||||
u16 product = le16_to_cpu(serial->dev->descriptor.idProduct);
|
||||
|
|
@ -2108,6 +2087,12 @@ static int mos7720_startup(struct usb_serial *serial)
|
|||
tmp->interrupt_in_endpointAddress;
|
||||
serial->port[1]->interrupt_in_urb = NULL;
|
||||
serial->port[1]->interrupt_in_buffer = NULL;
|
||||
|
||||
if (serial->port[0]->interrupt_in_urb) {
|
||||
struct urb *urb = serial->port[0]->interrupt_in_urb;
|
||||
|
||||
urb->complete = mos7715_interrupt_callback;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -2228,7 +2213,6 @@ static struct usb_serial_driver moschip7720_2port_driver = {
|
|||
.close = mos7720_close,
|
||||
.throttle = mos7720_throttle,
|
||||
.unthrottle = mos7720_unthrottle,
|
||||
.probe = mos77xx_probe,
|
||||
.attach = mos7720_startup,
|
||||
.release = mos7720_release,
|
||||
.ioctl = mos7720_ioctl,
|
||||
|
|
@ -2241,7 +2225,7 @@ static struct usb_serial_driver moschip7720_2port_driver = {
|
|||
.chars_in_buffer = mos7720_chars_in_buffer,
|
||||
.break_ctl = mos7720_break,
|
||||
.read_bulk_callback = mos7720_bulk_in_callback,
|
||||
.read_int_callback = NULL /* dynamically assigned in probe() */
|
||||
.read_int_callback = mos7720_interrupt_callback,
|
||||
};
|
||||
|
||||
static int __init moschip7720_init(void)
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user