diff options
Diffstat (limited to 'drivers/usb/misc/ftdi-elan.c')
-rw-r--r-- | drivers/usb/misc/ftdi-elan.c | 39 |
1 files changed, 12 insertions, 27 deletions
diff --git a/drivers/usb/misc/ftdi-elan.c b/drivers/usb/misc/ftdi-elan.c index b88a09497c28..9b591b8b9369 100644 --- a/drivers/usb/misc/ftdi-elan.c +++ b/drivers/usb/misc/ftdi-elan.c | |||
@@ -35,7 +35,6 @@ | |||
35 | * via an ELAN U132 adapter. | 35 | * via an ELAN U132 adapter. |
36 | * | 36 | * |
37 | */ | 37 | */ |
38 | #include <linux/config.h> | ||
39 | #include <linux/kernel.h> | 38 | #include <linux/kernel.h> |
40 | #include <linux/errno.h> | 39 | #include <linux/errno.h> |
41 | #include <linux/init.h> | 40 | #include <linux/init.h> |
@@ -514,8 +513,6 @@ static void ftdi_elan_respond_work(void *data) | |||
514 | ftdi->disconnected += 1; | 513 | ftdi->disconnected += 1; |
515 | } else if (retval == -ENODEV) { | 514 | } else if (retval == -ENODEV) { |
516 | ftdi->disconnected += 1; | 515 | ftdi->disconnected += 1; |
517 | } else if (retval == -ENODEV) { | ||
518 | ftdi->disconnected += 1; | ||
519 | } else if (retval == -EILSEQ) { | 516 | } else if (retval == -EILSEQ) { |
520 | ftdi->disconnected += 1; | 517 | ftdi->disconnected += 1; |
521 | } else { | 518 | } else { |
@@ -759,7 +756,7 @@ static ssize_t ftdi_elan_read(struct file *file, char __user *buffer, | |||
759 | return bytes_read; | 756 | return bytes_read; |
760 | } | 757 | } |
761 | 758 | ||
762 | static void ftdi_elan_write_bulk_callback(struct urb *urb, struct pt_regs *regs) | 759 | static void ftdi_elan_write_bulk_callback(struct urb *urb) |
763 | { | 760 | { |
764 | struct usb_ftdi *ftdi = (struct usb_ftdi *)urb->context; | 761 | struct usb_ftdi *ftdi = (struct usb_ftdi *)urb->context; |
765 | if (urb->status && !(urb->status == -ENOENT || urb->status == | 762 | if (urb->status && !(urb->status == -ENOENT || urb->status == |
@@ -1187,11 +1184,8 @@ static ssize_t ftdi_elan_write(struct file *file, | |||
1187 | int retval = 0; | 1184 | int retval = 0; |
1188 | struct urb *urb; | 1185 | struct urb *urb; |
1189 | char *buf; | 1186 | char *buf; |
1190 | char data[30 *3 + 4]; | 1187 | struct usb_ftdi *ftdi = file->private_data; |
1191 | char *d = data; | 1188 | |
1192 | const char __user *s = user_buffer; | ||
1193 | int m = (sizeof(data) - 1) / 3; | ||
1194 | struct usb_ftdi *ftdi = (struct usb_ftdi *)file->private_data; | ||
1195 | if (ftdi->disconnected > 0) { | 1189 | if (ftdi->disconnected > 0) { |
1196 | return -ENODEV; | 1190 | return -ENODEV; |
1197 | } | 1191 | } |
@@ -1221,27 +1215,18 @@ static ssize_t ftdi_elan_write(struct file *file, | |||
1221 | if (retval) { | 1215 | if (retval) { |
1222 | dev_err(&ftdi->udev->dev, "failed submitting write urb, error %" | 1216 | dev_err(&ftdi->udev->dev, "failed submitting write urb, error %" |
1223 | "d\n", retval); | 1217 | "d\n", retval); |
1224 | goto error_4; | 1218 | goto error_3; |
1225 | } | 1219 | } |
1226 | usb_free_urb(urb); | 1220 | usb_free_urb(urb); |
1227 | exit:; | 1221 | |
1228 | if (count > m) { | 1222 | exit: |
1229 | int I = m - 1; | ||
1230 | while (I-- > 0) { | ||
1231 | d += sprintf(d, " %02X", 0x000000FF & *s++); | ||
1232 | } | ||
1233 | d += sprintf(d, " .."); | ||
1234 | } else { | ||
1235 | int I = count; | ||
1236 | while (I-- > 0) { | ||
1237 | d += sprintf(d, " %02X", 0x000000FF & *s++); | ||
1238 | } | ||
1239 | } | ||
1240 | return count; | 1223 | return count; |
1241 | error_4: error_3:usb_buffer_free(ftdi->udev, count, buf, | 1224 | error_3: |
1242 | urb->transfer_dma); | 1225 | usb_buffer_free(ftdi->udev, count, buf, urb->transfer_dma); |
1243 | error_2:usb_free_urb(urb); | 1226 | error_2: |
1244 | error_1:return retval; | 1227 | usb_free_urb(urb); |
1228 | error_1: | ||
1229 | return retval; | ||
1245 | } | 1230 | } |
1246 | 1231 | ||
1247 | static struct file_operations ftdi_elan_fops = { | 1232 | static struct file_operations ftdi_elan_fops = { |