| .. | .. |
|---|
| 334 | 334 | *respond->result = -ESHUTDOWN; |
|---|
| 335 | 335 | *respond->value = 0; |
|---|
| 336 | 336 | complete(&respond->wait_completion); |
|---|
| 337 | | - } mutex_unlock(&ftdi->u132_lock); |
|---|
| 337 | + } |
|---|
| 338 | + mutex_unlock(&ftdi->u132_lock); |
|---|
| 338 | 339 | } |
|---|
| 339 | 340 | |
|---|
| 340 | 341 | static void ftdi_elan_abandon_targets(struct usb_ftdi *ftdi) |
|---|
| .. | .. |
|---|
| 764 | 765 | struct u132_command *command = &ftdi->command[COMMAND_MASK & |
|---|
| 765 | 766 | i++]; |
|---|
| 766 | 767 | total_size += 5 + command->follows; |
|---|
| 767 | | - } return total_size; |
|---|
| 768 | + } |
|---|
| 769 | + return total_size; |
|---|
| 768 | 770 | } |
|---|
| 769 | 771 | |
|---|
| 770 | 772 | static int ftdi_elan_command_engine(struct usb_ftdi *ftdi) |
|---|
| .. | .. |
|---|
| 916 | 918 | int bytes_read = 0; |
|---|
| 917 | 919 | int retry_on_empty = 1; |
|---|
| 918 | 920 | int retry_on_timeout = 3; |
|---|
| 919 | | - int empty_packets = 0; |
|---|
| 920 | 921 | read:{ |
|---|
| 921 | 922 | int packet_bytes = 0; |
|---|
| 922 | 923 | int retval = usb_bulk_msg(ftdi->udev, |
|---|
| .. | .. |
|---|
| 961 | 962 | dev_err(&ftdi->udev->dev, "error = %d with packet_bytes = %d with total %d bytes%s\n", |
|---|
| 962 | 963 | retval, packet_bytes, bytes_read, diag); |
|---|
| 963 | 964 | return retval; |
|---|
| 964 | | - } else if (packet_bytes == 2) { |
|---|
| 965 | | - unsigned char s0 = ftdi->bulk_in_buffer[0]; |
|---|
| 966 | | - unsigned char s1 = ftdi->bulk_in_buffer[1]; |
|---|
| 967 | | - empty_packets += 1; |
|---|
| 968 | | - if (s0 == 0x31 && s1 == 0x60) { |
|---|
| 969 | | - if (retry_on_empty-- > 0) { |
|---|
| 970 | | - goto more; |
|---|
| 971 | | - } else |
|---|
| 972 | | - return 0; |
|---|
| 973 | | - } else if (s0 == 0x31 && s1 == 0x00) { |
|---|
| 974 | | - if (retry_on_empty-- > 0) { |
|---|
| 975 | | - goto more; |
|---|
| 976 | | - } else |
|---|
| 977 | | - return 0; |
|---|
| 978 | | - } else { |
|---|
| 979 | | - if (retry_on_empty-- > 0) { |
|---|
| 980 | | - goto more; |
|---|
| 981 | | - } else |
|---|
| 982 | | - return 0; |
|---|
| 983 | | - } |
|---|
| 984 | | - } else if (packet_bytes == 1) { |
|---|
| 985 | | - if (retry_on_empty-- > 0) { |
|---|
| 986 | | - goto more; |
|---|
| 987 | | - } else |
|---|
| 988 | | - return 0; |
|---|
| 989 | 965 | } else { |
|---|
| 990 | 966 | if (retry_on_empty-- > 0) { |
|---|
| 991 | 967 | goto more; |
|---|
| .. | .. |
|---|
| 2050 | 2026 | goto read; |
|---|
| 2051 | 2027 | } else |
|---|
| 2052 | 2028 | goto reset; |
|---|
| 2053 | | - } else if (s1 == 0x31 && s2 == 0x60) { |
|---|
| 2054 | | - if (read_stop-- > 0) { |
|---|
| 2055 | | - goto read; |
|---|
| 2056 | | - } else { |
|---|
| 2057 | | - dev_err(&ftdi->udev->dev, "retry limit reached\n"); |
|---|
| 2058 | | - continue; |
|---|
| 2059 | | - } |
|---|
| 2060 | 2029 | } else { |
|---|
| 2061 | 2030 | if (read_stop-- > 0) { |
|---|
| 2062 | 2031 | goto read; |
|---|