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

USB: serial: oti6858: 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>

+3 -16
+3 -16
drivers/usb/serial/oti6858.c
··· 134 134 static int oti6858_tiocmget(struct tty_struct *tty); 135 135 static int oti6858_tiocmset(struct tty_struct *tty, 136 136 unsigned int set, unsigned int clear); 137 - static int oti6858_attach(struct usb_serial *serial); 138 137 static int oti6858_port_probe(struct usb_serial_port *port); 139 138 static int oti6858_port_remove(struct usb_serial_port *port); 140 139 ··· 145 146 }, 146 147 .id_table = id_table, 147 148 .num_ports = 1, 149 + .num_bulk_in = 1, 150 + .num_bulk_out = 1, 151 + .num_interrupt_in = 1, 148 152 .open = oti6858_open, 149 153 .close = oti6858_close, 150 154 .write = oti6858_write, ··· 161 159 .write_bulk_callback = oti6858_write_bulk_callback, 162 160 .write_room = oti6858_write_room, 163 161 .chars_in_buffer = oti6858_chars_in_buffer, 164 - .attach = oti6858_attach, 165 162 .port_probe = oti6858_port_probe, 166 163 .port_remove = oti6858_port_remove, 167 164 }; ··· 325 324 } 326 325 327 326 usb_serial_port_softint(port); 328 - } 329 - 330 - static int oti6858_attach(struct usb_serial *serial) 331 - { 332 - unsigned char num_ports = serial->num_ports; 333 - 334 - if (serial->num_bulk_in < num_ports || 335 - serial->num_bulk_out < num_ports || 336 - serial->num_interrupt_in < num_ports) { 337 - dev_err(&serial->interface->dev, "missing endpoints\n"); 338 - return -ENODEV; 339 - } 340 - 341 - return 0; 342 327 } 343 328 344 329 static int oti6858_port_probe(struct usb_serial_port *port)