diff options
Diffstat (limited to 'drivers/usb/serial/io_edgeport.c')
-rw-r--r-- | drivers/usb/serial/io_edgeport.c | 69 |
1 files changed, 15 insertions, 54 deletions
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c index b97960ac92f2..3ef8df0ef888 100644 --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c | |||
@@ -364,42 +364,6 @@ static void update_edgeport_E2PROM(struct edgeport_serial *edge_serial) | |||
364 | release_firmware(fw); | 364 | release_firmware(fw); |
365 | } | 365 | } |
366 | 366 | ||
367 | |||
368 | /************************************************************************ | ||
369 | * * | ||
370 | * Get string descriptor from device * | ||
371 | * * | ||
372 | ************************************************************************/ | ||
373 | static int get_string(struct usb_device *dev, int Id, char *string, int buflen) | ||
374 | { | ||
375 | struct usb_string_descriptor StringDesc; | ||
376 | struct usb_string_descriptor *pStringDesc; | ||
377 | |||
378 | dbg("%s - USB String ID = %d", __func__, Id); | ||
379 | |||
380 | if (!usb_get_descriptor(dev, USB_DT_STRING, Id, | ||
381 | &StringDesc, sizeof(StringDesc))) | ||
382 | return 0; | ||
383 | |||
384 | pStringDesc = kmalloc(StringDesc.bLength, GFP_KERNEL); | ||
385 | if (!pStringDesc) | ||
386 | return 0; | ||
387 | |||
388 | if (!usb_get_descriptor(dev, USB_DT_STRING, Id, | ||
389 | pStringDesc, StringDesc.bLength)) { | ||
390 | kfree(pStringDesc); | ||
391 | return 0; | ||
392 | } | ||
393 | |||
394 | unicode_to_ascii(string, buflen, | ||
395 | pStringDesc->wData, pStringDesc->bLength/2); | ||
396 | |||
397 | kfree(pStringDesc); | ||
398 | dbg("%s - USB String %s", __func__, string); | ||
399 | return strlen(string); | ||
400 | } | ||
401 | |||
402 | |||
403 | #if 0 | 367 | #if 0 |
404 | /************************************************************************ | 368 | /************************************************************************ |
405 | * | 369 | * |
@@ -2007,7 +1971,7 @@ static void process_rcvd_status(struct edgeport_serial *edge_serial, | |||
2007 | return; | 1971 | return; |
2008 | 1972 | ||
2009 | case IOSP_EXT_STATUS_RX_CHECK_RSP: | 1973 | case IOSP_EXT_STATUS_RX_CHECK_RSP: |
2010 | dbg("%s ========== Port %u CHECK_RSP Sequence = %02x =============\n", __func__, edge_serial->rxPort, byte3); | 1974 | dbg("%s ========== Port %u CHECK_RSP Sequence = %02x =============", __func__, edge_serial->rxPort, byte3); |
2011 | /* Port->RxCheckRsp = true; */ | 1975 | /* Port->RxCheckRsp = true; */ |
2012 | return; | 1976 | return; |
2013 | } | 1977 | } |
@@ -2075,7 +2039,7 @@ static void process_rcvd_status(struct edgeport_serial *edge_serial, | |||
2075 | break; | 2039 | break; |
2076 | 2040 | ||
2077 | default: | 2041 | default: |
2078 | dbg("%s - Unrecognized IOSP status code %u\n", __func__, code); | 2042 | dbg("%s - Unrecognized IOSP status code %u", __func__, code); |
2079 | break; | 2043 | break; |
2080 | } | 2044 | } |
2081 | return; | 2045 | return; |
@@ -2091,18 +2055,13 @@ static void edge_tty_recv(struct device *dev, struct tty_struct *tty, | |||
2091 | { | 2055 | { |
2092 | int cnt; | 2056 | int cnt; |
2093 | 2057 | ||
2094 | do { | 2058 | cnt = tty_insert_flip_string(tty, data, length); |
2095 | cnt = tty_buffer_request_room(tty, length); | 2059 | if (cnt < length) { |
2096 | if (cnt < length) { | 2060 | dev_err(dev, "%s - dropping data, %d bytes lost\n", |
2097 | dev_err(dev, "%s - dropping data, %d bytes lost\n", | 2061 | __func__, length - cnt); |
2098 | __func__, length - cnt); | 2062 | } |
2099 | if (cnt == 0) | 2063 | data += cnt; |
2100 | break; | 2064 | length -= cnt; |
2101 | } | ||
2102 | tty_insert_flip_string(tty, data, cnt); | ||
2103 | data += cnt; | ||
2104 | length -= cnt; | ||
2105 | } while (length > 0); | ||
2106 | 2065 | ||
2107 | tty_flip_buffer_push(tty); | 2066 | tty_flip_buffer_push(tty); |
2108 | } | 2067 | } |
@@ -2530,7 +2489,7 @@ static int calc_baud_rate_divisor(int baudrate, int *divisor) | |||
2530 | 2489 | ||
2531 | *divisor = custom; | 2490 | *divisor = custom; |
2532 | 2491 | ||
2533 | dbg("%s - Baud %d = %d\n", __func__, baudrate, custom); | 2492 | dbg("%s - Baud %d = %d", __func__, baudrate, custom); |
2534 | return 0; | 2493 | return 0; |
2535 | } | 2494 | } |
2536 | 2495 | ||
@@ -2915,7 +2874,7 @@ static void load_application_firmware(struct edgeport_serial *edge_serial) | |||
2915 | break; | 2874 | break; |
2916 | 2875 | ||
2917 | case EDGE_DOWNLOAD_FILE_NONE: | 2876 | case EDGE_DOWNLOAD_FILE_NONE: |
2918 | dbg ("No download file specified, skipping download\n"); | 2877 | dbg("No download file specified, skipping download"); |
2919 | return; | 2878 | return; |
2920 | 2879 | ||
2921 | default: | 2880 | default: |
@@ -2997,10 +2956,12 @@ static int edge_startup(struct usb_serial *serial) | |||
2997 | usb_set_serial_data(serial, edge_serial); | 2956 | usb_set_serial_data(serial, edge_serial); |
2998 | 2957 | ||
2999 | /* get the name for the device from the device */ | 2958 | /* get the name for the device from the device */ |
3000 | i = get_string(dev, dev->descriptor.iManufacturer, | 2959 | i = usb_string(dev, dev->descriptor.iManufacturer, |
3001 | &edge_serial->name[0], MAX_NAME_LEN+1); | 2960 | &edge_serial->name[0], MAX_NAME_LEN+1); |
2961 | if (i < 0) | ||
2962 | i = 0; | ||
3002 | edge_serial->name[i++] = ' '; | 2963 | edge_serial->name[i++] = ' '; |
3003 | get_string(dev, dev->descriptor.iProduct, | 2964 | usb_string(dev, dev->descriptor.iProduct, |
3004 | &edge_serial->name[i], MAX_NAME_LEN+2 - i); | 2965 | &edge_serial->name[i], MAX_NAME_LEN+2 - i); |
3005 | 2966 | ||
3006 | dev_info(&serial->dev->dev, "%s detected\n", edge_serial->name); | 2967 | dev_info(&serial->dev->dev, "%s detected\n", edge_serial->name); |