aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorDaniel Walker <dwalker@mvista.com>2008-03-23 03:00:02 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2008-04-25 00:16:45 -0400
commit50d8ca9b5624bf50cc3ff624fe9ababf0c789bd2 (patch)
tree5e7aee1c7d0bbd1147e61f0bfb431987425c91da /drivers/usb
parentb40f8d3980d3eef26b3bd77da5314728a5b30aea (diff)
usb: u132-hcd driver: semaphore to mutex
Signed-off-by: Daniel Walker <dwalker@mvista.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/host/u132-hcd.c220
1 files changed, 110 insertions, 110 deletions
diff --git a/drivers/usb/host/u132-hcd.c b/drivers/usb/host/u132-hcd.c
index 28b8684942d3..4616a880d89c 100644
--- a/drivers/usb/host/u132-hcd.c
+++ b/drivers/usb/host/u132-hcd.c
@@ -184,7 +184,7 @@ struct u132 {
184 struct kref kref; 184 struct kref kref;
185 struct list_head u132_list; 185 struct list_head u132_list;
186 struct mutex sw_lock; 186 struct mutex sw_lock;
187 struct semaphore scheduler_lock; 187 struct mutex scheduler_lock;
188 struct u132_platform_data *board; 188 struct u132_platform_data *board;
189 struct platform_device *platform_dev; 189 struct platform_device *platform_dev;
190 struct u132_ring ring[MAX_U132_RINGS]; 190 struct u132_ring ring[MAX_U132_RINGS];
@@ -535,12 +535,12 @@ static void u132_hcd_giveback_urb(struct u132 *u132, struct u132_endp *endp,
535 spin_unlock_irqrestore(&endp->queue_lock.slock, irqs); 535 spin_unlock_irqrestore(&endp->queue_lock.slock, irqs);
536 kfree(urbq); 536 kfree(urbq);
537 } 537 }
538 down(&u132->scheduler_lock); 538 mutex_lock(&u132->scheduler_lock);
539 ring = endp->ring; 539 ring = endp->ring;
540 ring->in_use = 0; 540 ring->in_use = 0;
541 u132_ring_cancel_work(u132, ring); 541 u132_ring_cancel_work(u132, ring);
542 u132_ring_queue_work(u132, ring, 0); 542 u132_ring_queue_work(u132, ring, 0);
543 up(&u132->scheduler_lock); 543 mutex_unlock(&u132->scheduler_lock);
544 u132_endp_put_kref(u132, endp); 544 u132_endp_put_kref(u132, endp);
545 usb_hcd_giveback_urb(hcd, urb, status); 545 usb_hcd_giveback_urb(hcd, urb, status);
546 return; 546 return;
@@ -631,22 +631,22 @@ static void u132_hcd_interrupt_recv(void *data, struct urb *urb, u8 *buf,
631 struct u132 *u132 = endp->u132; 631 struct u132 *u132 = endp->u132;
632 u8 address = u132->addr[endp->usb_addr].address; 632 u8 address = u132->addr[endp->usb_addr].address;
633 struct u132_udev *udev = &u132->udev[address]; 633 struct u132_udev *udev = &u132->udev[address];
634 down(&u132->scheduler_lock); 634 mutex_lock(&u132->scheduler_lock);
635 if (u132->going > 1) { 635 if (u132->going > 1) {
636 dev_err(&u132->platform_dev->dev, "device has been removed %d\n" 636 dev_err(&u132->platform_dev->dev, "device has been removed %d\n"
637 , u132->going); 637 , u132->going);
638 up(&u132->scheduler_lock); 638 mutex_unlock(&u132->scheduler_lock);
639 u132_hcd_forget_urb(u132, endp, urb, -ENODEV); 639 u132_hcd_forget_urb(u132, endp, urb, -ENODEV);
640 return; 640 return;
641 } else if (endp->dequeueing) { 641 } else if (endp->dequeueing) {
642 endp->dequeueing = 0; 642 endp->dequeueing = 0;
643 up(&u132->scheduler_lock); 643 mutex_unlock(&u132->scheduler_lock);
644 u132_hcd_giveback_urb(u132, endp, urb, -EINTR); 644 u132_hcd_giveback_urb(u132, endp, urb, -EINTR);
645 return; 645 return;
646 } else if (u132->going > 0) { 646 } else if (u132->going > 0) {
647 dev_err(&u132->platform_dev->dev, "device is being removed " 647 dev_err(&u132->platform_dev->dev, "device is being removed "
648 "urb=%p\n", urb); 648 "urb=%p\n", urb);
649 up(&u132->scheduler_lock); 649 mutex_unlock(&u132->scheduler_lock);
650 u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); 650 u132_hcd_giveback_urb(u132, endp, urb, -ENODEV);
651 return; 651 return;
652 } else if (!urb->unlinked) { 652 } else if (!urb->unlinked) {
@@ -666,7 +666,7 @@ static void u132_hcd_interrupt_recv(void *data, struct urb *urb, u8 *buf,
666 1 & toggle_bits); 666 1 & toggle_bits);
667 if (urb->actual_length > 0) { 667 if (urb->actual_length > 0) {
668 int retval; 668 int retval;
669 up(&u132->scheduler_lock); 669 mutex_unlock(&u132->scheduler_lock);
670 retval = edset_single(u132, ring, endp, urb, 670 retval = edset_single(u132, ring, endp, urb,
671 address, endp->toggle_bits, 671 address, endp->toggle_bits,
672 u132_hcd_interrupt_recv); 672 u132_hcd_interrupt_recv);
@@ -680,7 +680,7 @@ static void u132_hcd_interrupt_recv(void *data, struct urb *urb, u8 *buf,
680 msecs_to_jiffies(urb->interval); 680 msecs_to_jiffies(urb->interval);
681 u132_ring_cancel_work(u132, ring); 681 u132_ring_cancel_work(u132, ring);
682 u132_ring_queue_work(u132, ring, 0); 682 u132_ring_queue_work(u132, ring, 0);
683 up(&u132->scheduler_lock); 683 mutex_unlock(&u132->scheduler_lock);
684 u132_endp_put_kref(u132, endp); 684 u132_endp_put_kref(u132, endp);
685 } 685 }
686 return; 686 return;
@@ -689,7 +689,7 @@ static void u132_hcd_interrupt_recv(void *data, struct urb *urb, u8 *buf,
689 endp->toggle_bits = toggle_bits; 689 endp->toggle_bits = toggle_bits;
690 usb_settoggle(udev->usb_device, endp->usb_endp, 0, 690 usb_settoggle(udev->usb_device, endp->usb_endp, 0,
691 1 & toggle_bits); 691 1 & toggle_bits);
692 up(&u132->scheduler_lock); 692 mutex_unlock(&u132->scheduler_lock);
693 u132_hcd_giveback_urb(u132, endp, urb, 0); 693 u132_hcd_giveback_urb(u132, endp, urb, 0);
694 return; 694 return;
695 } else { 695 } else {
@@ -709,7 +709,7 @@ static void u132_hcd_interrupt_recv(void *data, struct urb *urb, u8 *buf,
709 "g back INTERRUPT %s\n", urb, 709 "g back INTERRUPT %s\n", urb,
710 cc_to_text[condition_code]); 710 cc_to_text[condition_code]);
711 } 711 }
712 up(&u132->scheduler_lock); 712 mutex_unlock(&u132->scheduler_lock);
713 u132_hcd_giveback_urb(u132, endp, urb, 713 u132_hcd_giveback_urb(u132, endp, urb,
714 cc_to_error[condition_code]); 714 cc_to_error[condition_code]);
715 return; 715 return;
@@ -717,7 +717,7 @@ static void u132_hcd_interrupt_recv(void *data, struct urb *urb, u8 *buf,
717 } else { 717 } else {
718 dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p " 718 dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p "
719 "unlinked=%d\n", urb, urb->unlinked); 719 "unlinked=%d\n", urb, urb->unlinked);
720 up(&u132->scheduler_lock); 720 mutex_unlock(&u132->scheduler_lock);
721 u132_hcd_giveback_urb(u132, endp, urb, 0); 721 u132_hcd_giveback_urb(u132, endp, urb, 0);
722 return; 722 return;
723 } 723 }
@@ -730,22 +730,22 @@ static void u132_hcd_bulk_output_sent(void *data, struct urb *urb, u8 *buf,
730 struct u132_endp *endp = data; 730 struct u132_endp *endp = data;
731 struct u132 *u132 = endp->u132; 731 struct u132 *u132 = endp->u132;
732 u8 address = u132->addr[endp->usb_addr].address; 732 u8 address = u132->addr[endp->usb_addr].address;
733 down(&u132->scheduler_lock); 733 mutex_lock(&u132->scheduler_lock);
734 if (u132->going > 1) { 734 if (u132->going > 1) {
735 dev_err(&u132->platform_dev->dev, "device has been removed %d\n" 735 dev_err(&u132->platform_dev->dev, "device has been removed %d\n"
736 , u132->going); 736 , u132->going);
737 up(&u132->scheduler_lock); 737 mutex_unlock(&u132->scheduler_lock);
738 u132_hcd_forget_urb(u132, endp, urb, -ENODEV); 738 u132_hcd_forget_urb(u132, endp, urb, -ENODEV);
739 return; 739 return;
740 } else if (endp->dequeueing) { 740 } else if (endp->dequeueing) {
741 endp->dequeueing = 0; 741 endp->dequeueing = 0;
742 up(&u132->scheduler_lock); 742 mutex_unlock(&u132->scheduler_lock);
743 u132_hcd_giveback_urb(u132, endp, urb, -EINTR); 743 u132_hcd_giveback_urb(u132, endp, urb, -EINTR);
744 return; 744 return;
745 } else if (u132->going > 0) { 745 } else if (u132->going > 0) {
746 dev_err(&u132->platform_dev->dev, "device is being removed " 746 dev_err(&u132->platform_dev->dev, "device is being removed "
747 "urb=%p\n", urb); 747 "urb=%p\n", urb);
748 up(&u132->scheduler_lock); 748 mutex_unlock(&u132->scheduler_lock);
749 u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); 749 u132_hcd_giveback_urb(u132, endp, urb, -ENODEV);
750 return; 750 return;
751 } else if (!urb->unlinked) { 751 } else if (!urb->unlinked) {
@@ -754,21 +754,21 @@ static void u132_hcd_bulk_output_sent(void *data, struct urb *urb, u8 *buf,
754 endp->toggle_bits = toggle_bits; 754 endp->toggle_bits = toggle_bits;
755 if (urb->transfer_buffer_length > urb->actual_length) { 755 if (urb->transfer_buffer_length > urb->actual_length) {
756 int retval; 756 int retval;
757 up(&u132->scheduler_lock); 757 mutex_unlock(&u132->scheduler_lock);
758 retval = edset_output(u132, ring, endp, urb, address, 758 retval = edset_output(u132, ring, endp, urb, address,
759 endp->toggle_bits, u132_hcd_bulk_output_sent); 759 endp->toggle_bits, u132_hcd_bulk_output_sent);
760 if (retval != 0) 760 if (retval != 0)
761 u132_hcd_giveback_urb(u132, endp, urb, retval); 761 u132_hcd_giveback_urb(u132, endp, urb, retval);
762 return; 762 return;
763 } else { 763 } else {
764 up(&u132->scheduler_lock); 764 mutex_unlock(&u132->scheduler_lock);
765 u132_hcd_giveback_urb(u132, endp, urb, 0); 765 u132_hcd_giveback_urb(u132, endp, urb, 0);
766 return; 766 return;
767 } 767 }
768 } else { 768 } else {
769 dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p " 769 dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p "
770 "unlinked=%d\n", urb, urb->unlinked); 770 "unlinked=%d\n", urb, urb->unlinked);
771 up(&u132->scheduler_lock); 771 mutex_unlock(&u132->scheduler_lock);
772 u132_hcd_giveback_urb(u132, endp, urb, 0); 772 u132_hcd_giveback_urb(u132, endp, urb, 0);
773 return; 773 return;
774 } 774 }
@@ -782,22 +782,22 @@ static void u132_hcd_bulk_input_recv(void *data, struct urb *urb, u8 *buf,
782 struct u132 *u132 = endp->u132; 782 struct u132 *u132 = endp->u132;
783 u8 address = u132->addr[endp->usb_addr].address; 783 u8 address = u132->addr[endp->usb_addr].address;
784 struct u132_udev *udev = &u132->udev[address]; 784 struct u132_udev *udev = &u132->udev[address];
785 down(&u132->scheduler_lock); 785 mutex_lock(&u132->scheduler_lock);
786 if (u132->going > 1) { 786 if (u132->going > 1) {
787 dev_err(&u132->platform_dev->dev, "device has been removed %d\n" 787 dev_err(&u132->platform_dev->dev, "device has been removed %d\n"
788 , u132->going); 788 , u132->going);
789 up(&u132->scheduler_lock); 789 mutex_unlock(&u132->scheduler_lock);
790 u132_hcd_forget_urb(u132, endp, urb, -ENODEV); 790 u132_hcd_forget_urb(u132, endp, urb, -ENODEV);
791 return; 791 return;
792 } else if (endp->dequeueing) { 792 } else if (endp->dequeueing) {
793 endp->dequeueing = 0; 793 endp->dequeueing = 0;
794 up(&u132->scheduler_lock); 794 mutex_unlock(&u132->scheduler_lock);
795 u132_hcd_giveback_urb(u132, endp, urb, -EINTR); 795 u132_hcd_giveback_urb(u132, endp, urb, -EINTR);
796 return; 796 return;
797 } else if (u132->going > 0) { 797 } else if (u132->going > 0) {
798 dev_err(&u132->platform_dev->dev, "device is being removed " 798 dev_err(&u132->platform_dev->dev, "device is being removed "
799 "urb=%p\n", urb); 799 "urb=%p\n", urb);
800 up(&u132->scheduler_lock); 800 mutex_unlock(&u132->scheduler_lock);
801 u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); 801 u132_hcd_giveback_urb(u132, endp, urb, -ENODEV);
802 return; 802 return;
803 } else if (!urb->unlinked) { 803 } else if (!urb->unlinked) {
@@ -816,7 +816,7 @@ static void u132_hcd_bulk_input_recv(void *data, struct urb *urb, u8 *buf,
816 endp->toggle_bits = toggle_bits; 816 endp->toggle_bits = toggle_bits;
817 usb_settoggle(udev->usb_device, endp->usb_endp, 0, 817 usb_settoggle(udev->usb_device, endp->usb_endp, 0,
818 1 & toggle_bits); 818 1 & toggle_bits);
819 up(&u132->scheduler_lock); 819 mutex_unlock(&u132->scheduler_lock);
820 retval = usb_ftdi_elan_edset_input(u132->platform_dev, 820 retval = usb_ftdi_elan_edset_input(u132->platform_dev,
821 ring->number, endp, urb, address, 821 ring->number, endp, urb, address,
822 endp->usb_endp, endp->toggle_bits, 822 endp->usb_endp, endp->toggle_bits,
@@ -828,7 +828,7 @@ static void u132_hcd_bulk_input_recv(void *data, struct urb *urb, u8 *buf,
828 endp->toggle_bits = toggle_bits; 828 endp->toggle_bits = toggle_bits;
829 usb_settoggle(udev->usb_device, endp->usb_endp, 0, 829 usb_settoggle(udev->usb_device, endp->usb_endp, 0,
830 1 & toggle_bits); 830 1 & toggle_bits);
831 up(&u132->scheduler_lock); 831 mutex_unlock(&u132->scheduler_lock);
832 u132_hcd_giveback_urb(u132, endp, urb, 832 u132_hcd_giveback_urb(u132, endp, urb,
833 cc_to_error[condition_code]); 833 cc_to_error[condition_code]);
834 return; 834 return;
@@ -837,7 +837,7 @@ static void u132_hcd_bulk_input_recv(void *data, struct urb *urb, u8 *buf,
837 endp->toggle_bits = toggle_bits; 837 endp->toggle_bits = toggle_bits;
838 usb_settoggle(udev->usb_device, endp->usb_endp, 0, 838 usb_settoggle(udev->usb_device, endp->usb_endp, 0,
839 1 & toggle_bits); 839 1 & toggle_bits);
840 up(&u132->scheduler_lock); 840 mutex_unlock(&u132->scheduler_lock);
841 u132_hcd_giveback_urb(u132, endp, urb, 0); 841 u132_hcd_giveback_urb(u132, endp, urb, 0);
842 return; 842 return;
843 } else if (condition_code == TD_DATAUNDERRUN) { 843 } else if (condition_code == TD_DATAUNDERRUN) {
@@ -847,13 +847,13 @@ static void u132_hcd_bulk_input_recv(void *data, struct urb *urb, u8 *buf,
847 dev_warn(&u132->platform_dev->dev, "urb=%p(SHORT NOT OK" 847 dev_warn(&u132->platform_dev->dev, "urb=%p(SHORT NOT OK"
848 ") giving back BULK IN %s\n", urb, 848 ") giving back BULK IN %s\n", urb,
849 cc_to_text[condition_code]); 849 cc_to_text[condition_code]);
850 up(&u132->scheduler_lock); 850 mutex_unlock(&u132->scheduler_lock);
851 u132_hcd_giveback_urb(u132, endp, urb, 0); 851 u132_hcd_giveback_urb(u132, endp, urb, 0);
852 return; 852 return;
853 } else if (condition_code == TD_CC_STALL) { 853 } else if (condition_code == TD_CC_STALL) {
854 endp->toggle_bits = 0x2; 854 endp->toggle_bits = 0x2;
855 usb_settoggle(udev->usb_device, endp->usb_endp, 0, 0); 855 usb_settoggle(udev->usb_device, endp->usb_endp, 0, 0);
856 up(&u132->scheduler_lock); 856 mutex_unlock(&u132->scheduler_lock);
857 u132_hcd_giveback_urb(u132, endp, urb, 857 u132_hcd_giveback_urb(u132, endp, urb,
858 cc_to_error[condition_code]); 858 cc_to_error[condition_code]);
859 return; 859 return;
@@ -863,7 +863,7 @@ static void u132_hcd_bulk_input_recv(void *data, struct urb *urb, u8 *buf,
863 dev_err(&u132->platform_dev->dev, "urb=%p giving back B" 863 dev_err(&u132->platform_dev->dev, "urb=%p giving back B"
864 "ULK IN code=%d %s\n", urb, condition_code, 864 "ULK IN code=%d %s\n", urb, condition_code,
865 cc_to_text[condition_code]); 865 cc_to_text[condition_code]);
866 up(&u132->scheduler_lock); 866 mutex_unlock(&u132->scheduler_lock);
867 u132_hcd_giveback_urb(u132, endp, urb, 867 u132_hcd_giveback_urb(u132, endp, urb,
868 cc_to_error[condition_code]); 868 cc_to_error[condition_code]);
869 return; 869 return;
@@ -871,7 +871,7 @@ static void u132_hcd_bulk_input_recv(void *data, struct urb *urb, u8 *buf,
871 } else { 871 } else {
872 dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p " 872 dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p "
873 "unlinked=%d\n", urb, urb->unlinked); 873 "unlinked=%d\n", urb, urb->unlinked);
874 up(&u132->scheduler_lock); 874 mutex_unlock(&u132->scheduler_lock);
875 u132_hcd_giveback_urb(u132, endp, urb, 0); 875 u132_hcd_giveback_urb(u132, endp, urb, 0);
876 return; 876 return;
877 } 877 }
@@ -883,32 +883,32 @@ static void u132_hcd_configure_empty_sent(void *data, struct urb *urb, u8 *buf,
883{ 883{
884 struct u132_endp *endp = data; 884 struct u132_endp *endp = data;
885 struct u132 *u132 = endp->u132; 885 struct u132 *u132 = endp->u132;
886 down(&u132->scheduler_lock); 886 mutex_lock(&u132->scheduler_lock);
887 if (u132->going > 1) { 887 if (u132->going > 1) {
888 dev_err(&u132->platform_dev->dev, "device has been removed %d\n" 888 dev_err(&u132->platform_dev->dev, "device has been removed %d\n"
889 , u132->going); 889 , u132->going);
890 up(&u132->scheduler_lock); 890 mutex_unlock(&u132->scheduler_lock);
891 u132_hcd_forget_urb(u132, endp, urb, -ENODEV); 891 u132_hcd_forget_urb(u132, endp, urb, -ENODEV);
892 return; 892 return;
893 } else if (endp->dequeueing) { 893 } else if (endp->dequeueing) {
894 endp->dequeueing = 0; 894 endp->dequeueing = 0;
895 up(&u132->scheduler_lock); 895 mutex_unlock(&u132->scheduler_lock);
896 u132_hcd_giveback_urb(u132, endp, urb, -EINTR); 896 u132_hcd_giveback_urb(u132, endp, urb, -EINTR);
897 return; 897 return;
898 } else if (u132->going > 0) { 898 } else if (u132->going > 0) {
899 dev_err(&u132->platform_dev->dev, "device is being removed " 899 dev_err(&u132->platform_dev->dev, "device is being removed "
900 "urb=%p\n", urb); 900 "urb=%p\n", urb);
901 up(&u132->scheduler_lock); 901 mutex_unlock(&u132->scheduler_lock);
902 u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); 902 u132_hcd_giveback_urb(u132, endp, urb, -ENODEV);
903 return; 903 return;
904 } else if (!urb->unlinked) { 904 } else if (!urb->unlinked) {
905 up(&u132->scheduler_lock); 905 mutex_unlock(&u132->scheduler_lock);
906 u132_hcd_giveback_urb(u132, endp, urb, 0); 906 u132_hcd_giveback_urb(u132, endp, urb, 0);
907 return; 907 return;
908 } else { 908 } else {
909 dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p " 909 dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p "
910 "unlinked=%d\n", urb, urb->unlinked); 910 "unlinked=%d\n", urb, urb->unlinked);
911 up(&u132->scheduler_lock); 911 mutex_unlock(&u132->scheduler_lock);
912 u132_hcd_giveback_urb(u132, endp, urb, 0); 912 u132_hcd_giveback_urb(u132, endp, urb, 0);
913 return; 913 return;
914 } 914 }
@@ -921,22 +921,22 @@ static void u132_hcd_configure_input_recv(void *data, struct urb *urb, u8 *buf,
921 struct u132_endp *endp = data; 921 struct u132_endp *endp = data;
922 struct u132 *u132 = endp->u132; 922 struct u132 *u132 = endp->u132;
923 u8 address = u132->addr[endp->usb_addr].address; 923 u8 address = u132->addr[endp->usb_addr].address;
924 down(&u132->scheduler_lock); 924 mutex_lock(&u132->scheduler_lock);
925 if (u132->going > 1) { 925 if (u132->going > 1) {
926 dev_err(&u132->platform_dev->dev, "device has been removed %d\n" 926 dev_err(&u132->platform_dev->dev, "device has been removed %d\n"
927 , u132->going); 927 , u132->going);
928 up(&u132->scheduler_lock); 928 mutex_unlock(&u132->scheduler_lock);
929 u132_hcd_forget_urb(u132, endp, urb, -ENODEV); 929 u132_hcd_forget_urb(u132, endp, urb, -ENODEV);
930 return; 930 return;
931 } else if (endp->dequeueing) { 931 } else if (endp->dequeueing) {
932 endp->dequeueing = 0; 932 endp->dequeueing = 0;
933 up(&u132->scheduler_lock); 933 mutex_unlock(&u132->scheduler_lock);
934 u132_hcd_giveback_urb(u132, endp, urb, -EINTR); 934 u132_hcd_giveback_urb(u132, endp, urb, -EINTR);
935 return; 935 return;
936 } else if (u132->going > 0) { 936 } else if (u132->going > 0) {
937 dev_err(&u132->platform_dev->dev, "device is being removed " 937 dev_err(&u132->platform_dev->dev, "device is being removed "
938 "urb=%p\n", urb); 938 "urb=%p\n", urb);
939 up(&u132->scheduler_lock); 939 mutex_unlock(&u132->scheduler_lock);
940 u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); 940 u132_hcd_giveback_urb(u132, endp, urb, -ENODEV);
941 return; 941 return;
942 } else if (!urb->unlinked) { 942 } else if (!urb->unlinked) {
@@ -953,7 +953,7 @@ static void u132_hcd_configure_input_recv(void *data, struct urb *urb, u8 *buf,
953 TD_DATAUNDERRUN) && ((urb->transfer_flags & 953 TD_DATAUNDERRUN) && ((urb->transfer_flags &
954 URB_SHORT_NOT_OK) == 0))) { 954 URB_SHORT_NOT_OK) == 0))) {
955 int retval; 955 int retval;
956 up(&u132->scheduler_lock); 956 mutex_unlock(&u132->scheduler_lock);
957 retval = usb_ftdi_elan_edset_empty(u132->platform_dev, 957 retval = usb_ftdi_elan_edset_empty(u132->platform_dev,
958 ring->number, endp, urb, address, 958 ring->number, endp, urb, address,
959 endp->usb_endp, 0x3, 959 endp->usb_endp, 0x3,
@@ -962,14 +962,14 @@ static void u132_hcd_configure_input_recv(void *data, struct urb *urb, u8 *buf,
962 u132_hcd_giveback_urb(u132, endp, urb, retval); 962 u132_hcd_giveback_urb(u132, endp, urb, retval);
963 return; 963 return;
964 } else if (condition_code == TD_CC_STALL) { 964 } else if (condition_code == TD_CC_STALL) {
965 up(&u132->scheduler_lock); 965 mutex_unlock(&u132->scheduler_lock);
966 dev_warn(&u132->platform_dev->dev, "giving back SETUP I" 966 dev_warn(&u132->platform_dev->dev, "giving back SETUP I"
967 "NPUT STALL urb %p\n", urb); 967 "NPUT STALL urb %p\n", urb);
968 u132_hcd_giveback_urb(u132, endp, urb, 968 u132_hcd_giveback_urb(u132, endp, urb,
969 cc_to_error[condition_code]); 969 cc_to_error[condition_code]);
970 return; 970 return;
971 } else { 971 } else {
972 up(&u132->scheduler_lock); 972 mutex_unlock(&u132->scheduler_lock);
973 dev_err(&u132->platform_dev->dev, "giving back SETUP IN" 973 dev_err(&u132->platform_dev->dev, "giving back SETUP IN"
974 "PUT %s urb %p\n", cc_to_text[condition_code], 974 "PUT %s urb %p\n", cc_to_text[condition_code],
975 urb); 975 urb);
@@ -980,7 +980,7 @@ static void u132_hcd_configure_input_recv(void *data, struct urb *urb, u8 *buf,
980 } else { 980 } else {
981 dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p " 981 dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p "
982 "unlinked=%d\n", urb, urb->unlinked); 982 "unlinked=%d\n", urb, urb->unlinked);
983 up(&u132->scheduler_lock); 983 mutex_unlock(&u132->scheduler_lock);
984 u132_hcd_giveback_urb(u132, endp, urb, 0); 984 u132_hcd_giveback_urb(u132, endp, urb, 0);
985 return; 985 return;
986 } 986 }
@@ -992,32 +992,32 @@ static void u132_hcd_configure_empty_recv(void *data, struct urb *urb, u8 *buf,
992{ 992{
993 struct u132_endp *endp = data; 993 struct u132_endp *endp = data;
994 struct u132 *u132 = endp->u132; 994 struct u132 *u132 = endp->u132;
995 down(&u132->scheduler_lock); 995 mutex_lock(&u132->scheduler_lock);
996 if (u132->going > 1) { 996 if (u132->going > 1) {
997 dev_err(&u132->platform_dev->dev, "device has been removed %d\n" 997 dev_err(&u132->platform_dev->dev, "device has been removed %d\n"
998 , u132->going); 998 , u132->going);
999 up(&u132->scheduler_lock); 999 mutex_unlock(&u132->scheduler_lock);
1000 u132_hcd_forget_urb(u132, endp, urb, -ENODEV); 1000 u132_hcd_forget_urb(u132, endp, urb, -ENODEV);
1001 return; 1001 return;
1002 } else if (endp->dequeueing) { 1002 } else if (endp->dequeueing) {
1003 endp->dequeueing = 0; 1003 endp->dequeueing = 0;
1004 up(&u132->scheduler_lock); 1004 mutex_unlock(&u132->scheduler_lock);
1005 u132_hcd_giveback_urb(u132, endp, urb, -EINTR); 1005 u132_hcd_giveback_urb(u132, endp, urb, -EINTR);
1006 return; 1006 return;
1007 } else if (u132->going > 0) { 1007 } else if (u132->going > 0) {
1008 dev_err(&u132->platform_dev->dev, "device is being removed " 1008 dev_err(&u132->platform_dev->dev, "device is being removed "
1009 "urb=%p\n", urb); 1009 "urb=%p\n", urb);
1010 up(&u132->scheduler_lock); 1010 mutex_unlock(&u132->scheduler_lock);
1011 u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); 1011 u132_hcd_giveback_urb(u132, endp, urb, -ENODEV);
1012 return; 1012 return;
1013 } else if (!urb->unlinked) { 1013 } else if (!urb->unlinked) {
1014 up(&u132->scheduler_lock); 1014 mutex_unlock(&u132->scheduler_lock);
1015 u132_hcd_giveback_urb(u132, endp, urb, 0); 1015 u132_hcd_giveback_urb(u132, endp, urb, 0);
1016 return; 1016 return;
1017 } else { 1017 } else {
1018 dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p " 1018 dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p "
1019 "unlinked=%d\n", urb, urb->unlinked); 1019 "unlinked=%d\n", urb, urb->unlinked);
1020 up(&u132->scheduler_lock); 1020 mutex_unlock(&u132->scheduler_lock);
1021 u132_hcd_giveback_urb(u132, endp, urb, 0); 1021 u132_hcd_giveback_urb(u132, endp, urb, 0);
1022 return; 1022 return;
1023 } 1023 }
@@ -1030,29 +1030,29 @@ static void u132_hcd_configure_setup_sent(void *data, struct urb *urb, u8 *buf,
1030 struct u132_endp *endp = data; 1030 struct u132_endp *endp = data;
1031 struct u132 *u132 = endp->u132; 1031 struct u132 *u132 = endp->u132;
1032 u8 address = u132->addr[endp->usb_addr].address; 1032 u8 address = u132->addr[endp->usb_addr].address;
1033 down(&u132->scheduler_lock); 1033 mutex_lock(&u132->scheduler_lock);
1034 if (u132->going > 1) { 1034 if (u132->going > 1) {
1035 dev_err(&u132->platform_dev->dev, "device has been removed %d\n" 1035 dev_err(&u132->platform_dev->dev, "device has been removed %d\n"
1036 , u132->going); 1036 , u132->going);
1037 up(&u132->scheduler_lock); 1037 mutex_unlock(&u132->scheduler_lock);
1038 u132_hcd_forget_urb(u132, endp, urb, -ENODEV); 1038 u132_hcd_forget_urb(u132, endp, urb, -ENODEV);
1039 return; 1039 return;
1040 } else if (endp->dequeueing) { 1040 } else if (endp->dequeueing) {
1041 endp->dequeueing = 0; 1041 endp->dequeueing = 0;
1042 up(&u132->scheduler_lock); 1042 mutex_unlock(&u132->scheduler_lock);
1043 u132_hcd_giveback_urb(u132, endp, urb, -EINTR); 1043 u132_hcd_giveback_urb(u132, endp, urb, -EINTR);
1044 return; 1044 return;
1045 } else if (u132->going > 0) { 1045 } else if (u132->going > 0) {
1046 dev_err(&u132->platform_dev->dev, "device is being removed " 1046 dev_err(&u132->platform_dev->dev, "device is being removed "
1047 "urb=%p\n", urb); 1047 "urb=%p\n", urb);
1048 up(&u132->scheduler_lock); 1048 mutex_unlock(&u132->scheduler_lock);
1049 u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); 1049 u132_hcd_giveback_urb(u132, endp, urb, -ENODEV);
1050 return; 1050 return;
1051 } else if (!urb->unlinked) { 1051 } else if (!urb->unlinked) {
1052 if (usb_pipein(urb->pipe)) { 1052 if (usb_pipein(urb->pipe)) {
1053 int retval; 1053 int retval;
1054 struct u132_ring *ring = endp->ring; 1054 struct u132_ring *ring = endp->ring;
1055 up(&u132->scheduler_lock); 1055 mutex_unlock(&u132->scheduler_lock);
1056 retval = usb_ftdi_elan_edset_input(u132->platform_dev, 1056 retval = usb_ftdi_elan_edset_input(u132->platform_dev,
1057 ring->number, endp, urb, address, 1057 ring->number, endp, urb, address,
1058 endp->usb_endp, 0, 1058 endp->usb_endp, 0,
@@ -1063,7 +1063,7 @@ static void u132_hcd_configure_setup_sent(void *data, struct urb *urb, u8 *buf,
1063 } else { 1063 } else {
1064 int retval; 1064 int retval;
1065 struct u132_ring *ring = endp->ring; 1065 struct u132_ring *ring = endp->ring;
1066 up(&u132->scheduler_lock); 1066 mutex_unlock(&u132->scheduler_lock);
1067 retval = usb_ftdi_elan_edset_input(u132->platform_dev, 1067 retval = usb_ftdi_elan_edset_input(u132->platform_dev,
1068 ring->number, endp, urb, address, 1068 ring->number, endp, urb, address,
1069 endp->usb_endp, 0, 1069 endp->usb_endp, 0,
@@ -1075,7 +1075,7 @@ static void u132_hcd_configure_setup_sent(void *data, struct urb *urb, u8 *buf,
1075 } else { 1075 } else {
1076 dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p " 1076 dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p "
1077 "unlinked=%d\n", urb, urb->unlinked); 1077 "unlinked=%d\n", urb, urb->unlinked);
1078 up(&u132->scheduler_lock); 1078 mutex_unlock(&u132->scheduler_lock);
1079 u132_hcd_giveback_urb(u132, endp, urb, 0); 1079 u132_hcd_giveback_urb(u132, endp, urb, 0);
1080 return; 1080 return;
1081 } 1081 }
@@ -1089,34 +1089,34 @@ static void u132_hcd_enumeration_empty_recv(void *data, struct urb *urb,
1089 struct u132 *u132 = endp->u132; 1089 struct u132 *u132 = endp->u132;
1090 u8 address = u132->addr[endp->usb_addr].address; 1090 u8 address = u132->addr[endp->usb_addr].address;
1091 struct u132_udev *udev = &u132->udev[address]; 1091 struct u132_udev *udev = &u132->udev[address];
1092 down(&u132->scheduler_lock); 1092 mutex_lock(&u132->scheduler_lock);
1093 if (u132->going > 1) { 1093 if (u132->going > 1) {
1094 dev_err(&u132->platform_dev->dev, "device has been removed %d\n" 1094 dev_err(&u132->platform_dev->dev, "device has been removed %d\n"
1095 , u132->going); 1095 , u132->going);
1096 up(&u132->scheduler_lock); 1096 mutex_unlock(&u132->scheduler_lock);
1097 u132_hcd_forget_urb(u132, endp, urb, -ENODEV); 1097 u132_hcd_forget_urb(u132, endp, urb, -ENODEV);
1098 return; 1098 return;
1099 } else if (endp->dequeueing) { 1099 } else if (endp->dequeueing) {
1100 endp->dequeueing = 0; 1100 endp->dequeueing = 0;
1101 up(&u132->scheduler_lock); 1101 mutex_unlock(&u132->scheduler_lock);
1102 u132_hcd_giveback_urb(u132, endp, urb, -EINTR); 1102 u132_hcd_giveback_urb(u132, endp, urb, -EINTR);
1103 return; 1103 return;
1104 } else if (u132->going > 0) { 1104 } else if (u132->going > 0) {
1105 dev_err(&u132->platform_dev->dev, "device is being removed " 1105 dev_err(&u132->platform_dev->dev, "device is being removed "
1106 "urb=%p\n", urb); 1106 "urb=%p\n", urb);
1107 up(&u132->scheduler_lock); 1107 mutex_unlock(&u132->scheduler_lock);
1108 u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); 1108 u132_hcd_giveback_urb(u132, endp, urb, -ENODEV);
1109 return; 1109 return;
1110 } else if (!urb->unlinked) { 1110 } else if (!urb->unlinked) {
1111 u132->addr[0].address = 0; 1111 u132->addr[0].address = 0;
1112 endp->usb_addr = udev->usb_addr; 1112 endp->usb_addr = udev->usb_addr;
1113 up(&u132->scheduler_lock); 1113 mutex_unlock(&u132->scheduler_lock);
1114 u132_hcd_giveback_urb(u132, endp, urb, 0); 1114 u132_hcd_giveback_urb(u132, endp, urb, 0);
1115 return; 1115 return;
1116 } else { 1116 } else {
1117 dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p " 1117 dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p "
1118 "unlinked=%d\n", urb, urb->unlinked); 1118 "unlinked=%d\n", urb, urb->unlinked);
1119 up(&u132->scheduler_lock); 1119 mutex_unlock(&u132->scheduler_lock);
1120 u132_hcd_giveback_urb(u132, endp, urb, 0); 1120 u132_hcd_giveback_urb(u132, endp, urb, 0);
1121 return; 1121 return;
1122 } 1122 }
@@ -1128,28 +1128,28 @@ static void u132_hcd_enumeration_address_sent(void *data, struct urb *urb,
1128{ 1128{
1129 struct u132_endp *endp = data; 1129 struct u132_endp *endp = data;
1130 struct u132 *u132 = endp->u132; 1130 struct u132 *u132 = endp->u132;
1131 down(&u132->scheduler_lock); 1131 mutex_lock(&u132->scheduler_lock);
1132 if (u132->going > 1) { 1132 if (u132->going > 1) {
1133 dev_err(&u132->platform_dev->dev, "device has been removed %d\n" 1133 dev_err(&u132->platform_dev->dev, "device has been removed %d\n"
1134 , u132->going); 1134 , u132->going);
1135 up(&u132->scheduler_lock); 1135 mutex_unlock(&u132->scheduler_lock);
1136 u132_hcd_forget_urb(u132, endp, urb, -ENODEV); 1136 u132_hcd_forget_urb(u132, endp, urb, -ENODEV);
1137 return; 1137 return;
1138 } else if (endp->dequeueing) { 1138 } else if (endp->dequeueing) {
1139 endp->dequeueing = 0; 1139 endp->dequeueing = 0;
1140 up(&u132->scheduler_lock); 1140 mutex_unlock(&u132->scheduler_lock);
1141 u132_hcd_giveback_urb(u132, endp, urb, -EINTR); 1141 u132_hcd_giveback_urb(u132, endp, urb, -EINTR);
1142 return; 1142 return;
1143 } else if (u132->going > 0) { 1143 } else if (u132->going > 0) {
1144 dev_err(&u132->platform_dev->dev, "device is being removed " 1144 dev_err(&u132->platform_dev->dev, "device is being removed "
1145 "urb=%p\n", urb); 1145 "urb=%p\n", urb);
1146 up(&u132->scheduler_lock); 1146 mutex_unlock(&u132->scheduler_lock);
1147 u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); 1147 u132_hcd_giveback_urb(u132, endp, urb, -ENODEV);
1148 return; 1148 return;
1149 } else if (!urb->unlinked) { 1149 } else if (!urb->unlinked) {
1150 int retval; 1150 int retval;
1151 struct u132_ring *ring = endp->ring; 1151 struct u132_ring *ring = endp->ring;
1152 up(&u132->scheduler_lock); 1152 mutex_unlock(&u132->scheduler_lock);
1153 retval = usb_ftdi_elan_edset_input(u132->platform_dev, 1153 retval = usb_ftdi_elan_edset_input(u132->platform_dev,
1154 ring->number, endp, urb, 0, endp->usb_endp, 0, 1154 ring->number, endp, urb, 0, endp->usb_endp, 0,
1155 u132_hcd_enumeration_empty_recv); 1155 u132_hcd_enumeration_empty_recv);
@@ -1159,7 +1159,7 @@ static void u132_hcd_enumeration_address_sent(void *data, struct urb *urb,
1159 } else { 1159 } else {
1160 dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p " 1160 dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p "
1161 "unlinked=%d\n", urb, urb->unlinked); 1161 "unlinked=%d\n", urb, urb->unlinked);
1162 up(&u132->scheduler_lock); 1162 mutex_unlock(&u132->scheduler_lock);
1163 u132_hcd_giveback_urb(u132, endp, urb, 0); 1163 u132_hcd_giveback_urb(u132, endp, urb, 0);
1164 return; 1164 return;
1165 } 1165 }
@@ -1171,32 +1171,32 @@ static void u132_hcd_initial_empty_sent(void *data, struct urb *urb, u8 *buf,
1171{ 1171{
1172 struct u132_endp *endp = data; 1172 struct u132_endp *endp = data;
1173 struct u132 *u132 = endp->u132; 1173 struct u132 *u132 = endp->u132;
1174 down(&u132->scheduler_lock); 1174 mutex_lock(&u132->scheduler_lock);
1175 if (u132->going > 1) { 1175 if (u132->going > 1) {
1176 dev_err(&u132->platform_dev->dev, "device has been removed %d\n" 1176 dev_err(&u132->platform_dev->dev, "device has been removed %d\n"
1177 , u132->going); 1177 , u132->going);
1178 up(&u132->scheduler_lock); 1178 mutex_unlock(&u132->scheduler_lock);
1179 u132_hcd_forget_urb(u132, endp, urb, -ENODEV); 1179 u132_hcd_forget_urb(u132, endp, urb, -ENODEV);
1180 return; 1180 return;
1181 } else if (endp->dequeueing) { 1181 } else if (endp->dequeueing) {
1182 endp->dequeueing = 0; 1182 endp->dequeueing = 0;
1183 up(&u132->scheduler_lock); 1183 mutex_unlock(&u132->scheduler_lock);
1184 u132_hcd_giveback_urb(u132, endp, urb, -EINTR); 1184 u132_hcd_giveback_urb(u132, endp, urb, -EINTR);
1185 return; 1185 return;
1186 } else if (u132->going > 0) { 1186 } else if (u132->going > 0) {
1187 dev_err(&u132->platform_dev->dev, "device is being removed " 1187 dev_err(&u132->platform_dev->dev, "device is being removed "
1188 "urb=%p\n", urb); 1188 "urb=%p\n", urb);
1189 up(&u132->scheduler_lock); 1189 mutex_unlock(&u132->scheduler_lock);
1190 u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); 1190 u132_hcd_giveback_urb(u132, endp, urb, -ENODEV);
1191 return; 1191 return;
1192 } else if (!urb->unlinked) { 1192 } else if (!urb->unlinked) {
1193 up(&u132->scheduler_lock); 1193 mutex_unlock(&u132->scheduler_lock);
1194 u132_hcd_giveback_urb(u132, endp, urb, 0); 1194 u132_hcd_giveback_urb(u132, endp, urb, 0);
1195 return; 1195 return;
1196 } else { 1196 } else {
1197 dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p " 1197 dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p "
1198 "unlinked=%d\n", urb, urb->unlinked); 1198 "unlinked=%d\n", urb, urb->unlinked);
1199 up(&u132->scheduler_lock); 1199 mutex_unlock(&u132->scheduler_lock);
1200 u132_hcd_giveback_urb(u132, endp, urb, 0); 1200 u132_hcd_giveback_urb(u132, endp, urb, 0);
1201 return; 1201 return;
1202 } 1202 }
@@ -1209,22 +1209,22 @@ static void u132_hcd_initial_input_recv(void *data, struct urb *urb, u8 *buf,
1209 struct u132_endp *endp = data; 1209 struct u132_endp *endp = data;
1210 struct u132 *u132 = endp->u132; 1210 struct u132 *u132 = endp->u132;
1211 u8 address = u132->addr[endp->usb_addr].address; 1211 u8 address = u132->addr[endp->usb_addr].address;
1212 down(&u132->scheduler_lock); 1212 mutex_lock(&u132->scheduler_lock);
1213 if (u132->going > 1) { 1213 if (u132->going > 1) {
1214 dev_err(&u132->platform_dev->dev, "device has been removed %d\n" 1214 dev_err(&u132->platform_dev->dev, "device has been removed %d\n"
1215 , u132->going); 1215 , u132->going);
1216 up(&u132->scheduler_lock); 1216 mutex_unlock(&u132->scheduler_lock);
1217 u132_hcd_forget_urb(u132, endp, urb, -ENODEV); 1217 u132_hcd_forget_urb(u132, endp, urb, -ENODEV);
1218 return; 1218 return;
1219 } else if (endp->dequeueing) { 1219 } else if (endp->dequeueing) {
1220 endp->dequeueing = 0; 1220 endp->dequeueing = 0;
1221 up(&u132->scheduler_lock); 1221 mutex_unlock(&u132->scheduler_lock);
1222 u132_hcd_giveback_urb(u132, endp, urb, -EINTR); 1222 u132_hcd_giveback_urb(u132, endp, urb, -EINTR);
1223 return; 1223 return;
1224 } else if (u132->going > 0) { 1224 } else if (u132->going > 0) {
1225 dev_err(&u132->platform_dev->dev, "device is being removed " 1225 dev_err(&u132->platform_dev->dev, "device is being removed "
1226 "urb=%p\n", urb); 1226 "urb=%p\n", urb);
1227 up(&u132->scheduler_lock); 1227 mutex_unlock(&u132->scheduler_lock);
1228 u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); 1228 u132_hcd_giveback_urb(u132, endp, urb, -ENODEV);
1229 return; 1229 return;
1230 } else if (!urb->unlinked) { 1230 } else if (!urb->unlinked) {
@@ -1238,7 +1238,7 @@ static void u132_hcd_initial_input_recv(void *data, struct urb *urb, u8 *buf,
1238 *u++ = *b++; 1238 *u++ = *b++;
1239 1239
1240 urb->actual_length = len; 1240 urb->actual_length = len;
1241 up(&u132->scheduler_lock); 1241 mutex_unlock(&u132->scheduler_lock);
1242 retval = usb_ftdi_elan_edset_empty(u132->platform_dev, 1242 retval = usb_ftdi_elan_edset_empty(u132->platform_dev,
1243 ring->number, endp, urb, address, endp->usb_endp, 0x3, 1243 ring->number, endp, urb, address, endp->usb_endp, 0x3,
1244 u132_hcd_initial_empty_sent); 1244 u132_hcd_initial_empty_sent);
@@ -1248,7 +1248,7 @@ static void u132_hcd_initial_input_recv(void *data, struct urb *urb, u8 *buf,
1248 } else { 1248 } else {
1249 dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p " 1249 dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p "
1250 "unlinked=%d\n", urb, urb->unlinked); 1250 "unlinked=%d\n", urb, urb->unlinked);
1251 up(&u132->scheduler_lock); 1251 mutex_unlock(&u132->scheduler_lock);
1252 u132_hcd_giveback_urb(u132, endp, urb, 0); 1252 u132_hcd_giveback_urb(u132, endp, urb, 0);
1253 return; 1253 return;
1254 } 1254 }
@@ -1261,28 +1261,28 @@ static void u132_hcd_initial_setup_sent(void *data, struct urb *urb, u8 *buf,
1261 struct u132_endp *endp = data; 1261 struct u132_endp *endp = data;
1262 struct u132 *u132 = endp->u132; 1262 struct u132 *u132 = endp->u132;
1263 u8 address = u132->addr[endp->usb_addr].address; 1263 u8 address = u132->addr[endp->usb_addr].address;
1264 down(&u132->scheduler_lock); 1264 mutex_lock(&u132->scheduler_lock);
1265 if (u132->going > 1) { 1265 if (u132->going > 1) {
1266 dev_err(&u132->platform_dev->dev, "device has been removed %d\n" 1266 dev_err(&u132->platform_dev->dev, "device has been removed %d\n"
1267 , u132->going); 1267 , u132->going);
1268 up(&u132->scheduler_lock); 1268 mutex_unlock(&u132->scheduler_lock);
1269 u132_hcd_forget_urb(u132, endp, urb, -ENODEV); 1269 u132_hcd_forget_urb(u132, endp, urb, -ENODEV);
1270 return; 1270 return;
1271 } else if (endp->dequeueing) { 1271 } else if (endp->dequeueing) {
1272 endp->dequeueing = 0; 1272 endp->dequeueing = 0;
1273 up(&u132->scheduler_lock); 1273 mutex_unlock(&u132->scheduler_lock);
1274 u132_hcd_giveback_urb(u132, endp, urb, -EINTR); 1274 u132_hcd_giveback_urb(u132, endp, urb, -EINTR);
1275 return; 1275 return;
1276 } else if (u132->going > 0) { 1276 } else if (u132->going > 0) {
1277 dev_err(&u132->platform_dev->dev, "device is being removed " 1277 dev_err(&u132->platform_dev->dev, "device is being removed "
1278 "urb=%p\n", urb); 1278 "urb=%p\n", urb);
1279 up(&u132->scheduler_lock); 1279 mutex_unlock(&u132->scheduler_lock);
1280 u132_hcd_giveback_urb(u132, endp, urb, -ENODEV); 1280 u132_hcd_giveback_urb(u132, endp, urb, -ENODEV);
1281 return; 1281 return;
1282 } else if (!urb->unlinked) { 1282 } else if (!urb->unlinked) {
1283 int retval; 1283 int retval;
1284 struct u132_ring *ring = endp->ring; 1284 struct u132_ring *ring = endp->ring;
1285 up(&u132->scheduler_lock); 1285 mutex_unlock(&u132->scheduler_lock);
1286 retval = usb_ftdi_elan_edset_input(u132->platform_dev, 1286 retval = usb_ftdi_elan_edset_input(u132->platform_dev,
1287 ring->number, endp, urb, address, endp->usb_endp, 0, 1287 ring->number, endp, urb, address, endp->usb_endp, 0,
1288 u132_hcd_initial_input_recv); 1288 u132_hcd_initial_input_recv);
@@ -1292,7 +1292,7 @@ static void u132_hcd_initial_setup_sent(void *data, struct urb *urb, u8 *buf,
1292 } else { 1292 } else {
1293 dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p " 1293 dev_err(&u132->platform_dev->dev, "CALLBACK called urb=%p "
1294 "unlinked=%d\n", urb, urb->unlinked); 1294 "unlinked=%d\n", urb, urb->unlinked);
1295 up(&u132->scheduler_lock); 1295 mutex_unlock(&u132->scheduler_lock);
1296 u132_hcd_giveback_urb(u132, endp, urb, 0); 1296 u132_hcd_giveback_urb(u132, endp, urb, 0);
1297 return; 1297 return;
1298 } 1298 }
@@ -1307,9 +1307,9 @@ static void u132_hcd_ring_work_scheduler(struct work_struct *work)
1307 struct u132_ring *ring = 1307 struct u132_ring *ring =
1308 container_of(work, struct u132_ring, scheduler.work); 1308 container_of(work, struct u132_ring, scheduler.work);
1309 struct u132 *u132 = ring->u132; 1309 struct u132 *u132 = ring->u132;
1310 down(&u132->scheduler_lock); 1310 mutex_lock(&u132->scheduler_lock);
1311 if (ring->in_use) { 1311 if (ring->in_use) {
1312 up(&u132->scheduler_lock); 1312 mutex_unlock(&u132->scheduler_lock);
1313 u132_ring_put_kref(u132, ring); 1313 u132_ring_put_kref(u132, ring);
1314 return; 1314 return;
1315 } else if (ring->curr_endp) { 1315 } else if (ring->curr_endp) {
@@ -1326,7 +1326,7 @@ static void u132_hcd_ring_work_scheduler(struct work_struct *work)
1326 ring->curr_endp = endp; 1326 ring->curr_endp = endp;
1327 u132_endp_cancel_work(u132, last_endp); 1327 u132_endp_cancel_work(u132, last_endp);
1328 u132_endp_queue_work(u132, last_endp, 0); 1328 u132_endp_queue_work(u132, last_endp, 0);
1329 up(&u132->scheduler_lock); 1329 mutex_unlock(&u132->scheduler_lock);
1330 u132_ring_put_kref(u132, ring); 1330 u132_ring_put_kref(u132, ring);
1331 return; 1331 return;
1332 } else { 1332 } else {
@@ -1340,7 +1340,7 @@ static void u132_hcd_ring_work_scheduler(struct work_struct *work)
1340 last_endp->jiffies)) { 1340 last_endp->jiffies)) {
1341 u132_endp_cancel_work(u132, last_endp); 1341 u132_endp_cancel_work(u132, last_endp);
1342 u132_endp_queue_work(u132, last_endp, 0); 1342 u132_endp_queue_work(u132, last_endp, 0);
1343 up(&u132->scheduler_lock); 1343 mutex_unlock(&u132->scheduler_lock);
1344 u132_ring_put_kref(u132, ring); 1344 u132_ring_put_kref(u132, ring);
1345 return; 1345 return;
1346 } else { 1346 } else {
@@ -1350,15 +1350,15 @@ static void u132_hcd_ring_work_scheduler(struct work_struct *work)
1350 } 1350 }
1351 if (wakeup > 0) { 1351 if (wakeup > 0) {
1352 u132_ring_requeue_work(u132, ring, wakeup); 1352 u132_ring_requeue_work(u132, ring, wakeup);
1353 up(&u132->scheduler_lock); 1353 mutex_unlock(&u132->scheduler_lock);
1354 return; 1354 return;
1355 } else { 1355 } else {
1356 up(&u132->scheduler_lock); 1356 mutex_unlock(&u132->scheduler_lock);
1357 u132_ring_put_kref(u132, ring); 1357 u132_ring_put_kref(u132, ring);
1358 return; 1358 return;
1359 } 1359 }
1360 } else { 1360 } else {
1361 up(&u132->scheduler_lock); 1361 mutex_unlock(&u132->scheduler_lock);
1362 u132_ring_put_kref(u132, ring); 1362 u132_ring_put_kref(u132, ring);
1363 return; 1363 return;
1364 } 1364 }
@@ -1370,32 +1370,32 @@ static void u132_hcd_endp_work_scheduler(struct work_struct *work)
1370 struct u132_endp *endp = 1370 struct u132_endp *endp =
1371 container_of(work, struct u132_endp, scheduler.work); 1371 container_of(work, struct u132_endp, scheduler.work);
1372 struct u132 *u132 = endp->u132; 1372 struct u132 *u132 = endp->u132;
1373 down(&u132->scheduler_lock); 1373 mutex_lock(&u132->scheduler_lock);
1374 ring = endp->ring; 1374 ring = endp->ring;
1375 if (endp->edset_flush) { 1375 if (endp->edset_flush) {
1376 endp->edset_flush = 0; 1376 endp->edset_flush = 0;
1377 if (endp->dequeueing) 1377 if (endp->dequeueing)
1378 usb_ftdi_elan_edset_flush(u132->platform_dev, 1378 usb_ftdi_elan_edset_flush(u132->platform_dev,
1379 ring->number, endp); 1379 ring->number, endp);
1380 up(&u132->scheduler_lock); 1380 mutex_unlock(&u132->scheduler_lock);
1381 u132_endp_put_kref(u132, endp); 1381 u132_endp_put_kref(u132, endp);
1382 return; 1382 return;
1383 } else if (endp->active) { 1383 } else if (endp->active) {
1384 up(&u132->scheduler_lock); 1384 mutex_unlock(&u132->scheduler_lock);
1385 u132_endp_put_kref(u132, endp); 1385 u132_endp_put_kref(u132, endp);
1386 return; 1386 return;
1387 } else if (ring->in_use) { 1387 } else if (ring->in_use) {
1388 up(&u132->scheduler_lock); 1388 mutex_unlock(&u132->scheduler_lock);
1389 u132_endp_put_kref(u132, endp); 1389 u132_endp_put_kref(u132, endp);
1390 return; 1390 return;
1391 } else if (endp->queue_next == endp->queue_last) { 1391 } else if (endp->queue_next == endp->queue_last) {
1392 up(&u132->scheduler_lock); 1392 mutex_unlock(&u132->scheduler_lock);
1393 u132_endp_put_kref(u132, endp); 1393 u132_endp_put_kref(u132, endp);
1394 return; 1394 return;
1395 } else if (endp->pipetype == PIPE_INTERRUPT) { 1395 } else if (endp->pipetype == PIPE_INTERRUPT) {
1396 u8 address = u132->addr[endp->usb_addr].address; 1396 u8 address = u132->addr[endp->usb_addr].address;
1397 if (ring->in_use) { 1397 if (ring->in_use) {
1398 up(&u132->scheduler_lock); 1398 mutex_unlock(&u132->scheduler_lock);
1399 u132_endp_put_kref(u132, endp); 1399 u132_endp_put_kref(u132, endp);
1400 return; 1400 return;
1401 } else { 1401 } else {
@@ -1405,7 +1405,7 @@ static void u132_hcd_endp_work_scheduler(struct work_struct *work)
1405 endp->active = 1; 1405 endp->active = 1;
1406 ring->curr_endp = endp; 1406 ring->curr_endp = endp;
1407 ring->in_use = 1; 1407 ring->in_use = 1;
1408 up(&u132->scheduler_lock); 1408 mutex_unlock(&u132->scheduler_lock);
1409 retval = edset_single(u132, ring, endp, urb, address, 1409 retval = edset_single(u132, ring, endp, urb, address,
1410 endp->toggle_bits, u132_hcd_interrupt_recv); 1410 endp->toggle_bits, u132_hcd_interrupt_recv);
1411 if (retval != 0) 1411 if (retval != 0)
@@ -1415,7 +1415,7 @@ static void u132_hcd_endp_work_scheduler(struct work_struct *work)
1415 } else if (endp->pipetype == PIPE_CONTROL) { 1415 } else if (endp->pipetype == PIPE_CONTROL) {
1416 u8 address = u132->addr[endp->usb_addr].address; 1416 u8 address = u132->addr[endp->usb_addr].address;
1417 if (ring->in_use) { 1417 if (ring->in_use) {
1418 up(&u132->scheduler_lock); 1418 mutex_unlock(&u132->scheduler_lock);
1419 u132_endp_put_kref(u132, endp); 1419 u132_endp_put_kref(u132, endp);
1420 return; 1420 return;
1421 } else if (address == 0) { 1421 } else if (address == 0) {
@@ -1425,7 +1425,7 @@ static void u132_hcd_endp_work_scheduler(struct work_struct *work)
1425 endp->active = 1; 1425 endp->active = 1;
1426 ring->curr_endp = endp; 1426 ring->curr_endp = endp;
1427 ring->in_use = 1; 1427 ring->in_use = 1;
1428 up(&u132->scheduler_lock); 1428 mutex_unlock(&u132->scheduler_lock);
1429 retval = edset_setup(u132, ring, endp, urb, address, 1429 retval = edset_setup(u132, ring, endp, urb, address,
1430 0x2, u132_hcd_initial_setup_sent); 1430 0x2, u132_hcd_initial_setup_sent);
1431 if (retval != 0) 1431 if (retval != 0)
@@ -1438,7 +1438,7 @@ static void u132_hcd_endp_work_scheduler(struct work_struct *work)
1438 endp->active = 1; 1438 endp->active = 1;
1439 ring->curr_endp = endp; 1439 ring->curr_endp = endp;
1440 ring->in_use = 1; 1440 ring->in_use = 1;
1441 up(&u132->scheduler_lock); 1441 mutex_unlock(&u132->scheduler_lock);
1442 retval = edset_setup(u132, ring, endp, urb, 0, 0x2, 1442 retval = edset_setup(u132, ring, endp, urb, 0, 0x2,
1443 u132_hcd_enumeration_address_sent); 1443 u132_hcd_enumeration_address_sent);
1444 if (retval != 0) 1444 if (retval != 0)
@@ -1452,7 +1452,7 @@ static void u132_hcd_endp_work_scheduler(struct work_struct *work)
1452 endp->active = 1; 1452 endp->active = 1;
1453 ring->curr_endp = endp; 1453 ring->curr_endp = endp;
1454 ring->in_use = 1; 1454 ring->in_use = 1;
1455 up(&u132->scheduler_lock); 1455 mutex_unlock(&u132->scheduler_lock);
1456 retval = edset_setup(u132, ring, endp, urb, address, 1456 retval = edset_setup(u132, ring, endp, urb, address,
1457 0x2, u132_hcd_configure_setup_sent); 1457 0x2, u132_hcd_configure_setup_sent);
1458 if (retval != 0) 1458 if (retval != 0)
@@ -1463,7 +1463,7 @@ static void u132_hcd_endp_work_scheduler(struct work_struct *work)
1463 if (endp->input) { 1463 if (endp->input) {
1464 u8 address = u132->addr[endp->usb_addr].address; 1464 u8 address = u132->addr[endp->usb_addr].address;
1465 if (ring->in_use) { 1465 if (ring->in_use) {
1466 up(&u132->scheduler_lock); 1466 mutex_unlock(&u132->scheduler_lock);
1467 u132_endp_put_kref(u132, endp); 1467 u132_endp_put_kref(u132, endp);
1468 return; 1468 return;
1469 } else { 1469 } else {
@@ -1473,7 +1473,7 @@ static void u132_hcd_endp_work_scheduler(struct work_struct *work)
1473 endp->active = 1; 1473 endp->active = 1;
1474 ring->curr_endp = endp; 1474 ring->curr_endp = endp;
1475 ring->in_use = 1; 1475 ring->in_use = 1;
1476 up(&u132->scheduler_lock); 1476 mutex_unlock(&u132->scheduler_lock);
1477 retval = edset_input(u132, ring, endp, urb, 1477 retval = edset_input(u132, ring, endp, urb,
1478 address, endp->toggle_bits, 1478 address, endp->toggle_bits,
1479 u132_hcd_bulk_input_recv); 1479 u132_hcd_bulk_input_recv);
@@ -1486,7 +1486,7 @@ static void u132_hcd_endp_work_scheduler(struct work_struct *work)
1486 } else { /* output pipe */ 1486 } else { /* output pipe */
1487 u8 address = u132->addr[endp->usb_addr].address; 1487 u8 address = u132->addr[endp->usb_addr].address;
1488 if (ring->in_use) { 1488 if (ring->in_use) {
1489 up(&u132->scheduler_lock); 1489 mutex_unlock(&u132->scheduler_lock);
1490 u132_endp_put_kref(u132, endp); 1490 u132_endp_put_kref(u132, endp);
1491 return; 1491 return;
1492 } else { 1492 } else {
@@ -1496,7 +1496,7 @@ static void u132_hcd_endp_work_scheduler(struct work_struct *work)
1496 endp->active = 1; 1496 endp->active = 1;
1497 ring->curr_endp = endp; 1497 ring->curr_endp = endp;
1498 ring->in_use = 1; 1498 ring->in_use = 1;
1499 up(&u132->scheduler_lock); 1499 mutex_unlock(&u132->scheduler_lock);
1500 retval = edset_output(u132, ring, endp, urb, 1500 retval = edset_output(u132, ring, endp, urb,
1501 address, endp->toggle_bits, 1501 address, endp->toggle_bits,
1502 u132_hcd_bulk_output_sent); 1502 u132_hcd_bulk_output_sent);
@@ -3085,7 +3085,7 @@ static void u132_initialise(struct u132 *u132, struct platform_device *pdev)
3085 u132->power = 0; 3085 u132->power = 0;
3086 u132->reset = 0; 3086 u132->reset = 0;
3087 mutex_init(&u132->sw_lock); 3087 mutex_init(&u132->sw_lock);
3088 init_MUTEX(&u132->scheduler_lock); 3088 mutex_init(&u132->scheduler_lock);
3089 while (rings-- > 0) { 3089 while (rings-- > 0) {
3090 struct u132_ring *ring = &u132->ring[rings]; 3090 struct u132_ring *ring = &u132->ring[rings];
3091 ring->u132 = u132; 3091 ring->u132 = u132;