diff options
author | Johan Hovold <johan@kernel.org> | 2020-09-29 12:41:16 +0200 |
---|---|---|
committer | Johan Hovold <johan@kernel.org> | 2020-10-01 09:37:16 +0200 |
commit | 75240ac439eafde7e5b94107ece32b11a334d985 (patch) | |
tree | 92e4a392cbe1f33d5e493ff1e31bbfa3e99f2761 /drivers/usb | |
parent | USB: serial: pl2303: add device-id for HP GC device (diff) | |
download | linux-75240ac439eafde7e5b94107ece32b11a334d985.tar.xz linux-75240ac439eafde7e5b94107ece32b11a334d985.zip |
USB: serial: ftdi_sio: clean up jtag quirks
Drivers should not assume that interface descriptors have been parsed in
any particular order so match on interface number instead when rejecting
JTAG interfaces.
Also use the interface struct device for notifications so that the
interface number is included.
Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/serial/ftdi_sio.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 8d89a1650dad..12a4b74ca1f4 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c @@ -2335,12 +2335,11 @@ static int ftdi_NDI_device_setup(struct usb_serial *serial) */ static int ftdi_jtag_probe(struct usb_serial *serial) { - struct usb_device *udev = serial->dev; - struct usb_interface *interface = serial->interface; + struct usb_interface *intf = serial->interface; + int ifnum = intf->cur_altsetting->desc.bInterfaceNumber; - if (interface == udev->actconfig->interface[0]) { - dev_info(&udev->dev, - "Ignoring serial port reserved for JTAG\n"); + if (ifnum == 0) { + dev_info(&intf->dev, "Ignoring interface reserved for JTAG\n"); return -ENODEV; } @@ -2372,12 +2371,11 @@ static int ftdi_8u2232c_probe(struct usb_serial *serial) */ static int ftdi_stmclite_probe(struct usb_serial *serial) { - struct usb_device *udev = serial->dev; - struct usb_interface *interface = serial->interface; + struct usb_interface *intf = serial->interface; + int ifnum = intf->cur_altsetting->desc.bInterfaceNumber; - if (interface == udev->actconfig->interface[0] || - interface == udev->actconfig->interface[1]) { - dev_info(&udev->dev, "Ignoring serial port reserved for JTAG\n"); + if (ifnum < 2) { + dev_info(&intf->dev, "Ignoring interface reserved for JTAG\n"); return -ENODEV; } |