Skip to content

Commit 711a378

Browse files
Mychaela N. Falconiajhovold
authored andcommitted
USB: serial: ftdi_sio: use cur_altsetting for consistency
ftdi_determine_type() function had this construct in it to get the number of the interface it is operating on: inter = serial->interface->altsetting->desc.bInterfaceNumber; Elsewhere in this driver cur_altsetting is used instead for this purpose. Change ftdi_determine_type() to use cur_altsetting for consistency. Signed-off-by: Mychaela N. Falconia <[email protected]> [ johan: fix old style issues; drop braces and random white space ] Signed-off-by: Johan Hovold <[email protected]>
1 parent 924a921 commit 711a378

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

drivers/usb/serial/ftdi_sio.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1571,7 +1571,8 @@ static void ftdi_determine_type(struct usb_serial_port *port)
15711571
dev_dbg(&port->dev, "%s: bcdDevice = 0x%x, bNumInterfaces = %u\n", __func__,
15721572
version, interfaces);
15731573
if (interfaces > 1) {
1574-
int inter;
1574+
struct usb_interface *intf = serial->interface;
1575+
int ifnum = intf->cur_altsetting->desc.bInterfaceNumber;
15751576

15761577
/* Multiple interfaces.*/
15771578
if (version == 0x0800) {
@@ -1586,16 +1587,15 @@ static void ftdi_determine_type(struct usb_serial_port *port)
15861587
priv->chip_type = FT2232C;
15871588

15881589
/* Determine interface code. */
1589-
inter = serial->interface->altsetting->desc.bInterfaceNumber;
1590-
if (inter == 0) {
1590+
if (ifnum == 0)
15911591
priv->interface = INTERFACE_A;
1592-
} else if (inter == 1) {
1592+
else if (ifnum == 1)
15931593
priv->interface = INTERFACE_B;
1594-
} else if (inter == 2) {
1594+
else if (ifnum == 2)
15951595
priv->interface = INTERFACE_C;
1596-
} else if (inter == 3) {
1596+
else if (ifnum == 3)
15971597
priv->interface = INTERFACE_D;
1598-
}
1598+
15991599
/* BM-type devices have a bug where bcdDevice gets set
16001600
* to 0x200 when iSerialNumber is 0. */
16011601
if (version < 0x500) {

0 commit comments

Comments
 (0)