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

USB: serial: spcp8x5: simplify endpoint check

Simplify the endpoint sanity check by letting core verify that the
required endpoints are present.

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

+2 -14
+2 -14
drivers/usb/serial/spcp8x5.c
··· 154 154 return 0; 155 155 } 156 156 157 - static int spcp8x5_attach(struct usb_serial *serial) 158 - { 159 - unsigned char num_ports = serial->num_ports; 160 - 161 - if (serial->num_bulk_in < num_ports || 162 - serial->num_bulk_out < num_ports) { 163 - dev_err(&serial->interface->dev, "missing endpoints\n"); 164 - return -ENODEV; 165 - } 166 - 167 - return 0; 168 - } 169 - 170 157 static int spcp8x5_port_probe(struct usb_serial_port *port) 171 158 { 172 159 const struct usb_device_id *id = usb_get_serial_data(port->serial); ··· 475 488 }, 476 489 .id_table = id_table, 477 490 .num_ports = 1, 491 + .num_bulk_in = 1, 492 + .num_bulk_out = 1, 478 493 .open = spcp8x5_open, 479 494 .dtr_rts = spcp8x5_dtr_rts, 480 495 .carrier_raised = spcp8x5_carrier_raised, ··· 485 496 .tiocmget = spcp8x5_tiocmget, 486 497 .tiocmset = spcp8x5_tiocmset, 487 498 .probe = spcp8x5_probe, 488 - .attach = spcp8x5_attach, 489 499 .port_probe = spcp8x5_port_probe, 490 500 .port_remove = spcp8x5_port_remove, 491 501 };