Skip to content

Commit 47e5759

Browse files
committed
USB: ftdi_sio: clean up ftdi_set_max_packet_size()
Code and comment style clean ups of ftdi_set_max_packet_size(). Signed-off-by: Johan Hovold <[email protected]>
1 parent a90d84a commit 47e5759

File tree

1 file changed

+13
-11
lines changed

1 file changed

+13
-11
lines changed

drivers/usb/serial/ftdi_sio.c

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1556,37 +1556,39 @@ static void ftdi_determine_type(struct usb_serial_port *port)
15561556
}
15571557

15581558

1559-
/* Determine the maximum packet size for the device. This depends on the chip
1560-
* type and the USB host capabilities. The value should be obtained from the
1561-
* device descriptor as the chip will use the appropriate values for the host.*/
1559+
/*
1560+
* Determine the maximum packet size for the device. This depends on the chip
1561+
* type and the USB host capabilities. The value should be obtained from the
1562+
* device descriptor as the chip will use the appropriate values for the host.
1563+
*/
15621564
static void ftdi_set_max_packet_size(struct usb_serial_port *port)
15631565
{
15641566
struct ftdi_private *priv = usb_get_serial_port_data(port);
1565-
struct usb_serial *serial = port->serial;
1566-
struct usb_interface *interface = serial->interface;
1567+
struct usb_interface *interface = port->serial->interface;
15671568
struct usb_endpoint_descriptor *ep_desc;
1568-
15691569
unsigned num_endpoints;
15701570
unsigned i;
15711571

15721572
num_endpoints = interface->cur_altsetting->desc.bNumEndpoints;
15731573
if (!num_endpoints)
15741574
return;
15751575

1576-
/* NOTE: some customers have programmed FT232R/FT245R devices
1577-
* with an endpoint size of 0 - not good. In this case, we
1576+
/*
1577+
* NOTE: Some customers have programmed FT232R/FT245R devices
1578+
* with an endpoint size of 0 - not good. In this case, we
15781579
* want to override the endpoint descriptor setting and use a
1579-
* value of 64 for wMaxPacketSize */
1580+
* value of 64 for wMaxPacketSize.
1581+
*/
15801582
for (i = 0; i < num_endpoints; i++) {
15811583
ep_desc = &interface->cur_altsetting->endpoint[i].desc;
1582-
if (ep_desc->wMaxPacketSize == 0) {
1584+
if (!ep_desc->wMaxPacketSize) {
15831585
ep_desc->wMaxPacketSize = cpu_to_le16(0x40);
15841586
dev_warn(&port->dev, "Overriding wMaxPacketSize on endpoint %d\n",
15851587
usb_endpoint_num(ep_desc));
15861588
}
15871589
}
15881590

1589-
/* set max packet size based on descriptor */
1591+
/* Set max packet size based on last descriptor. */
15901592
priv->max_packet_size = usb_endpoint_maxp(ep_desc);
15911593
}
15921594

0 commit comments

Comments
 (0)