diff options
Diffstat (limited to 'drivers/usb/misc/ftdi-elan.c')
-rw-r--r-- | drivers/usb/misc/ftdi-elan.c | 36 |
1 files changed, 11 insertions, 25 deletions
diff --git a/drivers/usb/misc/ftdi-elan.c b/drivers/usb/misc/ftdi-elan.c index 0eb26a26115b..9b591b8b9369 100644 --- a/drivers/usb/misc/ftdi-elan.c +++ b/drivers/usb/misc/ftdi-elan.c | |||
@@ -513,8 +513,6 @@ static void ftdi_elan_respond_work(void *data) | |||
513 | ftdi->disconnected += 1; | 513 | ftdi->disconnected += 1; |
514 | } else if (retval == -ENODEV) { | 514 | } else if (retval == -ENODEV) { |
515 | ftdi->disconnected += 1; | 515 | ftdi->disconnected += 1; |
516 | } else if (retval == -ENODEV) { | ||
517 | ftdi->disconnected += 1; | ||
518 | } else if (retval == -EILSEQ) { | 516 | } else if (retval == -EILSEQ) { |
519 | ftdi->disconnected += 1; | 517 | ftdi->disconnected += 1; |
520 | } else { | 518 | } else { |
@@ -1186,11 +1184,8 @@ static ssize_t ftdi_elan_write(struct file *file, | |||
1186 | int retval = 0; | 1184 | int retval = 0; |
1187 | struct urb *urb; | 1185 | struct urb *urb; |
1188 | char *buf; | 1186 | char *buf; |
1189 | char data[30 *3 + 4]; | 1187 | struct usb_ftdi *ftdi = file->private_data; |
1190 | char *d = data; | 1188 | |
1191 | const char __user *s = user_buffer; | ||
1192 | int m = (sizeof(data) - 1) / 3; | ||
1193 | struct usb_ftdi *ftdi = (struct usb_ftdi *)file->private_data; | ||
1194 | if (ftdi->disconnected > 0) { | 1189 | if (ftdi->disconnected > 0) { |
1195 | return -ENODEV; | 1190 | return -ENODEV; |
1196 | } | 1191 | } |
@@ -1220,27 +1215,18 @@ static ssize_t ftdi_elan_write(struct file *file, | |||
1220 | if (retval) { | 1215 | if (retval) { |
1221 | dev_err(&ftdi->udev->dev, "failed submitting write urb, error %" | 1216 | dev_err(&ftdi->udev->dev, "failed submitting write urb, error %" |
1222 | "d\n", retval); | 1217 | "d\n", retval); |
1223 | goto error_4; | 1218 | goto error_3; |
1224 | } | 1219 | } |
1225 | usb_free_urb(urb); | 1220 | usb_free_urb(urb); |
1226 | exit:; | 1221 | |
1227 | if (count > m) { | 1222 | exit: |
1228 | int I = m - 1; | ||
1229 | while (I-- > 0) { | ||
1230 | d += sprintf(d, " %02X", 0x000000FF & *s++); | ||
1231 | } | ||
1232 | d += sprintf(d, " .."); | ||
1233 | } else { | ||
1234 | int I = count; | ||
1235 | while (I-- > 0) { | ||
1236 | d += sprintf(d, " %02X", 0x000000FF & *s++); | ||
1237 | } | ||
1238 | } | ||
1239 | return count; | 1223 | return count; |
1240 | error_4: error_3:usb_buffer_free(ftdi->udev, count, buf, | 1224 | error_3: |
1241 | urb->transfer_dma); | 1225 | usb_buffer_free(ftdi->udev, count, buf, urb->transfer_dma); |
1242 | error_2:usb_free_urb(urb); | 1226 | error_2: |
1243 | error_1:return retval; | 1227 | usb_free_urb(urb); |
1228 | error_1: | ||
1229 | return retval; | ||
1244 | } | 1230 | } |
1245 | 1231 | ||
1246 | static struct file_operations ftdi_elan_fops = { | 1232 | static struct file_operations ftdi_elan_fops = { |