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

USB: serial: digi_acceleport: simplify endpoint check

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

Note that this driver uses an additional bulk-endpoint pair as an
out-of-band port.

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

+4 -19
+4 -19
drivers/usb/serial/digi_acceleport.c
··· 273 273 .description = "Digi 2 port USB adapter", 274 274 .id_table = id_table_2, 275 275 .num_ports = 3, 276 + .num_bulk_in = 4, 277 + .num_bulk_out = 4, 276 278 .open = digi_open, 277 279 .close = digi_close, 278 280 .dtr_rts = digi_dtr_rts, ··· 304 302 .description = "Digi 4 port USB adapter", 305 303 .id_table = id_table_4, 306 304 .num_ports = 4, 305 + .num_bulk_in = 5, 306 + .num_bulk_out = 5, 307 307 .open = digi_open, 308 308 .close = digi_close, 309 309 .write = digi_write, ··· 1255 1251 1256 1252 static int digi_startup(struct usb_serial *serial) 1257 1253 { 1258 - struct device *dev = &serial->interface->dev; 1259 1254 struct digi_serial *serial_priv; 1260 1255 int ret; 1261 - int i; 1262 - 1263 - /* check whether the device has the expected number of endpoints */ 1264 - if (serial->num_port_pointers < serial->type->num_ports + 1) { 1265 - dev_err(dev, "OOB endpoints missing\n"); 1266 - return -ENODEV; 1267 - } 1268 - 1269 - for (i = 0; i < serial->type->num_ports + 1 ; i++) { 1270 - if (!serial->port[i]->read_urb) { 1271 - dev_err(dev, "bulk-in endpoint missing\n"); 1272 - return -ENODEV; 1273 - } 1274 - if (!serial->port[i]->write_urb) { 1275 - dev_err(dev, "bulk-out endpoint missing\n"); 1276 - return -ENODEV; 1277 - } 1278 - } 1279 1256 1280 1257 serial_priv = kzalloc(sizeof(*serial_priv), GFP_KERNEL); 1281 1258 if (!serial_priv)