diff options
author | Matthias Kaehlcke <matthias.kaehlcke@gmail.com> | 2007-10-16 13:23:10 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2007-10-25 15:18:43 -0400 |
commit | c93d46509e7aee7d58680c4c8a12cfbe98df98cb (patch) | |
tree | 310a3be9679d7548d01cfdc8898947724b231b4e | |
parent | 7898ffc543566a9c4a1b4ff39f43857d2d84a51c (diff) |
USB: FTDI Elan driver: Convert ftdi->u132_lock to mutex
FTDI Elan driver: Convert the semaphore ftdi->u132_lock to the mutex
API
Signed-off-by: Matthias Kaehlcke <matthias.kaehlcke@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/usb/misc/ftdi-elan.c | 130 |
1 files changed, 65 insertions, 65 deletions
diff --git a/drivers/usb/misc/ftdi-elan.c b/drivers/usb/misc/ftdi-elan.c index d3d8cd6ff103..148b7fe639b2 100644 --- a/drivers/usb/misc/ftdi-elan.c +++ b/drivers/usb/misc/ftdi-elan.c | |||
@@ -147,7 +147,7 @@ struct u132_target { | |||
147 | /* Structure to hold all of our device specific stuff*/ | 147 | /* Structure to hold all of our device specific stuff*/ |
148 | struct usb_ftdi { | 148 | struct usb_ftdi { |
149 | struct list_head ftdi_list; | 149 | struct list_head ftdi_list; |
150 | struct semaphore u132_lock; | 150 | struct mutex u132_lock; |
151 | int command_next; | 151 | int command_next; |
152 | int command_head; | 152 | int command_head; |
153 | struct u132_command command[COMMAND_SIZE]; | 153 | struct u132_command command[COMMAND_SIZE]; |
@@ -330,39 +330,39 @@ static int ftdi_elan_hcd_init(struct usb_ftdi *ftdi) | |||
330 | 330 | ||
331 | static void ftdi_elan_abandon_completions(struct usb_ftdi *ftdi) | 331 | static void ftdi_elan_abandon_completions(struct usb_ftdi *ftdi) |
332 | { | 332 | { |
333 | down(&ftdi->u132_lock); | 333 | mutex_lock(&ftdi->u132_lock); |
334 | while (ftdi->respond_next > ftdi->respond_head) { | 334 | while (ftdi->respond_next > ftdi->respond_head) { |
335 | struct u132_respond *respond = &ftdi->respond[RESPOND_MASK & | 335 | struct u132_respond *respond = &ftdi->respond[RESPOND_MASK & |
336 | ftdi->respond_head++]; | 336 | ftdi->respond_head++]; |
337 | *respond->result = -ESHUTDOWN; | 337 | *respond->result = -ESHUTDOWN; |
338 | *respond->value = 0; | 338 | *respond->value = 0; |
339 | complete(&respond->wait_completion); | 339 | complete(&respond->wait_completion); |
340 | } up(&ftdi->u132_lock); | 340 | } mutex_unlock(&ftdi->u132_lock); |
341 | } | 341 | } |
342 | 342 | ||
343 | static void ftdi_elan_abandon_targets(struct usb_ftdi *ftdi) | 343 | static void ftdi_elan_abandon_targets(struct usb_ftdi *ftdi) |
344 | { | 344 | { |
345 | int ed_number = 4; | 345 | int ed_number = 4; |
346 | down(&ftdi->u132_lock); | 346 | mutex_lock(&ftdi->u132_lock); |
347 | while (ed_number-- > 0) { | 347 | while (ed_number-- > 0) { |
348 | struct u132_target *target = &ftdi->target[ed_number]; | 348 | struct u132_target *target = &ftdi->target[ed_number]; |
349 | if (target->active == 1) { | 349 | if (target->active == 1) { |
350 | target->condition_code = TD_DEVNOTRESP; | 350 | target->condition_code = TD_DEVNOTRESP; |
351 | up(&ftdi->u132_lock); | 351 | mutex_unlock(&ftdi->u132_lock); |
352 | ftdi_elan_do_callback(ftdi, target, NULL, 0); | 352 | ftdi_elan_do_callback(ftdi, target, NULL, 0); |
353 | down(&ftdi->u132_lock); | 353 | mutex_lock(&ftdi->u132_lock); |
354 | } | 354 | } |
355 | } | 355 | } |
356 | ftdi->recieved = 0; | 356 | ftdi->recieved = 0; |
357 | ftdi->expected = 4; | 357 | ftdi->expected = 4; |
358 | ftdi->ed_found = 0; | 358 | ftdi->ed_found = 0; |
359 | up(&ftdi->u132_lock); | 359 | mutex_unlock(&ftdi->u132_lock); |
360 | } | 360 | } |
361 | 361 | ||
362 | static void ftdi_elan_flush_targets(struct usb_ftdi *ftdi) | 362 | static void ftdi_elan_flush_targets(struct usb_ftdi *ftdi) |
363 | { | 363 | { |
364 | int ed_number = 4; | 364 | int ed_number = 4; |
365 | down(&ftdi->u132_lock); | 365 | mutex_lock(&ftdi->u132_lock); |
366 | while (ed_number-- > 0) { | 366 | while (ed_number-- > 0) { |
367 | struct u132_target *target = &ftdi->target[ed_number]; | 367 | struct u132_target *target = &ftdi->target[ed_number]; |
368 | target->abandoning = 1; | 368 | target->abandoning = 1; |
@@ -382,9 +382,9 @@ static void ftdi_elan_flush_targets(struct usb_ftdi *ftdi) | |||
382 | ftdi->command_next += 1; | 382 | ftdi->command_next += 1; |
383 | ftdi_elan_kick_command_queue(ftdi); | 383 | ftdi_elan_kick_command_queue(ftdi); |
384 | } else { | 384 | } else { |
385 | up(&ftdi->u132_lock); | 385 | mutex_unlock(&ftdi->u132_lock); |
386 | msleep(100); | 386 | msleep(100); |
387 | down(&ftdi->u132_lock); | 387 | mutex_lock(&ftdi->u132_lock); |
388 | goto wait_1; | 388 | goto wait_1; |
389 | } | 389 | } |
390 | } | 390 | } |
@@ -404,9 +404,9 @@ static void ftdi_elan_flush_targets(struct usb_ftdi *ftdi) | |||
404 | ftdi->command_next += 1; | 404 | ftdi->command_next += 1; |
405 | ftdi_elan_kick_command_queue(ftdi); | 405 | ftdi_elan_kick_command_queue(ftdi); |
406 | } else { | 406 | } else { |
407 | up(&ftdi->u132_lock); | 407 | mutex_unlock(&ftdi->u132_lock); |
408 | msleep(100); | 408 | msleep(100); |
409 | down(&ftdi->u132_lock); | 409 | mutex_lock(&ftdi->u132_lock); |
410 | goto wait_2; | 410 | goto wait_2; |
411 | } | 411 | } |
412 | } | 412 | } |
@@ -414,13 +414,13 @@ static void ftdi_elan_flush_targets(struct usb_ftdi *ftdi) | |||
414 | ftdi->recieved = 0; | 414 | ftdi->recieved = 0; |
415 | ftdi->expected = 4; | 415 | ftdi->expected = 4; |
416 | ftdi->ed_found = 0; | 416 | ftdi->ed_found = 0; |
417 | up(&ftdi->u132_lock); | 417 | mutex_unlock(&ftdi->u132_lock); |
418 | } | 418 | } |
419 | 419 | ||
420 | static void ftdi_elan_cancel_targets(struct usb_ftdi *ftdi) | 420 | static void ftdi_elan_cancel_targets(struct usb_ftdi *ftdi) |
421 | { | 421 | { |
422 | int ed_number = 4; | 422 | int ed_number = 4; |
423 | down(&ftdi->u132_lock); | 423 | mutex_lock(&ftdi->u132_lock); |
424 | while (ed_number-- > 0) { | 424 | while (ed_number-- > 0) { |
425 | struct u132_target *target = &ftdi->target[ed_number]; | 425 | struct u132_target *target = &ftdi->target[ed_number]; |
426 | target->abandoning = 1; | 426 | target->abandoning = 1; |
@@ -440,9 +440,9 @@ static void ftdi_elan_cancel_targets(struct usb_ftdi *ftdi) | |||
440 | ftdi->command_next += 1; | 440 | ftdi->command_next += 1; |
441 | ftdi_elan_kick_command_queue(ftdi); | 441 | ftdi_elan_kick_command_queue(ftdi); |
442 | } else { | 442 | } else { |
443 | up(&ftdi->u132_lock); | 443 | mutex_unlock(&ftdi->u132_lock); |
444 | msleep(100); | 444 | msleep(100); |
445 | down(&ftdi->u132_lock); | 445 | mutex_lock(&ftdi->u132_lock); |
446 | goto wait; | 446 | goto wait; |
447 | } | 447 | } |
448 | } | 448 | } |
@@ -450,7 +450,7 @@ static void ftdi_elan_cancel_targets(struct usb_ftdi *ftdi) | |||
450 | ftdi->recieved = 0; | 450 | ftdi->recieved = 0; |
451 | ftdi->expected = 4; | 451 | ftdi->expected = 4; |
452 | ftdi->ed_found = 0; | 452 | ftdi->ed_found = 0; |
453 | up(&ftdi->u132_lock); | 453 | mutex_unlock(&ftdi->u132_lock); |
454 | } | 454 | } |
455 | 455 | ||
456 | static void ftdi_elan_kick_command_queue(struct usb_ftdi *ftdi) | 456 | static void ftdi_elan_kick_command_queue(struct usb_ftdi *ftdi) |
@@ -886,14 +886,14 @@ static char *have_ed_set_response(struct usb_ftdi *ftdi, | |||
886 | char *b) | 886 | char *b) |
887 | { | 887 | { |
888 | int payload = (ed_length >> 0) & 0x07FF; | 888 | int payload = (ed_length >> 0) & 0x07FF; |
889 | down(&ftdi->u132_lock); | 889 | mutex_lock(&ftdi->u132_lock); |
890 | target->actual = 0; | 890 | target->actual = 0; |
891 | target->non_null = (ed_length >> 15) & 0x0001; | 891 | target->non_null = (ed_length >> 15) & 0x0001; |
892 | target->repeat_number = (ed_length >> 11) & 0x000F; | 892 | target->repeat_number = (ed_length >> 11) & 0x000F; |
893 | if (ed_type == 0x02) { | 893 | if (ed_type == 0x02) { |
894 | if (payload == 0 || target->abandoning > 0) { | 894 | if (payload == 0 || target->abandoning > 0) { |
895 | target->abandoning = 0; | 895 | target->abandoning = 0; |
896 | up(&ftdi->u132_lock); | 896 | mutex_unlock(&ftdi->u132_lock); |
897 | ftdi_elan_do_callback(ftdi, target, 4 + ftdi->response, | 897 | ftdi_elan_do_callback(ftdi, target, 4 + ftdi->response, |
898 | payload); | 898 | payload); |
899 | ftdi->recieved = 0; | 899 | ftdi->recieved = 0; |
@@ -903,13 +903,13 @@ static char *have_ed_set_response(struct usb_ftdi *ftdi, | |||
903 | } else { | 903 | } else { |
904 | ftdi->expected = 4 + payload; | 904 | ftdi->expected = 4 + payload; |
905 | ftdi->ed_found = 1; | 905 | ftdi->ed_found = 1; |
906 | up(&ftdi->u132_lock); | 906 | mutex_unlock(&ftdi->u132_lock); |
907 | return b; | 907 | return b; |
908 | } | 908 | } |
909 | } else if (ed_type == 0x03) { | 909 | } else if (ed_type == 0x03) { |
910 | if (payload == 0 || target->abandoning > 0) { | 910 | if (payload == 0 || target->abandoning > 0) { |
911 | target->abandoning = 0; | 911 | target->abandoning = 0; |
912 | up(&ftdi->u132_lock); | 912 | mutex_unlock(&ftdi->u132_lock); |
913 | ftdi_elan_do_callback(ftdi, target, 4 + ftdi->response, | 913 | ftdi_elan_do_callback(ftdi, target, 4 + ftdi->response, |
914 | payload); | 914 | payload); |
915 | ftdi->recieved = 0; | 915 | ftdi->recieved = 0; |
@@ -919,12 +919,12 @@ static char *have_ed_set_response(struct usb_ftdi *ftdi, | |||
919 | } else { | 919 | } else { |
920 | ftdi->expected = 4 + payload; | 920 | ftdi->expected = 4 + payload; |
921 | ftdi->ed_found = 1; | 921 | ftdi->ed_found = 1; |
922 | up(&ftdi->u132_lock); | 922 | mutex_unlock(&ftdi->u132_lock); |
923 | return b; | 923 | return b; |
924 | } | 924 | } |
925 | } else if (ed_type == 0x01) { | 925 | } else if (ed_type == 0x01) { |
926 | target->abandoning = 0; | 926 | target->abandoning = 0; |
927 | up(&ftdi->u132_lock); | 927 | mutex_unlock(&ftdi->u132_lock); |
928 | ftdi_elan_do_callback(ftdi, target, 4 + ftdi->response, | 928 | ftdi_elan_do_callback(ftdi, target, 4 + ftdi->response, |
929 | payload); | 929 | payload); |
930 | ftdi->recieved = 0; | 930 | ftdi->recieved = 0; |
@@ -933,7 +933,7 @@ static char *have_ed_set_response(struct usb_ftdi *ftdi, | |||
933 | return ftdi->response; | 933 | return ftdi->response; |
934 | } else { | 934 | } else { |
935 | target->abandoning = 0; | 935 | target->abandoning = 0; |
936 | up(&ftdi->u132_lock); | 936 | mutex_unlock(&ftdi->u132_lock); |
937 | ftdi_elan_do_callback(ftdi, target, 4 + ftdi->response, | 937 | ftdi_elan_do_callback(ftdi, target, 4 + ftdi->response, |
938 | payload); | 938 | payload); |
939 | ftdi->recieved = 0; | 939 | ftdi->recieved = 0; |
@@ -947,12 +947,12 @@ static char *have_ed_get_response(struct usb_ftdi *ftdi, | |||
947 | struct u132_target *target, u16 ed_length, int ed_number, int ed_type, | 947 | struct u132_target *target, u16 ed_length, int ed_number, int ed_type, |
948 | char *b) | 948 | char *b) |
949 | { | 949 | { |
950 | down(&ftdi->u132_lock); | 950 | mutex_lock(&ftdi->u132_lock); |
951 | target->condition_code = TD_DEVNOTRESP; | 951 | target->condition_code = TD_DEVNOTRESP; |
952 | target->actual = (ed_length >> 0) & 0x01FF; | 952 | target->actual = (ed_length >> 0) & 0x01FF; |
953 | target->non_null = (ed_length >> 15) & 0x0001; | 953 | target->non_null = (ed_length >> 15) & 0x0001; |
954 | target->repeat_number = (ed_length >> 11) & 0x000F; | 954 | target->repeat_number = (ed_length >> 11) & 0x000F; |
955 | up(&ftdi->u132_lock); | 955 | mutex_unlock(&ftdi->u132_lock); |
956 | if (target->active) | 956 | if (target->active) |
957 | ftdi_elan_do_callback(ftdi, target, NULL, 0); | 957 | ftdi_elan_do_callback(ftdi, target, NULL, 0); |
958 | target->abandoning = 0; | 958 | target->abandoning = 0; |
@@ -1278,7 +1278,7 @@ static int ftdi_elan_write_reg(struct usb_ftdi *ftdi, u32 data) | |||
1278 | return -ENODEV; | 1278 | return -ENODEV; |
1279 | } else { | 1279 | } else { |
1280 | int command_size; | 1280 | int command_size; |
1281 | down(&ftdi->u132_lock); | 1281 | mutex_lock(&ftdi->u132_lock); |
1282 | command_size = ftdi->command_next - ftdi->command_head; | 1282 | command_size = ftdi->command_next - ftdi->command_head; |
1283 | if (command_size < COMMAND_SIZE) { | 1283 | if (command_size < COMMAND_SIZE) { |
1284 | struct u132_command *command = &ftdi->command[ | 1284 | struct u132_command *command = &ftdi->command[ |
@@ -1292,10 +1292,10 @@ static int ftdi_elan_write_reg(struct usb_ftdi *ftdi, u32 data) | |||
1292 | command->buffer = &command->value; | 1292 | command->buffer = &command->value; |
1293 | ftdi->command_next += 1; | 1293 | ftdi->command_next += 1; |
1294 | ftdi_elan_kick_command_queue(ftdi); | 1294 | ftdi_elan_kick_command_queue(ftdi); |
1295 | up(&ftdi->u132_lock); | 1295 | mutex_unlock(&ftdi->u132_lock); |
1296 | return 0; | 1296 | return 0; |
1297 | } else { | 1297 | } else { |
1298 | up(&ftdi->u132_lock); | 1298 | mutex_unlock(&ftdi->u132_lock); |
1299 | msleep(100); | 1299 | msleep(100); |
1300 | goto wait; | 1300 | goto wait; |
1301 | } | 1301 | } |
@@ -1310,7 +1310,7 @@ static int ftdi_elan_write_config(struct usb_ftdi *ftdi, int config_offset, | |||
1310 | return -ENODEV; | 1310 | return -ENODEV; |
1311 | } else { | 1311 | } else { |
1312 | int command_size; | 1312 | int command_size; |
1313 | down(&ftdi->u132_lock); | 1313 | mutex_lock(&ftdi->u132_lock); |
1314 | command_size = ftdi->command_next - ftdi->command_head; | 1314 | command_size = ftdi->command_next - ftdi->command_head; |
1315 | if (command_size < COMMAND_SIZE) { | 1315 | if (command_size < COMMAND_SIZE) { |
1316 | struct u132_command *command = &ftdi->command[ | 1316 | struct u132_command *command = &ftdi->command[ |
@@ -1324,10 +1324,10 @@ static int ftdi_elan_write_config(struct usb_ftdi *ftdi, int config_offset, | |||
1324 | command->buffer = &command->value; | 1324 | command->buffer = &command->value; |
1325 | ftdi->command_next += 1; | 1325 | ftdi->command_next += 1; |
1326 | ftdi_elan_kick_command_queue(ftdi); | 1326 | ftdi_elan_kick_command_queue(ftdi); |
1327 | up(&ftdi->u132_lock); | 1327 | mutex_unlock(&ftdi->u132_lock); |
1328 | return 0; | 1328 | return 0; |
1329 | } else { | 1329 | } else { |
1330 | up(&ftdi->u132_lock); | 1330 | mutex_unlock(&ftdi->u132_lock); |
1331 | msleep(100); | 1331 | msleep(100); |
1332 | goto wait; | 1332 | goto wait; |
1333 | } | 1333 | } |
@@ -1342,7 +1342,7 @@ static int ftdi_elan_write_pcimem(struct usb_ftdi *ftdi, int mem_offset, | |||
1342 | return -ENODEV; | 1342 | return -ENODEV; |
1343 | } else { | 1343 | } else { |
1344 | int command_size; | 1344 | int command_size; |
1345 | down(&ftdi->u132_lock); | 1345 | mutex_lock(&ftdi->u132_lock); |
1346 | command_size = ftdi->command_next - ftdi->command_head; | 1346 | command_size = ftdi->command_next - ftdi->command_head; |
1347 | if (command_size < COMMAND_SIZE) { | 1347 | if (command_size < COMMAND_SIZE) { |
1348 | struct u132_command *command = &ftdi->command[ | 1348 | struct u132_command *command = &ftdi->command[ |
@@ -1356,10 +1356,10 @@ static int ftdi_elan_write_pcimem(struct usb_ftdi *ftdi, int mem_offset, | |||
1356 | command->buffer = &command->value; | 1356 | command->buffer = &command->value; |
1357 | ftdi->command_next += 1; | 1357 | ftdi->command_next += 1; |
1358 | ftdi_elan_kick_command_queue(ftdi); | 1358 | ftdi_elan_kick_command_queue(ftdi); |
1359 | up(&ftdi->u132_lock); | 1359 | mutex_unlock(&ftdi->u132_lock); |
1360 | return 0; | 1360 | return 0; |
1361 | } else { | 1361 | } else { |
1362 | up(&ftdi->u132_lock); | 1362 | mutex_unlock(&ftdi->u132_lock); |
1363 | msleep(100); | 1363 | msleep(100); |
1364 | goto wait; | 1364 | goto wait; |
1365 | } | 1365 | } |
@@ -1382,7 +1382,7 @@ static int ftdi_elan_read_reg(struct usb_ftdi *ftdi, u32 *data) | |||
1382 | } else { | 1382 | } else { |
1383 | int command_size; | 1383 | int command_size; |
1384 | int respond_size; | 1384 | int respond_size; |
1385 | down(&ftdi->u132_lock); | 1385 | mutex_lock(&ftdi->u132_lock); |
1386 | command_size = ftdi->command_next - ftdi->command_head; | 1386 | command_size = ftdi->command_next - ftdi->command_head; |
1387 | respond_size = ftdi->respond_next - ftdi->respond_head; | 1387 | respond_size = ftdi->respond_next - ftdi->respond_head; |
1388 | if (command_size < COMMAND_SIZE && respond_size < RESPOND_SIZE) | 1388 | if (command_size < COMMAND_SIZE && respond_size < RESPOND_SIZE) |
@@ -1405,11 +1405,11 @@ static int ftdi_elan_read_reg(struct usb_ftdi *ftdi, u32 *data) | |||
1405 | ftdi->command_next += 1; | 1405 | ftdi->command_next += 1; |
1406 | ftdi->respond_next += 1; | 1406 | ftdi->respond_next += 1; |
1407 | ftdi_elan_kick_command_queue(ftdi); | 1407 | ftdi_elan_kick_command_queue(ftdi); |
1408 | up(&ftdi->u132_lock); | 1408 | mutex_unlock(&ftdi->u132_lock); |
1409 | wait_for_completion(&respond->wait_completion); | 1409 | wait_for_completion(&respond->wait_completion); |
1410 | return result; | 1410 | return result; |
1411 | } else { | 1411 | } else { |
1412 | up(&ftdi->u132_lock); | 1412 | mutex_unlock(&ftdi->u132_lock); |
1413 | msleep(100); | 1413 | msleep(100); |
1414 | goto wait; | 1414 | goto wait; |
1415 | } | 1415 | } |
@@ -1425,7 +1425,7 @@ static int ftdi_elan_read_config(struct usb_ftdi *ftdi, int config_offset, | |||
1425 | } else { | 1425 | } else { |
1426 | int command_size; | 1426 | int command_size; |
1427 | int respond_size; | 1427 | int respond_size; |
1428 | down(&ftdi->u132_lock); | 1428 | mutex_lock(&ftdi->u132_lock); |
1429 | command_size = ftdi->command_next - ftdi->command_head; | 1429 | command_size = ftdi->command_next - ftdi->command_head; |
1430 | respond_size = ftdi->respond_next - ftdi->respond_head; | 1430 | respond_size = ftdi->respond_next - ftdi->respond_head; |
1431 | if (command_size < COMMAND_SIZE && respond_size < RESPOND_SIZE) | 1431 | if (command_size < COMMAND_SIZE && respond_size < RESPOND_SIZE) |
@@ -1449,11 +1449,11 @@ static int ftdi_elan_read_config(struct usb_ftdi *ftdi, int config_offset, | |||
1449 | ftdi->command_next += 1; | 1449 | ftdi->command_next += 1; |
1450 | ftdi->respond_next += 1; | 1450 | ftdi->respond_next += 1; |
1451 | ftdi_elan_kick_command_queue(ftdi); | 1451 | ftdi_elan_kick_command_queue(ftdi); |
1452 | up(&ftdi->u132_lock); | 1452 | mutex_unlock(&ftdi->u132_lock); |
1453 | wait_for_completion(&respond->wait_completion); | 1453 | wait_for_completion(&respond->wait_completion); |
1454 | return result; | 1454 | return result; |
1455 | } else { | 1455 | } else { |
1456 | up(&ftdi->u132_lock); | 1456 | mutex_unlock(&ftdi->u132_lock); |
1457 | msleep(100); | 1457 | msleep(100); |
1458 | goto wait; | 1458 | goto wait; |
1459 | } | 1459 | } |
@@ -1469,7 +1469,7 @@ static int ftdi_elan_read_pcimem(struct usb_ftdi *ftdi, int mem_offset, | |||
1469 | } else { | 1469 | } else { |
1470 | int command_size; | 1470 | int command_size; |
1471 | int respond_size; | 1471 | int respond_size; |
1472 | down(&ftdi->u132_lock); | 1472 | mutex_lock(&ftdi->u132_lock); |
1473 | command_size = ftdi->command_next - ftdi->command_head; | 1473 | command_size = ftdi->command_next - ftdi->command_head; |
1474 | respond_size = ftdi->respond_next - ftdi->respond_head; | 1474 | respond_size = ftdi->respond_next - ftdi->respond_head; |
1475 | if (command_size < COMMAND_SIZE && respond_size < RESPOND_SIZE) | 1475 | if (command_size < COMMAND_SIZE && respond_size < RESPOND_SIZE) |
@@ -1493,11 +1493,11 @@ static int ftdi_elan_read_pcimem(struct usb_ftdi *ftdi, int mem_offset, | |||
1493 | ftdi->command_next += 1; | 1493 | ftdi->command_next += 1; |
1494 | ftdi->respond_next += 1; | 1494 | ftdi->respond_next += 1; |
1495 | ftdi_elan_kick_command_queue(ftdi); | 1495 | ftdi_elan_kick_command_queue(ftdi); |
1496 | up(&ftdi->u132_lock); | 1496 | mutex_unlock(&ftdi->u132_lock); |
1497 | wait_for_completion(&respond->wait_completion); | 1497 | wait_for_completion(&respond->wait_completion); |
1498 | return result; | 1498 | return result; |
1499 | } else { | 1499 | } else { |
1500 | up(&ftdi->u132_lock); | 1500 | mutex_unlock(&ftdi->u132_lock); |
1501 | msleep(100); | 1501 | msleep(100); |
1502 | goto wait; | 1502 | goto wait; |
1503 | } | 1503 | } |
@@ -1529,7 +1529,7 @@ static int ftdi_elan_edset_setup(struct usb_ftdi *ftdi, u8 ed_number, | |||
1529 | return -ENODEV; | 1529 | return -ENODEV; |
1530 | } else { | 1530 | } else { |
1531 | int command_size; | 1531 | int command_size; |
1532 | down(&ftdi->u132_lock); | 1532 | mutex_lock(&ftdi->u132_lock); |
1533 | command_size = ftdi->command_next - ftdi->command_head; | 1533 | command_size = ftdi->command_next - ftdi->command_head; |
1534 | if (command_size < COMMAND_SIZE) { | 1534 | if (command_size < COMMAND_SIZE) { |
1535 | struct u132_target *target = &ftdi->target[ed]; | 1535 | struct u132_target *target = &ftdi->target[ed]; |
@@ -1550,10 +1550,10 @@ static int ftdi_elan_edset_setup(struct usb_ftdi *ftdi, u8 ed_number, | |||
1550 | target->active = 1; | 1550 | target->active = 1; |
1551 | ftdi->command_next += 1; | 1551 | ftdi->command_next += 1; |
1552 | ftdi_elan_kick_command_queue(ftdi); | 1552 | ftdi_elan_kick_command_queue(ftdi); |
1553 | up(&ftdi->u132_lock); | 1553 | mutex_unlock(&ftdi->u132_lock); |
1554 | return 0; | 1554 | return 0; |
1555 | } else { | 1555 | } else { |
1556 | up(&ftdi->u132_lock); | 1556 | mutex_unlock(&ftdi->u132_lock); |
1557 | msleep(100); | 1557 | msleep(100); |
1558 | goto wait; | 1558 | goto wait; |
1559 | } | 1559 | } |
@@ -1586,7 +1586,7 @@ static int ftdi_elan_edset_input(struct usb_ftdi *ftdi, u8 ed_number, | |||
1586 | return -ENODEV; | 1586 | return -ENODEV; |
1587 | } else { | 1587 | } else { |
1588 | int command_size; | 1588 | int command_size; |
1589 | down(&ftdi->u132_lock); | 1589 | mutex_lock(&ftdi->u132_lock); |
1590 | command_size = ftdi->command_next - ftdi->command_head; | 1590 | command_size = ftdi->command_next - ftdi->command_head; |
1591 | if (command_size < COMMAND_SIZE) { | 1591 | if (command_size < COMMAND_SIZE) { |
1592 | struct u132_target *target = &ftdi->target[ed]; | 1592 | struct u132_target *target = &ftdi->target[ed]; |
@@ -1615,10 +1615,10 @@ static int ftdi_elan_edset_input(struct usb_ftdi *ftdi, u8 ed_number, | |||
1615 | target->active = 1; | 1615 | target->active = 1; |
1616 | ftdi->command_next += 1; | 1616 | ftdi->command_next += 1; |
1617 | ftdi_elan_kick_command_queue(ftdi); | 1617 | ftdi_elan_kick_command_queue(ftdi); |
1618 | up(&ftdi->u132_lock); | 1618 | mutex_unlock(&ftdi->u132_lock); |
1619 | return 0; | 1619 | return 0; |
1620 | } else { | 1620 | } else { |
1621 | up(&ftdi->u132_lock); | 1621 | mutex_unlock(&ftdi->u132_lock); |
1622 | msleep(100); | 1622 | msleep(100); |
1623 | goto wait; | 1623 | goto wait; |
1624 | } | 1624 | } |
@@ -1651,7 +1651,7 @@ static int ftdi_elan_edset_empty(struct usb_ftdi *ftdi, u8 ed_number, | |||
1651 | return -ENODEV; | 1651 | return -ENODEV; |
1652 | } else { | 1652 | } else { |
1653 | int command_size; | 1653 | int command_size; |
1654 | down(&ftdi->u132_lock); | 1654 | mutex_lock(&ftdi->u132_lock); |
1655 | command_size = ftdi->command_next - ftdi->command_head; | 1655 | command_size = ftdi->command_next - ftdi->command_head; |
1656 | if (command_size < COMMAND_SIZE) { | 1656 | if (command_size < COMMAND_SIZE) { |
1657 | struct u132_target *target = &ftdi->target[ed]; | 1657 | struct u132_target *target = &ftdi->target[ed]; |
@@ -1672,10 +1672,10 @@ static int ftdi_elan_edset_empty(struct usb_ftdi *ftdi, u8 ed_number, | |||
1672 | target->active = 1; | 1672 | target->active = 1; |
1673 | ftdi->command_next += 1; | 1673 | ftdi->command_next += 1; |
1674 | ftdi_elan_kick_command_queue(ftdi); | 1674 | ftdi_elan_kick_command_queue(ftdi); |
1675 | up(&ftdi->u132_lock); | 1675 | mutex_unlock(&ftdi->u132_lock); |
1676 | return 0; | 1676 | return 0; |
1677 | } else { | 1677 | } else { |
1678 | up(&ftdi->u132_lock); | 1678 | mutex_unlock(&ftdi->u132_lock); |
1679 | msleep(100); | 1679 | msleep(100); |
1680 | goto wait; | 1680 | goto wait; |
1681 | } | 1681 | } |
@@ -1708,7 +1708,7 @@ static int ftdi_elan_edset_output(struct usb_ftdi *ftdi, u8 ed_number, | |||
1708 | return -ENODEV; | 1708 | return -ENODEV; |
1709 | } else { | 1709 | } else { |
1710 | int command_size; | 1710 | int command_size; |
1711 | down(&ftdi->u132_lock); | 1711 | mutex_lock(&ftdi->u132_lock); |
1712 | command_size = ftdi->command_next - ftdi->command_head; | 1712 | command_size = ftdi->command_next - ftdi->command_head; |
1713 | if (command_size < COMMAND_SIZE) { | 1713 | if (command_size < COMMAND_SIZE) { |
1714 | u8 *b; | 1714 | u8 *b; |
@@ -1751,10 +1751,10 @@ static int ftdi_elan_edset_output(struct usb_ftdi *ftdi, u8 ed_number, | |||
1751 | target->active = 1; | 1751 | target->active = 1; |
1752 | ftdi->command_next += 1; | 1752 | ftdi->command_next += 1; |
1753 | ftdi_elan_kick_command_queue(ftdi); | 1753 | ftdi_elan_kick_command_queue(ftdi); |
1754 | up(&ftdi->u132_lock); | 1754 | mutex_unlock(&ftdi->u132_lock); |
1755 | return 0; | 1755 | return 0; |
1756 | } else { | 1756 | } else { |
1757 | up(&ftdi->u132_lock); | 1757 | mutex_unlock(&ftdi->u132_lock); |
1758 | msleep(100); | 1758 | msleep(100); |
1759 | goto wait; | 1759 | goto wait; |
1760 | } | 1760 | } |
@@ -1787,7 +1787,7 @@ static int ftdi_elan_edset_single(struct usb_ftdi *ftdi, u8 ed_number, | |||
1787 | return -ENODEV; | 1787 | return -ENODEV; |
1788 | } else { | 1788 | } else { |
1789 | int command_size; | 1789 | int command_size; |
1790 | down(&ftdi->u132_lock); | 1790 | mutex_lock(&ftdi->u132_lock); |
1791 | command_size = ftdi->command_next - ftdi->command_head; | 1791 | command_size = ftdi->command_next - ftdi->command_head; |
1792 | if (command_size < COMMAND_SIZE) { | 1792 | if (command_size < COMMAND_SIZE) { |
1793 | int remaining_length = urb->transfer_buffer_length - | 1793 | int remaining_length = urb->transfer_buffer_length - |
@@ -1816,10 +1816,10 @@ static int ftdi_elan_edset_single(struct usb_ftdi *ftdi, u8 ed_number, | |||
1816 | target->active = 1; | 1816 | target->active = 1; |
1817 | ftdi->command_next += 1; | 1817 | ftdi->command_next += 1; |
1818 | ftdi_elan_kick_command_queue(ftdi); | 1818 | ftdi_elan_kick_command_queue(ftdi); |
1819 | up(&ftdi->u132_lock); | 1819 | mutex_unlock(&ftdi->u132_lock); |
1820 | return 0; | 1820 | return 0; |
1821 | } else { | 1821 | } else { |
1822 | up(&ftdi->u132_lock); | 1822 | mutex_unlock(&ftdi->u132_lock); |
1823 | msleep(100); | 1823 | msleep(100); |
1824 | goto wait; | 1824 | goto wait; |
1825 | } | 1825 | } |
@@ -1849,9 +1849,9 @@ static int ftdi_elan_edset_flush(struct usb_ftdi *ftdi, u8 ed_number, | |||
1849 | return -ENODEV; | 1849 | return -ENODEV; |
1850 | } else { | 1850 | } else { |
1851 | struct u132_target *target = &ftdi->target[ed]; | 1851 | struct u132_target *target = &ftdi->target[ed]; |
1852 | down(&ftdi->u132_lock); | 1852 | mutex_lock(&ftdi->u132_lock); |
1853 | if (target->abandoning > 0) { | 1853 | if (target->abandoning > 0) { |
1854 | up(&ftdi->u132_lock); | 1854 | mutex_unlock(&ftdi->u132_lock); |
1855 | return 0; | 1855 | return 0; |
1856 | } else { | 1856 | } else { |
1857 | target->abandoning = 1; | 1857 | target->abandoning = 1; |
@@ -1873,13 +1873,13 @@ static int ftdi_elan_edset_flush(struct usb_ftdi *ftdi, u8 ed_number, | |||
1873 | ftdi->command_next += 1; | 1873 | ftdi->command_next += 1; |
1874 | ftdi_elan_kick_command_queue(ftdi); | 1874 | ftdi_elan_kick_command_queue(ftdi); |
1875 | } else { | 1875 | } else { |
1876 | up(&ftdi->u132_lock); | 1876 | mutex_unlock(&ftdi->u132_lock); |
1877 | msleep(100); | 1877 | msleep(100); |
1878 | down(&ftdi->u132_lock); | 1878 | mutex_lock(&ftdi->u132_lock); |
1879 | goto wait_1; | 1879 | goto wait_1; |
1880 | } | 1880 | } |
1881 | } | 1881 | } |
1882 | up(&ftdi->u132_lock); | 1882 | mutex_unlock(&ftdi->u132_lock); |
1883 | return 0; | 1883 | return 0; |
1884 | } | 1884 | } |
1885 | } | 1885 | } |
@@ -2793,7 +2793,7 @@ static int ftdi_elan_probe(struct usb_interface *interface, | |||
2793 | init_MUTEX(&ftdi->sw_lock); | 2793 | init_MUTEX(&ftdi->sw_lock); |
2794 | ftdi->udev = usb_get_dev(interface_to_usbdev(interface)); | 2794 | ftdi->udev = usb_get_dev(interface_to_usbdev(interface)); |
2795 | ftdi->interface = interface; | 2795 | ftdi->interface = interface; |
2796 | init_MUTEX(&ftdi->u132_lock); | 2796 | mutex_init(&ftdi->u132_lock); |
2797 | ftdi->expected = 4; | 2797 | ftdi->expected = 4; |
2798 | iface_desc = interface->cur_altsetting; | 2798 | iface_desc = interface->cur_altsetting; |
2799 | for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) { | 2799 | for (i = 0; i < iface_desc->desc.bNumEndpoints; ++i) { |