Skip to content

Commit 46865bf

Browse files
committed
Merge tag 'usb-serial-3.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial into usb-next
Johan writes: USB-serial updates for v3.17-rc1 Here are some minor fixes and clean-ups to the ftdi_sio, mos7840 and kl5kusb105 drivers for v3.17-rc1. Signed-off-by: Johan Hovold <[email protected]>
2 parents 85bf20d + 5bc9e59 commit 46865bf

File tree

1 file changed

+23
-59
lines changed

1 file changed

+23
-59
lines changed

drivers/usb/serial/ftdi_sio.c

Lines changed: 23 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ struct ftdi_sio_quirk {
8787
};
8888

8989
static int ftdi_jtag_probe(struct usb_serial *serial);
90-
static int ftdi_mtxorb_hack_setup(struct usb_serial *serial);
9190
static int ftdi_NDI_device_setup(struct usb_serial *serial);
9291
static int ftdi_stmclite_probe(struct usb_serial *serial);
9392
static int ftdi_8u2232c_probe(struct usb_serial *serial);
@@ -98,10 +97,6 @@ static struct ftdi_sio_quirk ftdi_jtag_quirk = {
9897
.probe = ftdi_jtag_probe,
9998
};
10099

101-
static struct ftdi_sio_quirk ftdi_mtxorb_hack_quirk = {
102-
.probe = ftdi_mtxorb_hack_setup,
103-
};
104-
105100
static struct ftdi_sio_quirk ftdi_NDI_device_quirk = {
106101
.probe = ftdi_NDI_device_setup,
107102
};
@@ -256,14 +251,12 @@ static const struct usb_device_id id_table_combined[] = {
256251
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0124_PID) },
257252
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0125_PID) },
258253
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0126_PID) },
259-
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0127_PID),
260-
.driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk },
254+
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0127_PID) },
261255
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0128_PID) },
262256
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0129_PID) },
263257
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_012A_PID) },
264258
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_012B_PID) },
265-
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_012C_PID),
266-
.driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk },
259+
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_012C_PID) },
267260
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_012D_PID) },
268261
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_012E_PID) },
269262
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_012F_PID) },
@@ -302,18 +295,12 @@ static const struct usb_device_id id_table_combined[] = {
302295
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0150_PID) },
303296
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0151_PID) },
304297
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0152_PID) },
305-
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0153_PID),
306-
.driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk },
307-
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0154_PID),
308-
.driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk },
309-
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0155_PID),
310-
.driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk },
311-
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0156_PID),
312-
.driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk },
313-
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0157_PID),
314-
.driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk },
315-
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0158_PID),
316-
.driver_info = (kernel_ulong_t)&ftdi_mtxorb_hack_quirk },
298+
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0153_PID) },
299+
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0154_PID) },
300+
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0155_PID) },
301+
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0156_PID) },
302+
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0157_PID) },
303+
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0158_PID) },
317304
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_0159_PID) },
318305
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_015A_PID) },
319306
{ USB_DEVICE(MTXORB_VID, MTXORB_FTDI_RANGE_015B_PID) },
@@ -1559,45 +1546,40 @@ static void ftdi_determine_type(struct usb_serial_port *port)
15591546
}
15601547

15611548

1562-
/* Determine the maximum packet size for the device. This depends on the chip
1563-
* type and the USB host capabilities. The value should be obtained from the
1564-
* device descriptor as the chip will use the appropriate values for the host.*/
1549+
/*
1550+
* Determine the maximum packet size for the device. This depends on the chip
1551+
* type and the USB host capabilities. The value should be obtained from the
1552+
* device descriptor as the chip will use the appropriate values for the host.
1553+
*/
15651554
static void ftdi_set_max_packet_size(struct usb_serial_port *port)
15661555
{
15671556
struct ftdi_private *priv = usb_get_serial_port_data(port);
1568-
struct usb_serial *serial = port->serial;
1569-
struct usb_device *udev = serial->dev;
1570-
1571-
struct usb_interface *interface = serial->interface;
1557+
struct usb_interface *interface = port->serial->interface;
15721558
struct usb_endpoint_descriptor *ep_desc;
1573-
15741559
unsigned num_endpoints;
15751560
unsigned i;
15761561

15771562
num_endpoints = interface->cur_altsetting->desc.bNumEndpoints;
1578-
dev_info(&udev->dev, "Number of endpoints %d\n", num_endpoints);
1579-
15801563
if (!num_endpoints)
15811564
return;
15821565

1583-
/* NOTE: some customers have programmed FT232R/FT245R devices
1584-
* with an endpoint size of 0 - not good. In this case, we
1566+
/*
1567+
* NOTE: Some customers have programmed FT232R/FT245R devices
1568+
* with an endpoint size of 0 - not good. In this case, we
15851569
* want to override the endpoint descriptor setting and use a
1586-
* value of 64 for wMaxPacketSize */
1570+
* value of 64 for wMaxPacketSize.
1571+
*/
15871572
for (i = 0; i < num_endpoints; i++) {
1588-
dev_info(&udev->dev, "Endpoint %d MaxPacketSize %d\n", i+1,
1589-
interface->cur_altsetting->endpoint[i].desc.wMaxPacketSize);
15901573
ep_desc = &interface->cur_altsetting->endpoint[i].desc;
1591-
if (ep_desc->wMaxPacketSize == 0) {
1574+
if (!ep_desc->wMaxPacketSize) {
15921575
ep_desc->wMaxPacketSize = cpu_to_le16(0x40);
1593-
dev_info(&udev->dev, "Overriding wMaxPacketSize on endpoint %d\n", i);
1576+
dev_warn(&port->dev, "Overriding wMaxPacketSize on endpoint %d\n",
1577+
usb_endpoint_num(ep_desc));
15941578
}
15951579
}
15961580

1597-
/* set max packet size based on descriptor */
1581+
/* Set max packet size based on last descriptor. */
15981582
priv->max_packet_size = usb_endpoint_maxp(ep_desc);
1599-
1600-
dev_info(&udev->dev, "Setting MaxPacketSize %d\n", priv->max_packet_size);
16011583
}
16021584

16031585

@@ -1866,24 +1848,6 @@ static int ftdi_stmclite_probe(struct usb_serial *serial)
18661848
return 0;
18671849
}
18681850

1869-
/*
1870-
* The Matrix Orbital VK204-25-USB has an invalid IN endpoint.
1871-
* We have to correct it if we want to read from it.
1872-
*/
1873-
static int ftdi_mtxorb_hack_setup(struct usb_serial *serial)
1874-
{
1875-
struct usb_host_endpoint *ep = serial->dev->ep_in[1];
1876-
struct usb_endpoint_descriptor *ep_desc = &ep->desc;
1877-
1878-
if (ep->enabled && ep_desc->wMaxPacketSize == 0) {
1879-
ep_desc->wMaxPacketSize = cpu_to_le16(0x40);
1880-
dev_info(&serial->dev->dev,
1881-
"Fixing invalid wMaxPacketSize on read pipe\n");
1882-
}
1883-
1884-
return 0;
1885-
}
1886-
18871851
static int ftdi_sio_port_remove(struct usb_serial_port *port)
18881852
{
18891853
struct ftdi_private *priv = usb_get_serial_port_data(port);

0 commit comments

Comments
 (0)