diff options
Diffstat (limited to 'drivers/usb/serial/io_ti.c')
-rw-r--r-- | drivers/usb/serial/io_ti.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c index c339163698eb..9a0db2965fbb 100644 --- a/drivers/usb/serial/io_ti.c +++ b/drivers/usb/serial/io_ti.c | |||
@@ -1499,8 +1499,7 @@ static int do_boot_mode(struct edgeport_serial *serial, | |||
1499 | 1499 | ||
1500 | dev_dbg(dev, "%s - Download successful -- Device rebooting...\n", __func__); | 1500 | dev_dbg(dev, "%s - Download successful -- Device rebooting...\n", __func__); |
1501 | 1501 | ||
1502 | /* return an error on purpose */ | 1502 | return 1; |
1503 | return -ENODEV; | ||
1504 | } | 1503 | } |
1505 | 1504 | ||
1506 | stayinbootmode: | 1505 | stayinbootmode: |
@@ -1508,7 +1507,7 @@ stayinbootmode: | |||
1508 | dev_dbg(dev, "%s - STAYING IN BOOT MODE\n", __func__); | 1507 | dev_dbg(dev, "%s - STAYING IN BOOT MODE\n", __func__); |
1509 | serial->product_info.TiMode = TI_MODE_BOOT; | 1508 | serial->product_info.TiMode = TI_MODE_BOOT; |
1510 | 1509 | ||
1511 | return 0; | 1510 | return 1; |
1512 | } | 1511 | } |
1513 | 1512 | ||
1514 | static int ti_do_config(struct edgeport_port *port, int feature, int on) | 1513 | static int ti_do_config(struct edgeport_port *port, int feature, int on) |
@@ -2546,6 +2545,13 @@ static int edge_startup(struct usb_serial *serial) | |||
2546 | int status; | 2545 | int status; |
2547 | u16 product_id; | 2546 | u16 product_id; |
2548 | 2547 | ||
2548 | /* Make sure we have the required endpoints when in download mode. */ | ||
2549 | if (serial->interface->cur_altsetting->desc.bNumEndpoints > 1) { | ||
2550 | if (serial->num_bulk_in < serial->num_ports || | ||
2551 | serial->num_bulk_out < serial->num_ports) | ||
2552 | return -ENODEV; | ||
2553 | } | ||
2554 | |||
2549 | /* create our private serial structure */ | 2555 | /* create our private serial structure */ |
2550 | edge_serial = kzalloc(sizeof(struct edgeport_serial), GFP_KERNEL); | 2556 | edge_serial = kzalloc(sizeof(struct edgeport_serial), GFP_KERNEL); |
2551 | if (!edge_serial) | 2557 | if (!edge_serial) |
@@ -2553,14 +2559,18 @@ static int edge_startup(struct usb_serial *serial) | |||
2553 | 2559 | ||
2554 | mutex_init(&edge_serial->es_lock); | 2560 | mutex_init(&edge_serial->es_lock); |
2555 | edge_serial->serial = serial; | 2561 | edge_serial->serial = serial; |
2562 | INIT_DELAYED_WORK(&edge_serial->heartbeat_work, edge_heartbeat_work); | ||
2556 | usb_set_serial_data(serial, edge_serial); | 2563 | usb_set_serial_data(serial, edge_serial); |
2557 | 2564 | ||
2558 | status = download_fw(edge_serial); | 2565 | status = download_fw(edge_serial); |
2559 | if (status) { | 2566 | if (status < 0) { |
2560 | kfree(edge_serial); | 2567 | kfree(edge_serial); |
2561 | return status; | 2568 | return status; |
2562 | } | 2569 | } |
2563 | 2570 | ||
2571 | if (status > 0) | ||
2572 | return 1; /* bind but do not register any ports */ | ||
2573 | |||
2564 | product_id = le16_to_cpu( | 2574 | product_id = le16_to_cpu( |
2565 | edge_serial->serial->dev->descriptor.idProduct); | 2575 | edge_serial->serial->dev->descriptor.idProduct); |
2566 | 2576 | ||
@@ -2572,7 +2582,6 @@ static int edge_startup(struct usb_serial *serial) | |||
2572 | } | 2582 | } |
2573 | } | 2583 | } |
2574 | 2584 | ||
2575 | INIT_DELAYED_WORK(&edge_serial->heartbeat_work, edge_heartbeat_work); | ||
2576 | edge_heartbeat_schedule(edge_serial); | 2585 | edge_heartbeat_schedule(edge_serial); |
2577 | 2586 | ||
2578 | return 0; | 2587 | return 0; |
@@ -2580,6 +2589,9 @@ static int edge_startup(struct usb_serial *serial) | |||
2580 | 2589 | ||
2581 | static void edge_disconnect(struct usb_serial *serial) | 2590 | static void edge_disconnect(struct usb_serial *serial) |
2582 | { | 2591 | { |
2592 | struct edgeport_serial *edge_serial = usb_get_serial_data(serial); | ||
2593 | |||
2594 | cancel_delayed_work_sync(&edge_serial->heartbeat_work); | ||
2583 | } | 2595 | } |
2584 | 2596 | ||
2585 | static void edge_release(struct usb_serial *serial) | 2597 | static void edge_release(struct usb_serial *serial) |