Skip to content

Commit 75240ac

Browse files
committed
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 <[email protected]> Signed-off-by: Johan Hovold <[email protected]>
1 parent 031f966 commit 75240ac

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

drivers/usb/serial/ftdi_sio.c

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2335,12 +2335,11 @@ static int ftdi_NDI_device_setup(struct usb_serial *serial)
23352335
*/
23362336
static int ftdi_jtag_probe(struct usb_serial *serial)
23372337
{
2338-
struct usb_device *udev = serial->dev;
2339-
struct usb_interface *interface = serial->interface;
2338+
struct usb_interface *intf = serial->interface;
2339+
int ifnum = intf->cur_altsetting->desc.bInterfaceNumber;
23402340

2341-
if (interface == udev->actconfig->interface[0]) {
2342-
dev_info(&udev->dev,
2343-
"Ignoring serial port reserved for JTAG\n");
2341+
if (ifnum == 0) {
2342+
dev_info(&intf->dev, "Ignoring interface reserved for JTAG\n");
23442343
return -ENODEV;
23452344
}
23462345

@@ -2372,12 +2371,11 @@ static int ftdi_8u2232c_probe(struct usb_serial *serial)
23722371
*/
23732372
static int ftdi_stmclite_probe(struct usb_serial *serial)
23742373
{
2375-
struct usb_device *udev = serial->dev;
2376-
struct usb_interface *interface = serial->interface;
2374+
struct usb_interface *intf = serial->interface;
2375+
int ifnum = intf->cur_altsetting->desc.bInterfaceNumber;
23772376

2378-
if (interface == udev->actconfig->interface[0] ||
2379-
interface == udev->actconfig->interface[1]) {
2380-
dev_info(&udev->dev, "Ignoring serial port reserved for JTAG\n");
2377+
if (ifnum < 2) {
2378+
dev_info(&intf->dev, "Ignoring interface reserved for JTAG\n");
23812379
return -ENODEV;
23822380
}
23832381

0 commit comments

Comments
 (0)