|
@@ -662,16 +662,14 @@ exit:
|
|
|
|
|
|
static struct usb_serial_driver *search_serial_device(struct usb_interface *iface)
|
|
static struct usb_serial_driver *search_serial_device(struct usb_interface *iface)
|
|
{
|
|
{
|
|
- struct list_head *p;
|
|
|
|
const struct usb_device_id *id;
|
|
const struct usb_device_id *id;
|
|
- struct usb_serial_driver *t;
|
|
|
|
|
|
+ struct usb_serial_driver *drv;
|
|
|
|
|
|
/* Check if the usb id matches a known device */
|
|
/* Check if the usb id matches a known device */
|
|
- list_for_each(p, &usb_serial_driver_list) {
|
|
|
|
- t = list_entry(p, struct usb_serial_driver, driver_list);
|
|
|
|
- id = get_iface_id(t, iface);
|
|
|
|
|
|
+ list_for_each_entry(drv, &usb_serial_driver_list, driver_list) {
|
|
|
|
+ id = get_iface_id(drv, iface);
|
|
if (id)
|
|
if (id)
|
|
- return t;
|
|
|
|
|
|
+ return drv;
|
|
}
|
|
}
|
|
|
|
|
|
return NULL;
|
|
return NULL;
|
|
@@ -811,9 +809,6 @@ int usb_serial_probe(struct usb_interface *interface,
|
|
/* END HORRIBLE HACK FOR PL2303 */
|
|
/* END HORRIBLE HACK FOR PL2303 */
|
|
#endif
|
|
#endif
|
|
|
|
|
|
- /* found all that we need */
|
|
|
|
- dev_info(&interface->dev, "%s converter detected\n", type->description);
|
|
|
|
-
|
|
|
|
#ifdef CONFIG_USB_SERIAL_GENERIC
|
|
#ifdef CONFIG_USB_SERIAL_GENERIC
|
|
if (type == &usb_serial_generic_device) {
|
|
if (type == &usb_serial_generic_device) {
|
|
num_ports = num_bulk_out;
|
|
num_ports = num_bulk_out;
|
|
@@ -847,6 +842,24 @@ int usb_serial_probe(struct usb_interface *interface,
|
|
serial->num_interrupt_in = num_interrupt_in;
|
|
serial->num_interrupt_in = num_interrupt_in;
|
|
serial->num_interrupt_out = num_interrupt_out;
|
|
serial->num_interrupt_out = num_interrupt_out;
|
|
|
|
|
|
|
|
+ /* check that the device meets the driver's requirements */
|
|
|
|
+ if ((type->num_interrupt_in != NUM_DONT_CARE &&
|
|
|
|
+ type->num_interrupt_in != num_interrupt_in)
|
|
|
|
+ || (type->num_interrupt_out != NUM_DONT_CARE &&
|
|
|
|
+ type->num_interrupt_out != num_interrupt_out)
|
|
|
|
+ || (type->num_bulk_in != NUM_DONT_CARE &&
|
|
|
|
+ type->num_bulk_in != num_bulk_in)
|
|
|
|
+ || (type->num_bulk_out != NUM_DONT_CARE &&
|
|
|
|
+ type->num_bulk_out != num_bulk_out)) {
|
|
|
|
+ dbg("wrong number of endpoints");
|
|
|
|
+ kfree(serial);
|
|
|
|
+ return -EIO;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /* found all that we need */
|
|
|
|
+ dev_info(&interface->dev, "%s converter detected\n",
|
|
|
|
+ type->description);
|
|
|
|
+
|
|
/* create our ports, we need as many as the max endpoints */
|
|
/* create our ports, we need as many as the max endpoints */
|
|
/* we don't use num_ports here cauz some devices have more endpoint pairs than ports */
|
|
/* we don't use num_ports here cauz some devices have more endpoint pairs than ports */
|
|
max_endpoints = max(num_bulk_in, num_bulk_out);
|
|
max_endpoints = max(num_bulk_in, num_bulk_out);
|