Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

USB: serial: ipaq: use calc_num_endpoints to verify endpoints

Use the calc_num_ports rather than attach callback to determine which
interface to bind to in order to avoid allocating port-resources for
interfaces that won't be bound.

Signed-off-by: Johan Hovold <johan@kernel.org>

+10 -8
+10 -8
drivers/usb/serial/ipaq.c
··· 574 574 ipaq_num_ports = 2; 575 575 } 576 576 577 + /* 578 + * Some of the devices in ipaq_id_table[] are composite, and we 579 + * shouldn't bind to all the interfaces. This test will rule out 580 + * some obviously invalid possibilities. 581 + */ 582 + if (epds->num_bulk_in < ipaq_num_ports || 583 + epds->num_bulk_out < ipaq_num_ports) { 584 + return -ENODEV; 585 + } 586 + 577 587 return ipaq_num_ports; 578 588 } 579 589 580 590 581 591 static int ipaq_startup(struct usb_serial *serial) 582 592 { 583 - /* Some of the devices in ipaq_id_table[] are composite, and we 584 - * shouldn't bind to all the interfaces. This test will rule out 585 - * some obviously invalid possibilities. 586 - */ 587 - if (serial->num_bulk_in < serial->num_ports || 588 - serial->num_bulk_out < serial->num_ports) 589 - return -ENODEV; 590 - 591 593 if (serial->dev->actconfig->desc.bConfigurationValue != 1) { 592 594 /* 593 595 * FIXME: HP iPaq rx3715, possibly others, have 1 config that