diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-24 11:36:06 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-24 11:36:06 -0400 |
commit | d72cd3a90e4d6725b62919139e2ab7bd926fa16d (patch) | |
tree | 771731ecee0ebdd60dcda2173945cff28edc8e71 | |
parent | ff91fad2db543325d7221c26ff42d7df3c574064 (diff) | |
parent | 6b35ca0d3d586b8ecb8396821af21186e20afaf0 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb-2.6:
USB: pwc : do not pass stack allocated buffers to USB core.
USB: otg: Fix bug on remove path without transceiver
USB: correct error handling in cdc-wdm
USB: removal of tty->low_latency hack dating back to the old serial code
USB: serial: sierra driver bug fix for composite interface
USB: gadget: omap_udc uses platform_driver_probe()
USB: ci13xxx_udc: fix build error
USB: musb: Prevent multiple includes of musb.h
USB: pass mem_flags to dma_alloc_coherent
USB: g_file_storage: fix use-after-free bug when closing files
USB: ehci-sched.c: EHCI SITD scheduling bugfix
USB: fix mos7840 problem with minor numbers
USB: mos7840: add new device id
USB: musb: fix build when !CONFIG_PM
USB: musb: Remove my email address from few musb related drivers
USB: Gadget: MIPS CI13xxx UDC bugfixes
USB: Unusual Device support for Gold MP3 Player Energy
USB: serial: fix lifetime and locking problems
33 files changed, 319 insertions, 271 deletions
diff --git a/drivers/media/video/pwc/pwc-ctrl.c b/drivers/media/video/pwc/pwc-ctrl.c index f9fbe02e0f69..50b415e07eda 100644 --- a/drivers/media/video/pwc/pwc-ctrl.c +++ b/drivers/media/video/pwc/pwc-ctrl.c | |||
@@ -159,35 +159,67 @@ static void pwc_set_image_buffer_size(struct pwc_device *pdev); | |||
159 | 159 | ||
160 | /****************************************************************************/ | 160 | /****************************************************************************/ |
161 | 161 | ||
162 | static int _send_control_msg(struct pwc_device *pdev, | ||
163 | u8 request, u16 value, int index, void *buf, int buflen, int timeout) | ||
164 | { | ||
165 | int rc; | ||
166 | void *kbuf = NULL; | ||
167 | |||
168 | if (buflen) { | ||
169 | kbuf = kmalloc(buflen, GFP_KERNEL); /* not allowed on stack */ | ||
170 | if (kbuf == NULL) | ||
171 | return -ENOMEM; | ||
172 | memcpy(kbuf, buf, buflen); | ||
173 | } | ||
162 | 174 | ||
163 | #define SendControlMsg(request, value, buflen) \ | 175 | rc = usb_control_msg(pdev->udev, usb_sndctrlpipe(pdev->udev, 0), |
164 | usb_control_msg(pdev->udev, usb_sndctrlpipe(pdev->udev, 0), \ | 176 | request, |
165 | request, \ | 177 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
166 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, \ | 178 | value, |
167 | value, \ | 179 | index, |
168 | pdev->vcinterface, \ | 180 | kbuf, buflen, timeout); |
169 | &buf, buflen, 500) | ||
170 | 181 | ||
171 | #define RecvControlMsg(request, value, buflen) \ | 182 | kfree(kbuf); |
172 | usb_control_msg(pdev->udev, usb_rcvctrlpipe(pdev->udev, 0), \ | 183 | return rc; |
173 | request, \ | 184 | } |
174 | USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, \ | ||
175 | value, \ | ||
176 | pdev->vcinterface, \ | ||
177 | &buf, buflen, 500) | ||
178 | 185 | ||
186 | static int recv_control_msg(struct pwc_device *pdev, | ||
187 | u8 request, u16 value, void *buf, int buflen) | ||
188 | { | ||
189 | int rc; | ||
190 | void *kbuf = kmalloc(buflen, GFP_KERNEL); /* not allowed on stack */ | ||
191 | |||
192 | if (kbuf == NULL) | ||
193 | return -ENOMEM; | ||
194 | |||
195 | rc = usb_control_msg(pdev->udev, usb_rcvctrlpipe(pdev->udev, 0), | ||
196 | request, | ||
197 | USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | ||
198 | value, | ||
199 | pdev->vcinterface, | ||
200 | kbuf, buflen, 500); | ||
201 | memcpy(buf, kbuf, buflen); | ||
202 | kfree(kbuf); | ||
203 | return rc; | ||
204 | } | ||
179 | 205 | ||
180 | static int send_video_command(struct usb_device *udev, int index, void *buf, int buflen) | 206 | static inline int send_video_command(struct pwc_device *pdev, |
207 | int index, void *buf, int buflen) | ||
181 | { | 208 | { |
182 | return usb_control_msg(udev, | 209 | return _send_control_msg(pdev, |
183 | usb_sndctrlpipe(udev, 0), | ||
184 | SET_EP_STREAM_CTL, | 210 | SET_EP_STREAM_CTL, |
185 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | ||
186 | VIDEO_OUTPUT_CONTROL_FORMATTER, | 211 | VIDEO_OUTPUT_CONTROL_FORMATTER, |
187 | index, | 212 | index, |
188 | buf, buflen, 1000); | 213 | buf, buflen, 1000); |
189 | } | 214 | } |
190 | 215 | ||
216 | static inline int send_control_msg(struct pwc_device *pdev, | ||
217 | u8 request, u16 value, void *buf, int buflen) | ||
218 | { | ||
219 | return _send_control_msg(pdev, | ||
220 | request, value, pdev->vcinterface, buf, buflen, 500); | ||
221 | } | ||
222 | |||
191 | 223 | ||
192 | 224 | ||
193 | static int set_video_mode_Nala(struct pwc_device *pdev, int size, int frames) | 225 | static int set_video_mode_Nala(struct pwc_device *pdev, int size, int frames) |
@@ -224,7 +256,7 @@ static int set_video_mode_Nala(struct pwc_device *pdev, int size, int frames) | |||
224 | return -EINVAL; | 256 | return -EINVAL; |
225 | 257 | ||
226 | memcpy(buf, pEntry->mode, 3); | 258 | memcpy(buf, pEntry->mode, 3); |
227 | ret = send_video_command(pdev->udev, pdev->vendpoint, buf, 3); | 259 | ret = send_video_command(pdev, pdev->vendpoint, buf, 3); |
228 | if (ret < 0) { | 260 | if (ret < 0) { |
229 | PWC_DEBUG_MODULE("Failed to send video command... %d\n", ret); | 261 | PWC_DEBUG_MODULE("Failed to send video command... %d\n", ret); |
230 | return ret; | 262 | return ret; |
@@ -285,7 +317,7 @@ static int set_video_mode_Timon(struct pwc_device *pdev, int size, int frames, i | |||
285 | memcpy(buf, pChoose->mode, 13); | 317 | memcpy(buf, pChoose->mode, 13); |
286 | if (snapshot) | 318 | if (snapshot) |
287 | buf[0] |= 0x80; | 319 | buf[0] |= 0x80; |
288 | ret = send_video_command(pdev->udev, pdev->vendpoint, buf, 13); | 320 | ret = send_video_command(pdev, pdev->vendpoint, buf, 13); |
289 | if (ret < 0) | 321 | if (ret < 0) |
290 | return ret; | 322 | return ret; |
291 | 323 | ||
@@ -358,7 +390,7 @@ static int set_video_mode_Kiara(struct pwc_device *pdev, int size, int frames, i | |||
358 | buf[0] |= 0x80; | 390 | buf[0] |= 0x80; |
359 | 391 | ||
360 | /* Firmware bug: video endpoint is 5, but commands are sent to endpoint 4 */ | 392 | /* Firmware bug: video endpoint is 5, but commands are sent to endpoint 4 */ |
361 | ret = send_video_command(pdev->udev, 4 /* pdev->vendpoint */, buf, 12); | 393 | ret = send_video_command(pdev, 4 /* pdev->vendpoint */, buf, 12); |
362 | if (ret < 0) | 394 | if (ret < 0) |
363 | return ret; | 395 | return ret; |
364 | 396 | ||
@@ -530,7 +562,8 @@ int pwc_get_brightness(struct pwc_device *pdev) | |||
530 | char buf; | 562 | char buf; |
531 | int ret; | 563 | int ret; |
532 | 564 | ||
533 | ret = RecvControlMsg(GET_LUM_CTL, BRIGHTNESS_FORMATTER, 1); | 565 | ret = recv_control_msg(pdev, |
566 | GET_LUM_CTL, BRIGHTNESS_FORMATTER, &buf, sizeof(buf)); | ||
534 | if (ret < 0) | 567 | if (ret < 0) |
535 | return ret; | 568 | return ret; |
536 | return buf; | 569 | return buf; |
@@ -545,7 +578,8 @@ int pwc_set_brightness(struct pwc_device *pdev, int value) | |||
545 | if (value > 0xffff) | 578 | if (value > 0xffff) |
546 | value = 0xffff; | 579 | value = 0xffff; |
547 | buf = (value >> 9) & 0x7f; | 580 | buf = (value >> 9) & 0x7f; |
548 | return SendControlMsg(SET_LUM_CTL, BRIGHTNESS_FORMATTER, 1); | 581 | return send_control_msg(pdev, |
582 | SET_LUM_CTL, BRIGHTNESS_FORMATTER, &buf, sizeof(buf)); | ||
549 | } | 583 | } |
550 | 584 | ||
551 | /* CONTRAST */ | 585 | /* CONTRAST */ |
@@ -555,7 +589,8 @@ int pwc_get_contrast(struct pwc_device *pdev) | |||
555 | char buf; | 589 | char buf; |
556 | int ret; | 590 | int ret; |
557 | 591 | ||
558 | ret = RecvControlMsg(GET_LUM_CTL, CONTRAST_FORMATTER, 1); | 592 | ret = recv_control_msg(pdev, |
593 | GET_LUM_CTL, CONTRAST_FORMATTER, &buf, sizeof(buf)); | ||
559 | if (ret < 0) | 594 | if (ret < 0) |
560 | return ret; | 595 | return ret; |
561 | return buf; | 596 | return buf; |
@@ -570,7 +605,8 @@ int pwc_set_contrast(struct pwc_device *pdev, int value) | |||
570 | if (value > 0xffff) | 605 | if (value > 0xffff) |
571 | value = 0xffff; | 606 | value = 0xffff; |
572 | buf = (value >> 10) & 0x3f; | 607 | buf = (value >> 10) & 0x3f; |
573 | return SendControlMsg(SET_LUM_CTL, CONTRAST_FORMATTER, 1); | 608 | return send_control_msg(pdev, |
609 | SET_LUM_CTL, CONTRAST_FORMATTER, &buf, sizeof(buf)); | ||
574 | } | 610 | } |
575 | 611 | ||
576 | /* GAMMA */ | 612 | /* GAMMA */ |
@@ -580,7 +616,8 @@ int pwc_get_gamma(struct pwc_device *pdev) | |||
580 | char buf; | 616 | char buf; |
581 | int ret; | 617 | int ret; |
582 | 618 | ||
583 | ret = RecvControlMsg(GET_LUM_CTL, GAMMA_FORMATTER, 1); | 619 | ret = recv_control_msg(pdev, |
620 | GET_LUM_CTL, GAMMA_FORMATTER, &buf, sizeof(buf)); | ||
584 | if (ret < 0) | 621 | if (ret < 0) |
585 | return ret; | 622 | return ret; |
586 | return buf; | 623 | return buf; |
@@ -595,7 +632,8 @@ int pwc_set_gamma(struct pwc_device *pdev, int value) | |||
595 | if (value > 0xffff) | 632 | if (value > 0xffff) |
596 | value = 0xffff; | 633 | value = 0xffff; |
597 | buf = (value >> 11) & 0x1f; | 634 | buf = (value >> 11) & 0x1f; |
598 | return SendControlMsg(SET_LUM_CTL, GAMMA_FORMATTER, 1); | 635 | return send_control_msg(pdev, |
636 | SET_LUM_CTL, GAMMA_FORMATTER, &buf, sizeof(buf)); | ||
599 | } | 637 | } |
600 | 638 | ||
601 | 639 | ||
@@ -613,7 +651,8 @@ int pwc_get_saturation(struct pwc_device *pdev, int *value) | |||
613 | saturation_register = SATURATION_MODE_FORMATTER2; | 651 | saturation_register = SATURATION_MODE_FORMATTER2; |
614 | else | 652 | else |
615 | saturation_register = SATURATION_MODE_FORMATTER1; | 653 | saturation_register = SATURATION_MODE_FORMATTER1; |
616 | ret = RecvControlMsg(GET_CHROM_CTL, saturation_register, 1); | 654 | ret = recv_control_msg(pdev, |
655 | GET_CHROM_CTL, saturation_register, &buf, sizeof(buf)); | ||
617 | if (ret < 0) | 656 | if (ret < 0) |
618 | return ret; | 657 | return ret; |
619 | *value = (signed)buf; | 658 | *value = (signed)buf; |
@@ -636,7 +675,8 @@ int pwc_set_saturation(struct pwc_device *pdev, int value) | |||
636 | saturation_register = SATURATION_MODE_FORMATTER2; | 675 | saturation_register = SATURATION_MODE_FORMATTER2; |
637 | else | 676 | else |
638 | saturation_register = SATURATION_MODE_FORMATTER1; | 677 | saturation_register = SATURATION_MODE_FORMATTER1; |
639 | return SendControlMsg(SET_CHROM_CTL, saturation_register, 1); | 678 | return send_control_msg(pdev, |
679 | SET_CHROM_CTL, saturation_register, &buf, sizeof(buf)); | ||
640 | } | 680 | } |
641 | 681 | ||
642 | /* AGC */ | 682 | /* AGC */ |
@@ -651,7 +691,8 @@ int pwc_set_agc(struct pwc_device *pdev, int mode, int value) | |||
651 | else | 691 | else |
652 | buf = 0xff; /* fixed */ | 692 | buf = 0xff; /* fixed */ |
653 | 693 | ||
654 | ret = SendControlMsg(SET_LUM_CTL, AGC_MODE_FORMATTER, 1); | 694 | ret = send_control_msg(pdev, |
695 | SET_LUM_CTL, AGC_MODE_FORMATTER, &buf, sizeof(buf)); | ||
655 | 696 | ||
656 | if (!mode && ret >= 0) { | 697 | if (!mode && ret >= 0) { |
657 | if (value < 0) | 698 | if (value < 0) |
@@ -659,7 +700,8 @@ int pwc_set_agc(struct pwc_device *pdev, int mode, int value) | |||
659 | if (value > 0xffff) | 700 | if (value > 0xffff) |
660 | value = 0xffff; | 701 | value = 0xffff; |
661 | buf = (value >> 10) & 0x3F; | 702 | buf = (value >> 10) & 0x3F; |
662 | ret = SendControlMsg(SET_LUM_CTL, PRESET_AGC_FORMATTER, 1); | 703 | ret = send_control_msg(pdev, |
704 | SET_LUM_CTL, PRESET_AGC_FORMATTER, &buf, sizeof(buf)); | ||
663 | } | 705 | } |
664 | if (ret < 0) | 706 | if (ret < 0) |
665 | return ret; | 707 | return ret; |
@@ -671,12 +713,14 @@ int pwc_get_agc(struct pwc_device *pdev, int *value) | |||
671 | unsigned char buf; | 713 | unsigned char buf; |
672 | int ret; | 714 | int ret; |
673 | 715 | ||
674 | ret = RecvControlMsg(GET_LUM_CTL, AGC_MODE_FORMATTER, 1); | 716 | ret = recv_control_msg(pdev, |
717 | GET_LUM_CTL, AGC_MODE_FORMATTER, &buf, sizeof(buf)); | ||
675 | if (ret < 0) | 718 | if (ret < 0) |
676 | return ret; | 719 | return ret; |
677 | 720 | ||
678 | if (buf != 0) { /* fixed */ | 721 | if (buf != 0) { /* fixed */ |
679 | ret = RecvControlMsg(GET_LUM_CTL, PRESET_AGC_FORMATTER, 1); | 722 | ret = recv_control_msg(pdev, |
723 | GET_LUM_CTL, PRESET_AGC_FORMATTER, &buf, sizeof(buf)); | ||
680 | if (ret < 0) | 724 | if (ret < 0) |
681 | return ret; | 725 | return ret; |
682 | if (buf > 0x3F) | 726 | if (buf > 0x3F) |
@@ -684,7 +728,8 @@ int pwc_get_agc(struct pwc_device *pdev, int *value) | |||
684 | *value = (buf << 10); | 728 | *value = (buf << 10); |
685 | } | 729 | } |
686 | else { /* auto */ | 730 | else { /* auto */ |
687 | ret = RecvControlMsg(GET_STATUS_CTL, READ_AGC_FORMATTER, 1); | 731 | ret = recv_control_msg(pdev, |
732 | GET_STATUS_CTL, READ_AGC_FORMATTER, &buf, sizeof(buf)); | ||
688 | if (ret < 0) | 733 | if (ret < 0) |
689 | return ret; | 734 | return ret; |
690 | /* Gah... this value ranges from 0x00 ... 0x9F */ | 735 | /* Gah... this value ranges from 0x00 ... 0x9F */ |
@@ -707,7 +752,8 @@ int pwc_set_shutter_speed(struct pwc_device *pdev, int mode, int value) | |||
707 | else | 752 | else |
708 | buf[0] = 0xff; /* fixed */ | 753 | buf[0] = 0xff; /* fixed */ |
709 | 754 | ||
710 | ret = SendControlMsg(SET_LUM_CTL, SHUTTER_MODE_FORMATTER, 1); | 755 | ret = send_control_msg(pdev, |
756 | SET_LUM_CTL, SHUTTER_MODE_FORMATTER, &buf, sizeof(buf)); | ||
711 | 757 | ||
712 | if (!mode && ret >= 0) { | 758 | if (!mode && ret >= 0) { |
713 | if (value < 0) | 759 | if (value < 0) |
@@ -726,7 +772,9 @@ int pwc_set_shutter_speed(struct pwc_device *pdev, int mode, int value) | |||
726 | buf[0] = value >> 8; | 772 | buf[0] = value >> 8; |
727 | } | 773 | } |
728 | 774 | ||
729 | ret = SendControlMsg(SET_LUM_CTL, PRESET_SHUTTER_FORMATTER, 2); | 775 | ret = send_control_msg(pdev, |
776 | SET_LUM_CTL, PRESET_SHUTTER_FORMATTER, | ||
777 | &buf, sizeof(buf)); | ||
730 | } | 778 | } |
731 | return ret; | 779 | return ret; |
732 | } | 780 | } |
@@ -737,7 +785,8 @@ int pwc_get_shutter_speed(struct pwc_device *pdev, int *value) | |||
737 | unsigned char buf[2]; | 785 | unsigned char buf[2]; |
738 | int ret; | 786 | int ret; |
739 | 787 | ||
740 | ret = RecvControlMsg(GET_STATUS_CTL, READ_SHUTTER_FORMATTER, 2); | 788 | ret = recv_control_msg(pdev, |
789 | GET_STATUS_CTL, READ_SHUTTER_FORMATTER, &buf, sizeof(buf)); | ||
741 | if (ret < 0) | 790 | if (ret < 0) |
742 | return ret; | 791 | return ret; |
743 | *value = buf[0] + (buf[1] << 8); | 792 | *value = buf[0] + (buf[1] << 8); |
@@ -764,7 +813,9 @@ int pwc_camera_power(struct pwc_device *pdev, int power) | |||
764 | buf = 0x00; /* active */ | 813 | buf = 0x00; /* active */ |
765 | else | 814 | else |
766 | buf = 0xFF; /* power save */ | 815 | buf = 0xFF; /* power save */ |
767 | return SendControlMsg(SET_STATUS_CTL, SET_POWER_SAVE_MODE_FORMATTER, 1); | 816 | return send_control_msg(pdev, |
817 | SET_STATUS_CTL, SET_POWER_SAVE_MODE_FORMATTER, | ||
818 | &buf, sizeof(buf)); | ||
768 | } | 819 | } |
769 | 820 | ||
770 | 821 | ||
@@ -773,20 +824,20 @@ int pwc_camera_power(struct pwc_device *pdev, int power) | |||
773 | 824 | ||
774 | int pwc_restore_user(struct pwc_device *pdev) | 825 | int pwc_restore_user(struct pwc_device *pdev) |
775 | { | 826 | { |
776 | char buf; /* dummy */ | 827 | return send_control_msg(pdev, |
777 | return SendControlMsg(SET_STATUS_CTL, RESTORE_USER_DEFAULTS_FORMATTER, 0); | 828 | SET_STATUS_CTL, RESTORE_USER_DEFAULTS_FORMATTER, NULL, 0); |
778 | } | 829 | } |
779 | 830 | ||
780 | int pwc_save_user(struct pwc_device *pdev) | 831 | int pwc_save_user(struct pwc_device *pdev) |
781 | { | 832 | { |
782 | char buf; /* dummy */ | 833 | return send_control_msg(pdev, |
783 | return SendControlMsg(SET_STATUS_CTL, SAVE_USER_DEFAULTS_FORMATTER, 0); | 834 | SET_STATUS_CTL, SAVE_USER_DEFAULTS_FORMATTER, NULL, 0); |
784 | } | 835 | } |
785 | 836 | ||
786 | int pwc_restore_factory(struct pwc_device *pdev) | 837 | int pwc_restore_factory(struct pwc_device *pdev) |
787 | { | 838 | { |
788 | char buf; /* dummy */ | 839 | return send_control_msg(pdev, |
789 | return SendControlMsg(SET_STATUS_CTL, RESTORE_FACTORY_DEFAULTS_FORMATTER, 0); | 840 | SET_STATUS_CTL, RESTORE_FACTORY_DEFAULTS_FORMATTER, NULL, 0); |
790 | } | 841 | } |
791 | 842 | ||
792 | /* ************************************************* */ | 843 | /* ************************************************* */ |
@@ -814,7 +865,8 @@ int pwc_set_awb(struct pwc_device *pdev, int mode) | |||
814 | 865 | ||
815 | buf = mode & 0x07; /* just the lowest three bits */ | 866 | buf = mode & 0x07; /* just the lowest three bits */ |
816 | 867 | ||
817 | ret = SendControlMsg(SET_CHROM_CTL, WB_MODE_FORMATTER, 1); | 868 | ret = send_control_msg(pdev, |
869 | SET_CHROM_CTL, WB_MODE_FORMATTER, &buf, sizeof(buf)); | ||
818 | 870 | ||
819 | if (ret < 0) | 871 | if (ret < 0) |
820 | return ret; | 872 | return ret; |
@@ -826,7 +878,8 @@ int pwc_get_awb(struct pwc_device *pdev) | |||
826 | unsigned char buf; | 878 | unsigned char buf; |
827 | int ret; | 879 | int ret; |
828 | 880 | ||
829 | ret = RecvControlMsg(GET_CHROM_CTL, WB_MODE_FORMATTER, 1); | 881 | ret = recv_control_msg(pdev, |
882 | GET_CHROM_CTL, WB_MODE_FORMATTER, &buf, sizeof(buf)); | ||
830 | 883 | ||
831 | if (ret < 0) | 884 | if (ret < 0) |
832 | return ret; | 885 | return ret; |
@@ -843,7 +896,9 @@ int pwc_set_red_gain(struct pwc_device *pdev, int value) | |||
843 | value = 0xffff; | 896 | value = 0xffff; |
844 | /* only the msb is considered */ | 897 | /* only the msb is considered */ |
845 | buf = value >> 8; | 898 | buf = value >> 8; |
846 | return SendControlMsg(SET_CHROM_CTL, PRESET_MANUAL_RED_GAIN_FORMATTER, 1); | 899 | return send_control_msg(pdev, |
900 | SET_CHROM_CTL, PRESET_MANUAL_RED_GAIN_FORMATTER, | ||
901 | &buf, sizeof(buf)); | ||
847 | } | 902 | } |
848 | 903 | ||
849 | int pwc_get_red_gain(struct pwc_device *pdev, int *value) | 904 | int pwc_get_red_gain(struct pwc_device *pdev, int *value) |
@@ -851,7 +906,9 @@ int pwc_get_red_gain(struct pwc_device *pdev, int *value) | |||
851 | unsigned char buf; | 906 | unsigned char buf; |
852 | int ret; | 907 | int ret; |
853 | 908 | ||
854 | ret = RecvControlMsg(GET_CHROM_CTL, PRESET_MANUAL_RED_GAIN_FORMATTER, 1); | 909 | ret = recv_control_msg(pdev, |
910 | GET_CHROM_CTL, PRESET_MANUAL_RED_GAIN_FORMATTER, | ||
911 | &buf, sizeof(buf)); | ||
855 | if (ret < 0) | 912 | if (ret < 0) |
856 | return ret; | 913 | return ret; |
857 | *value = buf << 8; | 914 | *value = buf << 8; |
@@ -869,7 +926,9 @@ int pwc_set_blue_gain(struct pwc_device *pdev, int value) | |||
869 | value = 0xffff; | 926 | value = 0xffff; |
870 | /* only the msb is considered */ | 927 | /* only the msb is considered */ |
871 | buf = value >> 8; | 928 | buf = value >> 8; |
872 | return SendControlMsg(SET_CHROM_CTL, PRESET_MANUAL_BLUE_GAIN_FORMATTER, 1); | 929 | return send_control_msg(pdev, |
930 | SET_CHROM_CTL, PRESET_MANUAL_BLUE_GAIN_FORMATTER, | ||
931 | &buf, sizeof(buf)); | ||
873 | } | 932 | } |
874 | 933 | ||
875 | int pwc_get_blue_gain(struct pwc_device *pdev, int *value) | 934 | int pwc_get_blue_gain(struct pwc_device *pdev, int *value) |
@@ -877,7 +936,9 @@ int pwc_get_blue_gain(struct pwc_device *pdev, int *value) | |||
877 | unsigned char buf; | 936 | unsigned char buf; |
878 | int ret; | 937 | int ret; |
879 | 938 | ||
880 | ret = RecvControlMsg(GET_CHROM_CTL, PRESET_MANUAL_BLUE_GAIN_FORMATTER, 1); | 939 | ret = recv_control_msg(pdev, |
940 | GET_CHROM_CTL, PRESET_MANUAL_BLUE_GAIN_FORMATTER, | ||
941 | &buf, sizeof(buf)); | ||
881 | if (ret < 0) | 942 | if (ret < 0) |
882 | return ret; | 943 | return ret; |
883 | *value = buf << 8; | 944 | *value = buf << 8; |
@@ -894,7 +955,8 @@ static int pwc_read_red_gain(struct pwc_device *pdev, int *value) | |||
894 | unsigned char buf; | 955 | unsigned char buf; |
895 | int ret; | 956 | int ret; |
896 | 957 | ||
897 | ret = RecvControlMsg(GET_STATUS_CTL, READ_RED_GAIN_FORMATTER, 1); | 958 | ret = recv_control_msg(pdev, |
959 | GET_STATUS_CTL, READ_RED_GAIN_FORMATTER, &buf, sizeof(buf)); | ||
898 | if (ret < 0) | 960 | if (ret < 0) |
899 | return ret; | 961 | return ret; |
900 | *value = buf << 8; | 962 | *value = buf << 8; |
@@ -906,7 +968,8 @@ static int pwc_read_blue_gain(struct pwc_device *pdev, int *value) | |||
906 | unsigned char buf; | 968 | unsigned char buf; |
907 | int ret; | 969 | int ret; |
908 | 970 | ||
909 | ret = RecvControlMsg(GET_STATUS_CTL, READ_BLUE_GAIN_FORMATTER, 1); | 971 | ret = recv_control_msg(pdev, |
972 | GET_STATUS_CTL, READ_BLUE_GAIN_FORMATTER, &buf, sizeof(buf)); | ||
910 | if (ret < 0) | 973 | if (ret < 0) |
911 | return ret; | 974 | return ret; |
912 | *value = buf << 8; | 975 | *value = buf << 8; |
@@ -920,7 +983,8 @@ static int pwc_set_wb_speed(struct pwc_device *pdev, int speed) | |||
920 | 983 | ||
921 | /* useful range is 0x01..0x20 */ | 984 | /* useful range is 0x01..0x20 */ |
922 | buf = speed / 0x7f0; | 985 | buf = speed / 0x7f0; |
923 | return SendControlMsg(SET_CHROM_CTL, AWB_CONTROL_SPEED_FORMATTER, 1); | 986 | return send_control_msg(pdev, |
987 | SET_CHROM_CTL, AWB_CONTROL_SPEED_FORMATTER, &buf, sizeof(buf)); | ||
924 | } | 988 | } |
925 | 989 | ||
926 | static int pwc_get_wb_speed(struct pwc_device *pdev, int *value) | 990 | static int pwc_get_wb_speed(struct pwc_device *pdev, int *value) |
@@ -928,7 +992,8 @@ static int pwc_get_wb_speed(struct pwc_device *pdev, int *value) | |||
928 | unsigned char buf; | 992 | unsigned char buf; |
929 | int ret; | 993 | int ret; |
930 | 994 | ||
931 | ret = RecvControlMsg(GET_CHROM_CTL, AWB_CONTROL_SPEED_FORMATTER, 1); | 995 | ret = recv_control_msg(pdev, |
996 | GET_CHROM_CTL, AWB_CONTROL_SPEED_FORMATTER, &buf, sizeof(buf)); | ||
932 | if (ret < 0) | 997 | if (ret < 0) |
933 | return ret; | 998 | return ret; |
934 | *value = buf * 0x7f0; | 999 | *value = buf * 0x7f0; |
@@ -942,7 +1007,8 @@ static int pwc_set_wb_delay(struct pwc_device *pdev, int delay) | |||
942 | 1007 | ||
943 | /* useful range is 0x01..0x3F */ | 1008 | /* useful range is 0x01..0x3F */ |
944 | buf = (delay >> 10); | 1009 | buf = (delay >> 10); |
945 | return SendControlMsg(SET_CHROM_CTL, AWB_CONTROL_DELAY_FORMATTER, 1); | 1010 | return send_control_msg(pdev, |
1011 | SET_CHROM_CTL, AWB_CONTROL_DELAY_FORMATTER, &buf, sizeof(buf)); | ||
946 | } | 1012 | } |
947 | 1013 | ||
948 | static int pwc_get_wb_delay(struct pwc_device *pdev, int *value) | 1014 | static int pwc_get_wb_delay(struct pwc_device *pdev, int *value) |
@@ -950,7 +1016,8 @@ static int pwc_get_wb_delay(struct pwc_device *pdev, int *value) | |||
950 | unsigned char buf; | 1016 | unsigned char buf; |
951 | int ret; | 1017 | int ret; |
952 | 1018 | ||
953 | ret = RecvControlMsg(GET_CHROM_CTL, AWB_CONTROL_DELAY_FORMATTER, 1); | 1019 | ret = recv_control_msg(pdev, |
1020 | GET_CHROM_CTL, AWB_CONTROL_DELAY_FORMATTER, &buf, sizeof(buf)); | ||
954 | if (ret < 0) | 1021 | if (ret < 0) |
955 | return ret; | 1022 | return ret; |
956 | *value = buf << 10; | 1023 | *value = buf << 10; |
@@ -978,7 +1045,8 @@ int pwc_set_leds(struct pwc_device *pdev, int on_value, int off_value) | |||
978 | buf[0] = on_value; | 1045 | buf[0] = on_value; |
979 | buf[1] = off_value; | 1046 | buf[1] = off_value; |
980 | 1047 | ||
981 | return SendControlMsg(SET_STATUS_CTL, LED_FORMATTER, 2); | 1048 | return send_control_msg(pdev, |
1049 | SET_STATUS_CTL, LED_FORMATTER, &buf, sizeof(buf)); | ||
982 | } | 1050 | } |
983 | 1051 | ||
984 | static int pwc_get_leds(struct pwc_device *pdev, int *on_value, int *off_value) | 1052 | static int pwc_get_leds(struct pwc_device *pdev, int *on_value, int *off_value) |
@@ -992,7 +1060,8 @@ static int pwc_get_leds(struct pwc_device *pdev, int *on_value, int *off_value) | |||
992 | return 0; | 1060 | return 0; |
993 | } | 1061 | } |
994 | 1062 | ||
995 | ret = RecvControlMsg(GET_STATUS_CTL, LED_FORMATTER, 2); | 1063 | ret = recv_control_msg(pdev, |
1064 | GET_STATUS_CTL, LED_FORMATTER, &buf, sizeof(buf)); | ||
996 | if (ret < 0) | 1065 | if (ret < 0) |
997 | return ret; | 1066 | return ret; |
998 | *on_value = buf[0] * 100; | 1067 | *on_value = buf[0] * 100; |
@@ -1009,7 +1078,8 @@ int pwc_set_contour(struct pwc_device *pdev, int contour) | |||
1009 | buf = 0xff; /* auto contour on */ | 1078 | buf = 0xff; /* auto contour on */ |
1010 | else | 1079 | else |
1011 | buf = 0x0; /* auto contour off */ | 1080 | buf = 0x0; /* auto contour off */ |
1012 | ret = SendControlMsg(SET_LUM_CTL, AUTO_CONTOUR_FORMATTER, 1); | 1081 | ret = send_control_msg(pdev, |
1082 | SET_LUM_CTL, AUTO_CONTOUR_FORMATTER, &buf, sizeof(buf)); | ||
1013 | if (ret < 0) | 1083 | if (ret < 0) |
1014 | return ret; | 1084 | return ret; |
1015 | 1085 | ||
@@ -1019,7 +1089,8 @@ int pwc_set_contour(struct pwc_device *pdev, int contour) | |||
1019 | contour = 0xffff; | 1089 | contour = 0xffff; |
1020 | 1090 | ||
1021 | buf = (contour >> 10); /* contour preset is [0..3f] */ | 1091 | buf = (contour >> 10); /* contour preset is [0..3f] */ |
1022 | ret = SendControlMsg(SET_LUM_CTL, PRESET_CONTOUR_FORMATTER, 1); | 1092 | ret = send_control_msg(pdev, |
1093 | SET_LUM_CTL, PRESET_CONTOUR_FORMATTER, &buf, sizeof(buf)); | ||
1023 | if (ret < 0) | 1094 | if (ret < 0) |
1024 | return ret; | 1095 | return ret; |
1025 | return 0; | 1096 | return 0; |
@@ -1030,13 +1101,16 @@ int pwc_get_contour(struct pwc_device *pdev, int *contour) | |||
1030 | unsigned char buf; | 1101 | unsigned char buf; |
1031 | int ret; | 1102 | int ret; |
1032 | 1103 | ||
1033 | ret = RecvControlMsg(GET_LUM_CTL, AUTO_CONTOUR_FORMATTER, 1); | 1104 | ret = recv_control_msg(pdev, |
1105 | GET_LUM_CTL, AUTO_CONTOUR_FORMATTER, &buf, sizeof(buf)); | ||
1034 | if (ret < 0) | 1106 | if (ret < 0) |
1035 | return ret; | 1107 | return ret; |
1036 | 1108 | ||
1037 | if (buf == 0) { | 1109 | if (buf == 0) { |
1038 | /* auto mode off, query current preset value */ | 1110 | /* auto mode off, query current preset value */ |
1039 | ret = RecvControlMsg(GET_LUM_CTL, PRESET_CONTOUR_FORMATTER, 1); | 1111 | ret = recv_control_msg(pdev, |
1112 | GET_LUM_CTL, PRESET_CONTOUR_FORMATTER, | ||
1113 | &buf, sizeof(buf)); | ||
1040 | if (ret < 0) | 1114 | if (ret < 0) |
1041 | return ret; | 1115 | return ret; |
1042 | *contour = buf << 10; | 1116 | *contour = buf << 10; |
@@ -1055,7 +1129,9 @@ int pwc_set_backlight(struct pwc_device *pdev, int backlight) | |||
1055 | buf = 0xff; | 1129 | buf = 0xff; |
1056 | else | 1130 | else |
1057 | buf = 0x0; | 1131 | buf = 0x0; |
1058 | return SendControlMsg(SET_LUM_CTL, BACK_LIGHT_COMPENSATION_FORMATTER, 1); | 1132 | return send_control_msg(pdev, |
1133 | SET_LUM_CTL, BACK_LIGHT_COMPENSATION_FORMATTER, | ||
1134 | &buf, sizeof(buf)); | ||
1059 | } | 1135 | } |
1060 | 1136 | ||
1061 | int pwc_get_backlight(struct pwc_device *pdev, int *backlight) | 1137 | int pwc_get_backlight(struct pwc_device *pdev, int *backlight) |
@@ -1063,7 +1139,9 @@ int pwc_get_backlight(struct pwc_device *pdev, int *backlight) | |||
1063 | int ret; | 1139 | int ret; |
1064 | unsigned char buf; | 1140 | unsigned char buf; |
1065 | 1141 | ||
1066 | ret = RecvControlMsg(GET_LUM_CTL, BACK_LIGHT_COMPENSATION_FORMATTER, 1); | 1142 | ret = recv_control_msg(pdev, |
1143 | GET_LUM_CTL, BACK_LIGHT_COMPENSATION_FORMATTER, | ||
1144 | &buf, sizeof(buf)); | ||
1067 | if (ret < 0) | 1145 | if (ret < 0) |
1068 | return ret; | 1146 | return ret; |
1069 | *backlight = !!buf; | 1147 | *backlight = !!buf; |
@@ -1078,7 +1156,8 @@ int pwc_set_colour_mode(struct pwc_device *pdev, int colour) | |||
1078 | buf = 0xff; | 1156 | buf = 0xff; |
1079 | else | 1157 | else |
1080 | buf = 0x0; | 1158 | buf = 0x0; |
1081 | return SendControlMsg(SET_CHROM_CTL, COLOUR_MODE_FORMATTER, 1); | 1159 | return send_control_msg(pdev, |
1160 | SET_CHROM_CTL, COLOUR_MODE_FORMATTER, &buf, sizeof(buf)); | ||
1082 | } | 1161 | } |
1083 | 1162 | ||
1084 | int pwc_get_colour_mode(struct pwc_device *pdev, int *colour) | 1163 | int pwc_get_colour_mode(struct pwc_device *pdev, int *colour) |
@@ -1086,7 +1165,8 @@ int pwc_get_colour_mode(struct pwc_device *pdev, int *colour) | |||
1086 | int ret; | 1165 | int ret; |
1087 | unsigned char buf; | 1166 | unsigned char buf; |
1088 | 1167 | ||
1089 | ret = RecvControlMsg(GET_CHROM_CTL, COLOUR_MODE_FORMATTER, 1); | 1168 | ret = recv_control_msg(pdev, |
1169 | GET_CHROM_CTL, COLOUR_MODE_FORMATTER, &buf, sizeof(buf)); | ||
1090 | if (ret < 0) | 1170 | if (ret < 0) |
1091 | return ret; | 1171 | return ret; |
1092 | *colour = !!buf; | 1172 | *colour = !!buf; |
@@ -1102,7 +1182,8 @@ int pwc_set_flicker(struct pwc_device *pdev, int flicker) | |||
1102 | buf = 0xff; | 1182 | buf = 0xff; |
1103 | else | 1183 | else |
1104 | buf = 0x0; | 1184 | buf = 0x0; |
1105 | return SendControlMsg(SET_LUM_CTL, FLICKERLESS_MODE_FORMATTER, 1); | 1185 | return send_control_msg(pdev, |
1186 | SET_LUM_CTL, FLICKERLESS_MODE_FORMATTER, &buf, sizeof(buf)); | ||
1106 | } | 1187 | } |
1107 | 1188 | ||
1108 | int pwc_get_flicker(struct pwc_device *pdev, int *flicker) | 1189 | int pwc_get_flicker(struct pwc_device *pdev, int *flicker) |
@@ -1110,7 +1191,8 @@ int pwc_get_flicker(struct pwc_device *pdev, int *flicker) | |||
1110 | int ret; | 1191 | int ret; |
1111 | unsigned char buf; | 1192 | unsigned char buf; |
1112 | 1193 | ||
1113 | ret = RecvControlMsg(GET_LUM_CTL, FLICKERLESS_MODE_FORMATTER, 1); | 1194 | ret = recv_control_msg(pdev, |
1195 | GET_LUM_CTL, FLICKERLESS_MODE_FORMATTER, &buf, sizeof(buf)); | ||
1114 | if (ret < 0) | 1196 | if (ret < 0) |
1115 | return ret; | 1197 | return ret; |
1116 | *flicker = !!buf; | 1198 | *flicker = !!buf; |
@@ -1126,7 +1208,9 @@ int pwc_set_dynamic_noise(struct pwc_device *pdev, int noise) | |||
1126 | if (noise > 3) | 1208 | if (noise > 3) |
1127 | noise = 3; | 1209 | noise = 3; |
1128 | buf = noise; | 1210 | buf = noise; |
1129 | return SendControlMsg(SET_LUM_CTL, DYNAMIC_NOISE_CONTROL_FORMATTER, 1); | 1211 | return send_control_msg(pdev, |
1212 | SET_LUM_CTL, DYNAMIC_NOISE_CONTROL_FORMATTER, | ||
1213 | &buf, sizeof(buf)); | ||
1130 | } | 1214 | } |
1131 | 1215 | ||
1132 | int pwc_get_dynamic_noise(struct pwc_device *pdev, int *noise) | 1216 | int pwc_get_dynamic_noise(struct pwc_device *pdev, int *noise) |
@@ -1134,7 +1218,9 @@ int pwc_get_dynamic_noise(struct pwc_device *pdev, int *noise) | |||
1134 | int ret; | 1218 | int ret; |
1135 | unsigned char buf; | 1219 | unsigned char buf; |
1136 | 1220 | ||
1137 | ret = RecvControlMsg(GET_LUM_CTL, DYNAMIC_NOISE_CONTROL_FORMATTER, 1); | 1221 | ret = recv_control_msg(pdev, |
1222 | GET_LUM_CTL, DYNAMIC_NOISE_CONTROL_FORMATTER, | ||
1223 | &buf, sizeof(buf)); | ||
1138 | if (ret < 0) | 1224 | if (ret < 0) |
1139 | return ret; | 1225 | return ret; |
1140 | *noise = buf; | 1226 | *noise = buf; |
@@ -1146,7 +1232,8 @@ static int _pwc_mpt_reset(struct pwc_device *pdev, int flags) | |||
1146 | unsigned char buf; | 1232 | unsigned char buf; |
1147 | 1233 | ||
1148 | buf = flags & 0x03; // only lower two bits are currently used | 1234 | buf = flags & 0x03; // only lower two bits are currently used |
1149 | return SendControlMsg(SET_MPT_CTL, PT_RESET_CONTROL_FORMATTER, 1); | 1235 | return send_control_msg(pdev, |
1236 | SET_MPT_CTL, PT_RESET_CONTROL_FORMATTER, &buf, sizeof(buf)); | ||
1150 | } | 1237 | } |
1151 | 1238 | ||
1152 | int pwc_mpt_reset(struct pwc_device *pdev, int flags) | 1239 | int pwc_mpt_reset(struct pwc_device *pdev, int flags) |
@@ -1175,7 +1262,8 @@ static int _pwc_mpt_set_angle(struct pwc_device *pdev, int pan, int tilt) | |||
1175 | buf[1] = (pan >> 8) & 0xFF; | 1262 | buf[1] = (pan >> 8) & 0xFF; |
1176 | buf[2] = tilt & 0xFF; | 1263 | buf[2] = tilt & 0xFF; |
1177 | buf[3] = (tilt >> 8) & 0xFF; | 1264 | buf[3] = (tilt >> 8) & 0xFF; |
1178 | return SendControlMsg(SET_MPT_CTL, PT_RELATIVE_CONTROL_FORMATTER, 4); | 1265 | return send_control_msg(pdev, |
1266 | SET_MPT_CTL, PT_RELATIVE_CONTROL_FORMATTER, &buf, sizeof(buf)); | ||
1179 | } | 1267 | } |
1180 | 1268 | ||
1181 | int pwc_mpt_set_angle(struct pwc_device *pdev, int pan, int tilt) | 1269 | int pwc_mpt_set_angle(struct pwc_device *pdev, int pan, int tilt) |
@@ -1211,7 +1299,8 @@ static int pwc_mpt_get_status(struct pwc_device *pdev, struct pwc_mpt_status *st | |||
1211 | int ret; | 1299 | int ret; |
1212 | unsigned char buf[5]; | 1300 | unsigned char buf[5]; |
1213 | 1301 | ||
1214 | ret = RecvControlMsg(GET_MPT_CTL, PT_STATUS_FORMATTER, 5); | 1302 | ret = recv_control_msg(pdev, |
1303 | GET_MPT_CTL, PT_STATUS_FORMATTER, &buf, sizeof(buf)); | ||
1215 | if (ret < 0) | 1304 | if (ret < 0) |
1216 | return ret; | 1305 | return ret; |
1217 | status->status = buf[0] & 0x7; // 3 bits are used for reporting | 1306 | status->status = buf[0] & 0x7; // 3 bits are used for reporting |
@@ -1233,7 +1322,8 @@ int pwc_get_cmos_sensor(struct pwc_device *pdev, int *sensor) | |||
1233 | else | 1322 | else |
1234 | request = SENSOR_TYPE_FORMATTER2; | 1323 | request = SENSOR_TYPE_FORMATTER2; |
1235 | 1324 | ||
1236 | ret = RecvControlMsg(GET_STATUS_CTL, request, 1); | 1325 | ret = recv_control_msg(pdev, |
1326 | GET_STATUS_CTL, request, &buf, sizeof(buf)); | ||
1237 | if (ret < 0) | 1327 | if (ret < 0) |
1238 | return ret; | 1328 | return ret; |
1239 | if (pdev->type < 675) | 1329 | if (pdev->type < 675) |
diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c index 34e6108e1d42..0fe434505ac4 100644 --- a/drivers/usb/class/cdc-wdm.c +++ b/drivers/usb/class/cdc-wdm.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * This driver supports USB CDC WCM Device Management. | 4 | * This driver supports USB CDC WCM Device Management. |
5 | * | 5 | * |
6 | * Copyright (c) 2007-2008 Oliver Neukum | 6 | * Copyright (c) 2007-2009 Oliver Neukum |
7 | * | 7 | * |
8 | * Some code taken from cdc-acm.c | 8 | * Some code taken from cdc-acm.c |
9 | * | 9 | * |
@@ -610,7 +610,7 @@ static int wdm_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
610 | if (!buffer) | 610 | if (!buffer) |
611 | goto out; | 611 | goto out; |
612 | 612 | ||
613 | while (buflen > 0) { | 613 | while (buflen > 2) { |
614 | if (buffer [1] != USB_DT_CS_INTERFACE) { | 614 | if (buffer [1] != USB_DT_CS_INTERFACE) { |
615 | dev_err(&intf->dev, "skipping garbage\n"); | 615 | dev_err(&intf->dev, "skipping garbage\n"); |
616 | goto next_desc; | 616 | goto next_desc; |
@@ -646,16 +646,18 @@ next_desc: | |||
646 | spin_lock_init(&desc->iuspin); | 646 | spin_lock_init(&desc->iuspin); |
647 | init_waitqueue_head(&desc->wait); | 647 | init_waitqueue_head(&desc->wait); |
648 | desc->wMaxCommand = maxcom; | 648 | desc->wMaxCommand = maxcom; |
649 | /* this will be expanded and needed in hardware endianness */ | ||
649 | desc->inum = cpu_to_le16((u16)intf->cur_altsetting->desc.bInterfaceNumber); | 650 | desc->inum = cpu_to_le16((u16)intf->cur_altsetting->desc.bInterfaceNumber); |
650 | desc->intf = intf; | 651 | desc->intf = intf; |
651 | INIT_WORK(&desc->rxwork, wdm_rxwork); | 652 | INIT_WORK(&desc->rxwork, wdm_rxwork); |
652 | 653 | ||
653 | iface = &intf->altsetting[0]; | 654 | rv = -EINVAL; |
655 | iface = intf->cur_altsetting; | ||
656 | if (iface->desc.bNumEndpoints != 1) | ||
657 | goto err; | ||
654 | ep = &iface->endpoint[0].desc; | 658 | ep = &iface->endpoint[0].desc; |
655 | if (!ep || !usb_endpoint_is_int_in(ep)) { | 659 | if (!ep || !usb_endpoint_is_int_in(ep)) |
656 | rv = -EINVAL; | ||
657 | goto err; | 660 | goto err; |
658 | } | ||
659 | 661 | ||
660 | desc->wMaxPacketSize = le16_to_cpu(ep->wMaxPacketSize); | 662 | desc->wMaxPacketSize = le16_to_cpu(ep->wMaxPacketSize); |
661 | desc->bMaxPacketSize0 = udev->descriptor.bMaxPacketSize0; | 663 | desc->bMaxPacketSize0 = udev->descriptor.bMaxPacketSize0; |
@@ -711,12 +713,19 @@ next_desc: | |||
711 | 713 | ||
712 | usb_set_intfdata(intf, desc); | 714 | usb_set_intfdata(intf, desc); |
713 | rv = usb_register_dev(intf, &wdm_class); | 715 | rv = usb_register_dev(intf, &wdm_class); |
714 | dev_info(&intf->dev, "cdc-wdm%d: USB WDM device\n", | ||
715 | intf->minor - WDM_MINOR_BASE); | ||
716 | if (rv < 0) | 716 | if (rv < 0) |
717 | goto err; | 717 | goto err3; |
718 | else | ||
719 | dev_info(&intf->dev, "cdc-wdm%d: USB WDM device\n", | ||
720 | intf->minor - WDM_MINOR_BASE); | ||
718 | out: | 721 | out: |
719 | return rv; | 722 | return rv; |
723 | err3: | ||
724 | usb_set_intfdata(intf, NULL); | ||
725 | usb_buffer_free(interface_to_usbdev(desc->intf), | ||
726 | desc->bMaxPacketSize0, | ||
727 | desc->inbuf, | ||
728 | desc->response->transfer_dma); | ||
720 | err2: | 729 | err2: |
721 | usb_buffer_free(interface_to_usbdev(desc->intf), | 730 | usb_buffer_free(interface_to_usbdev(desc->intf), |
722 | desc->wMaxPacketSize, | 731 | desc->wMaxPacketSize, |
diff --git a/drivers/usb/core/buffer.c b/drivers/usb/core/buffer.c index cadb2dc1d28a..3ba2fff71490 100644 --- a/drivers/usb/core/buffer.c +++ b/drivers/usb/core/buffer.c | |||
@@ -119,7 +119,7 @@ void *hcd_buffer_alloc( | |||
119 | if (size <= pool_max [i]) | 119 | if (size <= pool_max [i]) |
120 | return dma_pool_alloc(hcd->pool [i], mem_flags, dma); | 120 | return dma_pool_alloc(hcd->pool [i], mem_flags, dma); |
121 | } | 121 | } |
122 | return dma_alloc_coherent(hcd->self.controller, size, dma, 0); | 122 | return dma_alloc_coherent(hcd->self.controller, size, dma, mem_flags); |
123 | } | 123 | } |
124 | 124 | ||
125 | void hcd_buffer_free( | 125 | void hcd_buffer_free( |
diff --git a/drivers/usb/gadget/ci13xxx_udc.c b/drivers/usb/gadget/ci13xxx_udc.c index 22c65960c429..38e531ecae4d 100644 --- a/drivers/usb/gadget/ci13xxx_udc.c +++ b/drivers/usb/gadget/ci13xxx_udc.c | |||
@@ -51,6 +51,7 @@ | |||
51 | * - Gadget API (majority of optional features) | 51 | * - Gadget API (majority of optional features) |
52 | * - Suspend & Remote Wakeup | 52 | * - Suspend & Remote Wakeup |
53 | */ | 53 | */ |
54 | #include <linux/delay.h> | ||
54 | #include <linux/device.h> | 55 | #include <linux/device.h> |
55 | #include <linux/dmapool.h> | 56 | #include <linux/dmapool.h> |
56 | #include <linux/dma-mapping.h> | 57 | #include <linux/dma-mapping.h> |
@@ -142,7 +143,7 @@ static struct { | |||
142 | #define CAP_DEVICEADDR (0x014UL) | 143 | #define CAP_DEVICEADDR (0x014UL) |
143 | #define CAP_ENDPTLISTADDR (0x018UL) | 144 | #define CAP_ENDPTLISTADDR (0x018UL) |
144 | #define CAP_PORTSC (0x044UL) | 145 | #define CAP_PORTSC (0x044UL) |
145 | #define CAP_DEVLC (0x0B4UL) | 146 | #define CAP_DEVLC (0x084UL) |
146 | #define CAP_USBMODE (hw_bank.lpm ? 0x0C8UL : 0x068UL) | 147 | #define CAP_USBMODE (hw_bank.lpm ? 0x0C8UL : 0x068UL) |
147 | #define CAP_ENDPTSETUPSTAT (hw_bank.lpm ? 0x0D8UL : 0x06CUL) | 148 | #define CAP_ENDPTSETUPSTAT (hw_bank.lpm ? 0x0D8UL : 0x06CUL) |
148 | #define CAP_ENDPTPRIME (hw_bank.lpm ? 0x0DCUL : 0x070UL) | 149 | #define CAP_ENDPTPRIME (hw_bank.lpm ? 0x0DCUL : 0x070UL) |
@@ -1986,6 +1987,8 @@ static int ep_enable(struct usb_ep *ep, | |||
1986 | do { | 1987 | do { |
1987 | dbg_event(_usb_addr(mEp), "ENABLE", 0); | 1988 | dbg_event(_usb_addr(mEp), "ENABLE", 0); |
1988 | 1989 | ||
1990 | mEp->qh[mEp->dir].ptr->cap = 0; | ||
1991 | |||
1989 | if (mEp->type == USB_ENDPOINT_XFER_CONTROL) | 1992 | if (mEp->type == USB_ENDPOINT_XFER_CONTROL) |
1990 | mEp->qh[mEp->dir].ptr->cap |= QH_IOS; | 1993 | mEp->qh[mEp->dir].ptr->cap |= QH_IOS; |
1991 | else if (mEp->type == USB_ENDPOINT_XFER_ISOC) | 1994 | else if (mEp->type == USB_ENDPOINT_XFER_ISOC) |
diff --git a/drivers/usb/gadget/file_storage.c b/drivers/usb/gadget/file_storage.c index 5c030b080d4c..381a53b3e11c 100644 --- a/drivers/usb/gadget/file_storage.c +++ b/drivers/usb/gadget/file_storage.c | |||
@@ -738,7 +738,6 @@ static struct fsg_dev *the_fsg; | |||
738 | static struct usb_gadget_driver fsg_driver; | 738 | static struct usb_gadget_driver fsg_driver; |
739 | 739 | ||
740 | static void close_backing_file(struct lun *curlun); | 740 | static void close_backing_file(struct lun *curlun); |
741 | static void close_all_backing_files(struct fsg_dev *fsg); | ||
742 | 741 | ||
743 | 742 | ||
744 | /*-------------------------------------------------------------------------*/ | 743 | /*-------------------------------------------------------------------------*/ |
@@ -3593,12 +3592,10 @@ static int fsg_main_thread(void *fsg_) | |||
3593 | fsg->thread_task = NULL; | 3592 | fsg->thread_task = NULL; |
3594 | spin_unlock_irq(&fsg->lock); | 3593 | spin_unlock_irq(&fsg->lock); |
3595 | 3594 | ||
3596 | /* In case we are exiting because of a signal, unregister the | 3595 | /* If we are exiting because of a signal, unregister the |
3597 | * gadget driver and close the backing file. */ | 3596 | * gadget driver. */ |
3598 | if (test_and_clear_bit(REGISTERED, &fsg->atomic_bitflags)) { | 3597 | if (test_and_clear_bit(REGISTERED, &fsg->atomic_bitflags)) |
3599 | usb_gadget_unregister_driver(&fsg_driver); | 3598 | usb_gadget_unregister_driver(&fsg_driver); |
3600 | close_all_backing_files(fsg); | ||
3601 | } | ||
3602 | 3599 | ||
3603 | /* Let the unbind and cleanup routines know the thread has exited */ | 3600 | /* Let the unbind and cleanup routines know the thread has exited */ |
3604 | complete_and_exit(&fsg->thread_notifier, 0); | 3601 | complete_and_exit(&fsg->thread_notifier, 0); |
@@ -3703,14 +3700,6 @@ static void close_backing_file(struct lun *curlun) | |||
3703 | } | 3700 | } |
3704 | } | 3701 | } |
3705 | 3702 | ||
3706 | static void close_all_backing_files(struct fsg_dev *fsg) | ||
3707 | { | ||
3708 | int i; | ||
3709 | |||
3710 | for (i = 0; i < fsg->nluns; ++i) | ||
3711 | close_backing_file(&fsg->luns[i]); | ||
3712 | } | ||
3713 | |||
3714 | 3703 | ||
3715 | static ssize_t show_ro(struct device *dev, struct device_attribute *attr, char *buf) | 3704 | static ssize_t show_ro(struct device *dev, struct device_attribute *attr, char *buf) |
3716 | { | 3705 | { |
@@ -3845,6 +3834,7 @@ static void /* __init_or_exit */ fsg_unbind(struct usb_gadget *gadget) | |||
3845 | if (curlun->registered) { | 3834 | if (curlun->registered) { |
3846 | device_remove_file(&curlun->dev, &dev_attr_ro); | 3835 | device_remove_file(&curlun->dev, &dev_attr_ro); |
3847 | device_remove_file(&curlun->dev, &dev_attr_file); | 3836 | device_remove_file(&curlun->dev, &dev_attr_file); |
3837 | close_backing_file(curlun); | ||
3848 | device_unregister(&curlun->dev); | 3838 | device_unregister(&curlun->dev); |
3849 | curlun->registered = 0; | 3839 | curlun->registered = 0; |
3850 | } | 3840 | } |
@@ -4190,7 +4180,6 @@ autoconf_fail: | |||
4190 | out: | 4180 | out: |
4191 | fsg->state = FSG_STATE_TERMINATED; // The thread is dead | 4181 | fsg->state = FSG_STATE_TERMINATED; // The thread is dead |
4192 | fsg_unbind(gadget); | 4182 | fsg_unbind(gadget); |
4193 | close_all_backing_files(fsg); | ||
4194 | complete(&fsg->thread_notifier); | 4183 | complete(&fsg->thread_notifier); |
4195 | return rc; | 4184 | return rc; |
4196 | } | 4185 | } |
@@ -4284,7 +4273,6 @@ static void __exit fsg_cleanup(void) | |||
4284 | /* Wait for the thread to finish up */ | 4273 | /* Wait for the thread to finish up */ |
4285 | wait_for_completion(&fsg->thread_notifier); | 4274 | wait_for_completion(&fsg->thread_notifier); |
4286 | 4275 | ||
4287 | close_all_backing_files(fsg); | ||
4288 | kref_put(&fsg->ref, fsg_release); | 4276 | kref_put(&fsg->ref, fsg_release); |
4289 | } | 4277 | } |
4290 | module_exit(fsg_cleanup); | 4278 | module_exit(fsg_cleanup); |
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c index 57d9641c6bf8..a2db0e174f2c 100644 --- a/drivers/usb/gadget/omap_udc.c +++ b/drivers/usb/gadget/omap_udc.c | |||
@@ -3104,7 +3104,6 @@ static int omap_udc_resume(struct platform_device *dev) | |||
3104 | /*-------------------------------------------------------------------------*/ | 3104 | /*-------------------------------------------------------------------------*/ |
3105 | 3105 | ||
3106 | static struct platform_driver udc_driver = { | 3106 | static struct platform_driver udc_driver = { |
3107 | .probe = omap_udc_probe, | ||
3108 | .remove = __exit_p(omap_udc_remove), | 3107 | .remove = __exit_p(omap_udc_remove), |
3109 | .suspend = omap_udc_suspend, | 3108 | .suspend = omap_udc_suspend, |
3110 | .resume = omap_udc_resume, | 3109 | .resume = omap_udc_resume, |
@@ -3122,7 +3121,7 @@ static int __init udc_init(void) | |||
3122 | #endif | 3121 | #endif |
3123 | "%s\n", driver_desc, | 3122 | "%s\n", driver_desc, |
3124 | use_dma ? " (dma)" : ""); | 3123 | use_dma ? " (dma)" : ""); |
3125 | return platform_driver_register(&udc_driver); | 3124 | return platform_driver_probe(&udc_driver, omap_udc_probe); |
3126 | } | 3125 | } |
3127 | module_init(udc_init); | 3126 | module_init(udc_init); |
3128 | 3127 | ||
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c index ada5d2ba297b..556d0ec0c1f8 100644 --- a/drivers/usb/host/ehci-sched.c +++ b/drivers/usb/host/ehci-sched.c | |||
@@ -323,7 +323,7 @@ static int tt_available ( | |||
323 | * already scheduled transactions | 323 | * already scheduled transactions |
324 | */ | 324 | */ |
325 | if (125 < usecs) { | 325 | if (125 < usecs) { |
326 | int ufs = (usecs / 125) - 1; | 326 | int ufs = (usecs / 125); |
327 | int i; | 327 | int i; |
328 | for (i = uframe; i < (uframe + ufs) && i < 8; i++) | 328 | for (i = uframe; i < (uframe + ufs) && i < 8; i++) |
329 | if (0 < tt_usecs[i]) { | 329 | if (0 < tt_usecs[i]) { |
diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 0112353ec97d..4000cf6d1e81 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c | |||
@@ -2191,7 +2191,7 @@ static int musb_resume_early(struct platform_device *pdev) | |||
2191 | 2191 | ||
2192 | #else | 2192 | #else |
2193 | #define musb_suspend NULL | 2193 | #define musb_suspend NULL |
2194 | #define musb_resume NULL | 2194 | #define musb_resume_early NULL |
2195 | #endif | 2195 | #endif |
2196 | 2196 | ||
2197 | static struct platform_driver musb_driver = { | 2197 | static struct platform_driver musb_driver = { |
diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c index 901dffdf23b1..60924ce08493 100644 --- a/drivers/usb/musb/omap2430.c +++ b/drivers/usb/musb/omap2430.c | |||
@@ -3,7 +3,6 @@ | |||
3 | * Some code has been taken from tusb6010.c | 3 | * Some code has been taken from tusb6010.c |
4 | * Copyrights for that are attributable to: | 4 | * Copyrights for that are attributable to: |
5 | * Copyright (C) 2006 Nokia Corporation | 5 | * Copyright (C) 2006 Nokia Corporation |
6 | * Jarkko Nikula <jarkko.nikula@nokia.com> | ||
7 | * Tony Lindgren <tony@atomide.com> | 6 | * Tony Lindgren <tony@atomide.com> |
8 | * | 7 | * |
9 | * This file is part of the Inventra Controller Driver for Linux. | 8 | * This file is part of the Inventra Controller Driver for Linux. |
diff --git a/drivers/usb/musb/tusb6010.c b/drivers/usb/musb/tusb6010.c index 9e20fd070d71..4ac1477d3569 100644 --- a/drivers/usb/musb/tusb6010.c +++ b/drivers/usb/musb/tusb6010.c | |||
@@ -2,7 +2,6 @@ | |||
2 | * TUSB6010 USB 2.0 OTG Dual Role controller | 2 | * TUSB6010 USB 2.0 OTG Dual Role controller |
3 | * | 3 | * |
4 | * Copyright (C) 2006 Nokia Corporation | 4 | * Copyright (C) 2006 Nokia Corporation |
5 | * Jarkko Nikula <jarkko.nikula@nokia.com> | ||
6 | * Tony Lindgren <tony@atomide.com> | 5 | * Tony Lindgren <tony@atomide.com> |
7 | * | 6 | * |
8 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
diff --git a/drivers/usb/musb/tusb6010.h b/drivers/usb/musb/tusb6010.h index ab8c96286ce6..35c933a5d991 100644 --- a/drivers/usb/musb/tusb6010.h +++ b/drivers/usb/musb/tusb6010.h | |||
@@ -2,7 +2,6 @@ | |||
2 | * Definitions for TUSB6010 USB 2.0 OTG Dual Role controller | 2 | * Definitions for TUSB6010 USB 2.0 OTG Dual Role controller |
3 | * | 3 | * |
4 | * Copyright (C) 2006 Nokia Corporation | 4 | * Copyright (C) 2006 Nokia Corporation |
5 | * Jarkko Nikula <jarkko.nikula@nokia.com> | ||
6 | * Tony Lindgren <tony@atomide.com> | 5 | * Tony Lindgren <tony@atomide.com> |
7 | * | 6 | * |
8 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
diff --git a/drivers/usb/otg/otg.c b/drivers/usb/otg/otg.c index ff318fae7d4d..0a43a7db750f 100644 --- a/drivers/usb/otg/otg.c +++ b/drivers/usb/otg/otg.c | |||
@@ -43,7 +43,8 @@ EXPORT_SYMBOL(otg_get_transceiver); | |||
43 | */ | 43 | */ |
44 | void otg_put_transceiver(struct otg_transceiver *x) | 44 | void otg_put_transceiver(struct otg_transceiver *x) |
45 | { | 45 | { |
46 | put_device(x->dev); | 46 | if (x) |
47 | put_device(x->dev); | ||
47 | } | 48 | } |
48 | EXPORT_SYMBOL(otg_put_transceiver); | 49 | EXPORT_SYMBOL(otg_put_transceiver); |
49 | 50 | ||
diff --git a/drivers/usb/serial/cyberjack.c b/drivers/usb/serial/cyberjack.c index 858bdd038fbc..dd501bb63ed6 100644 --- a/drivers/usb/serial/cyberjack.c +++ b/drivers/usb/serial/cyberjack.c | |||
@@ -175,13 +175,6 @@ static int cyberjack_open(struct tty_struct *tty, | |||
175 | dbg("%s - usb_clear_halt", __func__); | 175 | dbg("%s - usb_clear_halt", __func__); |
176 | usb_clear_halt(port->serial->dev, port->write_urb->pipe); | 176 | usb_clear_halt(port->serial->dev, port->write_urb->pipe); |
177 | 177 | ||
178 | /* force low_latency on so that our tty_push actually forces | ||
179 | * the data through, otherwise it is scheduled, and with high | ||
180 | * data rates (like with OHCI) data can get lost. | ||
181 | */ | ||
182 | if (tty) | ||
183 | tty->low_latency = 1; | ||
184 | |||
185 | priv = usb_get_serial_port_data(port); | 178 | priv = usb_get_serial_port_data(port); |
186 | spin_lock_irqsave(&priv->lock, flags); | 179 | spin_lock_irqsave(&priv->lock, flags); |
187 | priv->rdtodo = 0; | 180 | priv->rdtodo = 0; |
diff --git a/drivers/usb/serial/cypress_m8.c b/drivers/usb/serial/cypress_m8.c index eae4740d448c..e568710b263f 100644 --- a/drivers/usb/serial/cypress_m8.c +++ b/drivers/usb/serial/cypress_m8.c | |||
@@ -656,10 +656,6 @@ static int cypress_open(struct tty_struct *tty, | |||
656 | priv->rx_flags = 0; | 656 | priv->rx_flags = 0; |
657 | spin_unlock_irqrestore(&priv->lock, flags); | 657 | spin_unlock_irqrestore(&priv->lock, flags); |
658 | 658 | ||
659 | /* setting to zero could cause data loss */ | ||
660 | if (tty) | ||
661 | tty->low_latency = 1; | ||
662 | |||
663 | /* raise both lines and set termios */ | 659 | /* raise both lines and set termios */ |
664 | spin_lock_irqsave(&priv->lock, flags); | 660 | spin_lock_irqsave(&priv->lock, flags); |
665 | priv->line_control = CONTROL_DTR | CONTROL_RTS; | 661 | priv->line_control = CONTROL_DTR | CONTROL_RTS; |
diff --git a/drivers/usb/serial/empeg.c b/drivers/usb/serial/empeg.c index 8a69cce40b6d..c709ec474a80 100644 --- a/drivers/usb/serial/empeg.c +++ b/drivers/usb/serial/empeg.c | |||
@@ -478,12 +478,6 @@ static void empeg_set_termios(struct tty_struct *tty, | |||
478 | termios->c_cflag | 478 | termios->c_cflag |
479 | |= CS8; /* character size 8 bits */ | 479 | |= CS8; /* character size 8 bits */ |
480 | 480 | ||
481 | /* | ||
482 | * Force low_latency on; otherwise the pushes are scheduled; | ||
483 | * this is bad as it opens up the possibility of dropping bytes | ||
484 | * on the floor. We don't want to drop bytes on the floor. :) | ||
485 | */ | ||
486 | tty->low_latency = 1; | ||
487 | tty_encode_baud_rate(tty, 115200, 115200); | 481 | tty_encode_baud_rate(tty, 115200, 115200); |
488 | } | 482 | } |
489 | 483 | ||
diff --git a/drivers/usb/serial/garmin_gps.c b/drivers/usb/serial/garmin_gps.c index a26a0e2cdb4a..586d30ff450b 100644 --- a/drivers/usb/serial/garmin_gps.c +++ b/drivers/usb/serial/garmin_gps.c | |||
@@ -973,14 +973,6 @@ static int garmin_open(struct tty_struct *tty, | |||
973 | 973 | ||
974 | dbg("%s - port %d", __func__, port->number); | 974 | dbg("%s - port %d", __func__, port->number); |
975 | 975 | ||
976 | /* | ||
977 | * Force low_latency on so that our tty_push actually forces the data | ||
978 | * through, otherwise it is scheduled, and with high data rates (like | ||
979 | * with OHCI) data can get lost. | ||
980 | */ | ||
981 | if (tty) | ||
982 | tty->low_latency = 1; | ||
983 | |||
984 | spin_lock_irqsave(&garmin_data_p->lock, flags); | 976 | spin_lock_irqsave(&garmin_data_p->lock, flags); |
985 | garmin_data_p->mode = initial_mode; | 977 | garmin_data_p->mode = initial_mode; |
986 | garmin_data_p->count = 0; | 978 | garmin_data_p->count = 0; |
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index 9d57cace3731..4cec9906ccf3 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c | |||
@@ -122,12 +122,6 @@ int usb_serial_generic_open(struct tty_struct *tty, | |||
122 | 122 | ||
123 | dbg("%s - port %d", __func__, port->number); | 123 | dbg("%s - port %d", __func__, port->number); |
124 | 124 | ||
125 | /* force low_latency on so that our tty_push actually forces the data | ||
126 | through, otherwise it is scheduled, and with high data rates (like | ||
127 | with OHCI) data can get lost. */ | ||
128 | if (tty) | ||
129 | tty->low_latency = 1; | ||
130 | |||
131 | /* clear the throttle flags */ | 125 | /* clear the throttle flags */ |
132 | spin_lock_irqsave(&port->lock, flags); | 126 | spin_lock_irqsave(&port->lock, flags); |
133 | port->throttled = 0; | 127 | port->throttled = 0; |
diff --git a/drivers/usb/serial/io_edgeport.c b/drivers/usb/serial/io_edgeport.c index e85c8c0d1ad9..fb4a73d090f6 100644 --- a/drivers/usb/serial/io_edgeport.c +++ b/drivers/usb/serial/io_edgeport.c | |||
@@ -193,8 +193,6 @@ static const struct divisor_table_entry divisor_table[] = { | |||
193 | /* local variables */ | 193 | /* local variables */ |
194 | static int debug; | 194 | static int debug; |
195 | 195 | ||
196 | static int low_latency = 1; /* tty low latency flag, on by default */ | ||
197 | |||
198 | static atomic_t CmdUrbs; /* Number of outstanding Command Write Urbs */ | 196 | static atomic_t CmdUrbs; /* Number of outstanding Command Write Urbs */ |
199 | 197 | ||
200 | 198 | ||
@@ -867,9 +865,6 @@ static int edge_open(struct tty_struct *tty, | |||
867 | if (edge_port == NULL) | 865 | if (edge_port == NULL) |
868 | return -ENODEV; | 866 | return -ENODEV; |
869 | 867 | ||
870 | if (tty) | ||
871 | tty->low_latency = low_latency; | ||
872 | |||
873 | /* see if we've set up our endpoint info yet (can't set it up | 868 | /* see if we've set up our endpoint info yet (can't set it up |
874 | in edge_startup as the structures were not set up at that time.) */ | 869 | in edge_startup as the structures were not set up at that time.) */ |
875 | serial = port->serial; | 870 | serial = port->serial; |
@@ -3299,6 +3294,3 @@ MODULE_FIRMWARE("edgeport/down2.fw"); | |||
3299 | 3294 | ||
3300 | module_param(debug, bool, S_IRUGO | S_IWUSR); | 3295 | module_param(debug, bool, S_IRUGO | S_IWUSR); |
3301 | MODULE_PARM_DESC(debug, "Debug enabled or not"); | 3296 | MODULE_PARM_DESC(debug, "Debug enabled or not"); |
3302 | |||
3303 | module_param(low_latency, bool, S_IRUGO | S_IWUSR); | ||
3304 | MODULE_PARM_DESC(low_latency, "Low latency enabled or not"); | ||
diff --git a/drivers/usb/serial/io_ti.c b/drivers/usb/serial/io_ti.c index c3cdd00ddc41..513b25e044c1 100644 --- a/drivers/usb/serial/io_ti.c +++ b/drivers/usb/serial/io_ti.c | |||
@@ -76,7 +76,6 @@ struct edgeport_uart_buf_desc { | |||
76 | #define EDGE_READ_URB_STOPPING 1 | 76 | #define EDGE_READ_URB_STOPPING 1 |
77 | #define EDGE_READ_URB_STOPPED 2 | 77 | #define EDGE_READ_URB_STOPPED 2 |
78 | 78 | ||
79 | #define EDGE_LOW_LATENCY 1 | ||
80 | #define EDGE_CLOSING_WAIT 4000 /* in .01 sec */ | 79 | #define EDGE_CLOSING_WAIT 4000 /* in .01 sec */ |
81 | 80 | ||
82 | #define EDGE_OUT_BUF_SIZE 1024 | 81 | #define EDGE_OUT_BUF_SIZE 1024 |
@@ -232,7 +231,6 @@ static unsigned short OperationalBuildNumber; | |||
232 | 231 | ||
233 | static int debug; | 232 | static int debug; |
234 | 233 | ||
235 | static int low_latency = EDGE_LOW_LATENCY; | ||
236 | static int closing_wait = EDGE_CLOSING_WAIT; | 234 | static int closing_wait = EDGE_CLOSING_WAIT; |
237 | static int ignore_cpu_rev; | 235 | static int ignore_cpu_rev; |
238 | static int default_uart_mode; /* RS232 */ | 236 | static int default_uart_mode; /* RS232 */ |
@@ -1850,9 +1848,6 @@ static int edge_open(struct tty_struct *tty, | |||
1850 | if (edge_port == NULL) | 1848 | if (edge_port == NULL) |
1851 | return -ENODEV; | 1849 | return -ENODEV; |
1852 | 1850 | ||
1853 | if (tty) | ||
1854 | tty->low_latency = low_latency; | ||
1855 | |||
1856 | port_number = port->number - port->serial->minor; | 1851 | port_number = port->number - port->serial->minor; |
1857 | switch (port_number) { | 1852 | switch (port_number) { |
1858 | case 0: | 1853 | case 0: |
@@ -3008,9 +3003,6 @@ MODULE_FIRMWARE("edgeport/down3.bin"); | |||
3008 | module_param(debug, bool, S_IRUGO | S_IWUSR); | 3003 | module_param(debug, bool, S_IRUGO | S_IWUSR); |
3009 | MODULE_PARM_DESC(debug, "Debug enabled or not"); | 3004 | MODULE_PARM_DESC(debug, "Debug enabled or not"); |
3010 | 3005 | ||
3011 | module_param(low_latency, bool, S_IRUGO | S_IWUSR); | ||
3012 | MODULE_PARM_DESC(low_latency, "Low latency enabled or not"); | ||
3013 | |||
3014 | module_param(closing_wait, int, S_IRUGO | S_IWUSR); | 3006 | module_param(closing_wait, int, S_IRUGO | S_IWUSR); |
3015 | MODULE_PARM_DESC(closing_wait, "Maximum wait for data to drain, in .01 secs"); | 3007 | MODULE_PARM_DESC(closing_wait, "Maximum wait for data to drain, in .01 secs"); |
3016 | 3008 | ||
diff --git a/drivers/usb/serial/ipaq.c b/drivers/usb/serial/ipaq.c index ef92095b0732..cd62825a9ac3 100644 --- a/drivers/usb/serial/ipaq.c +++ b/drivers/usb/serial/ipaq.c | |||
@@ -631,13 +631,7 @@ static int ipaq_open(struct tty_struct *tty, | |||
631 | priv->free_len += PACKET_SIZE; | 631 | priv->free_len += PACKET_SIZE; |
632 | } | 632 | } |
633 | 633 | ||
634 | /* | ||
635 | * Force low latency on. This will immediately push data to the line | ||
636 | * discipline instead of queueing. | ||
637 | */ | ||
638 | |||
639 | if (tty) { | 634 | if (tty) { |
640 | tty->low_latency = 1; | ||
641 | /* FIXME: These two are bogus */ | 635 | /* FIXME: These two are bogus */ |
642 | tty->raw = 1; | 636 | tty->raw = 1; |
643 | tty->real_raw = 1; | 637 | tty->real_raw = 1; |
diff --git a/drivers/usb/serial/ipw.c b/drivers/usb/serial/ipw.c index f530032ed93d..da2a2b46644a 100644 --- a/drivers/usb/serial/ipw.c +++ b/drivers/usb/serial/ipw.c | |||
@@ -207,9 +207,6 @@ static int ipw_open(struct tty_struct *tty, | |||
207 | if (!buf_flow_init) | 207 | if (!buf_flow_init) |
208 | return -ENOMEM; | 208 | return -ENOMEM; |
209 | 209 | ||
210 | if (tty) | ||
211 | tty->low_latency = 1; | ||
212 | |||
213 | /* --1: Tell the modem to initialize (we think) From sniffs this is | 210 | /* --1: Tell the modem to initialize (we think) From sniffs this is |
214 | * always the first thing that gets sent to the modem during | 211 | * always the first thing that gets sent to the modem during |
215 | * opening of the device */ | 212 | * opening of the device */ |
diff --git a/drivers/usb/serial/iuu_phoenix.c b/drivers/usb/serial/iuu_phoenix.c index 2314c6ae4fc2..4473d442b2aa 100644 --- a/drivers/usb/serial/iuu_phoenix.c +++ b/drivers/usb/serial/iuu_phoenix.c | |||
@@ -1051,7 +1051,6 @@ static int iuu_open(struct tty_struct *tty, | |||
1051 | tty->termios->c_oflag = 0; | 1051 | tty->termios->c_oflag = 0; |
1052 | tty->termios->c_iflag = 0; | 1052 | tty->termios->c_iflag = 0; |
1053 | priv->termios_initialized = 1; | 1053 | priv->termios_initialized = 1; |
1054 | tty->low_latency = 1; | ||
1055 | priv->poll = 0; | 1054 | priv->poll = 0; |
1056 | } | 1055 | } |
1057 | spin_unlock_irqrestore(&priv->lock, flags); | 1056 | spin_unlock_irqrestore(&priv->lock, flags); |
diff --git a/drivers/usb/serial/kobil_sct.c b/drivers/usb/serial/kobil_sct.c index 6286baad9392..c148544953b3 100644 --- a/drivers/usb/serial/kobil_sct.c +++ b/drivers/usb/serial/kobil_sct.c | |||
@@ -231,13 +231,7 @@ static int kobil_open(struct tty_struct *tty, | |||
231 | /* someone sets the dev to 0 if the close method has been called */ | 231 | /* someone sets the dev to 0 if the close method has been called */ |
232 | port->interrupt_in_urb->dev = port->serial->dev; | 232 | port->interrupt_in_urb->dev = port->serial->dev; |
233 | 233 | ||
234 | |||
235 | /* force low_latency on so that our tty_push actually forces | ||
236 | * the data through, otherwise it is scheduled, and with high | ||
237 | * data rates (like with OHCI) data can get lost. | ||
238 | */ | ||
239 | if (tty) { | 234 | if (tty) { |
240 | tty->low_latency = 1; | ||
241 | 235 | ||
242 | /* Default to echo off and other sane device settings */ | 236 | /* Default to echo off and other sane device settings */ |
243 | tty->termios->c_lflag = 0; | 237 | tty->termios->c_lflag = 0; |
diff --git a/drivers/usb/serial/mos7720.c b/drivers/usb/serial/mos7720.c index e772cc0a97fd..24e3b5d4b4d4 100644 --- a/drivers/usb/serial/mos7720.c +++ b/drivers/usb/serial/mos7720.c | |||
@@ -446,13 +446,6 @@ static int mos7720_open(struct tty_struct *tty, | |||
446 | data = 0x0c; | 446 | data = 0x0c; |
447 | send_mos_cmd(serial, MOS_WRITE, port_number, 0x01, &data); | 447 | send_mos_cmd(serial, MOS_WRITE, port_number, 0x01, &data); |
448 | 448 | ||
449 | /* force low_latency on so that our tty_push actually forces * | ||
450 | * the data through,otherwise it is scheduled, and with * | ||
451 | * high data rates (like with OHCI) data can get lost. */ | ||
452 | |||
453 | if (tty) | ||
454 | tty->low_latency = 1; | ||
455 | |||
456 | /* see if we've set up our endpoint info yet * | 449 | /* see if we've set up our endpoint info yet * |
457 | * (can't set it up in mos7720_startup as the * | 450 | * (can't set it up in mos7720_startup as the * |
458 | * structures were not set up at that time.) */ | 451 | * structures were not set up at that time.) */ |
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index 2c20e88a91b3..84fb1dcd30dc 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c | |||
@@ -38,7 +38,7 @@ | |||
38 | /* | 38 | /* |
39 | * Version Information | 39 | * Version Information |
40 | */ | 40 | */ |
41 | #define DRIVER_VERSION "1.3.1" | 41 | #define DRIVER_VERSION "1.3.2" |
42 | #define DRIVER_DESC "Moschip 7840/7820 USB Serial Driver" | 42 | #define DRIVER_DESC "Moschip 7840/7820 USB Serial Driver" |
43 | 43 | ||
44 | /* | 44 | /* |
@@ -123,6 +123,11 @@ | |||
123 | #define BANDB_DEVICE_ID_USOPTL4_4 0xAC44 | 123 | #define BANDB_DEVICE_ID_USOPTL4_4 0xAC44 |
124 | #define BANDB_DEVICE_ID_USOPTL4_2 0xAC42 | 124 | #define BANDB_DEVICE_ID_USOPTL4_2 0xAC42 |
125 | 125 | ||
126 | /* This driver also supports the ATEN UC2324 device since it is mos7840 based | ||
127 | * - if I knew the device id it would also support the ATEN UC2322 */ | ||
128 | #define USB_VENDOR_ID_ATENINTL 0x0557 | ||
129 | #define ATENINTL_DEVICE_ID_UC2324 0x2011 | ||
130 | |||
126 | /* Interrupt Routine Defines */ | 131 | /* Interrupt Routine Defines */ |
127 | 132 | ||
128 | #define SERIAL_IIR_RLS 0x06 | 133 | #define SERIAL_IIR_RLS 0x06 |
@@ -170,6 +175,7 @@ static struct usb_device_id moschip_port_id_table[] = { | |||
170 | {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7820)}, | 175 | {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7820)}, |
171 | {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_4)}, | 176 | {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_4)}, |
172 | {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_2)}, | 177 | {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_2)}, |
178 | {USB_DEVICE(USB_VENDOR_ID_ATENINTL, ATENINTL_DEVICE_ID_UC2324)}, | ||
173 | {} /* terminating entry */ | 179 | {} /* terminating entry */ |
174 | }; | 180 | }; |
175 | 181 | ||
@@ -178,6 +184,7 @@ static __devinitdata struct usb_device_id moschip_id_table_combined[] = { | |||
178 | {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7820)}, | 184 | {USB_DEVICE(USB_VENDOR_ID_MOSCHIP, MOSCHIP_DEVICE_ID_7820)}, |
179 | {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_4)}, | 185 | {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_4)}, |
180 | {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_2)}, | 186 | {USB_DEVICE(USB_VENDOR_ID_BANDB, BANDB_DEVICE_ID_USOPTL4_2)}, |
187 | {USB_DEVICE(USB_VENDOR_ID_ATENINTL, ATENINTL_DEVICE_ID_UC2324)}, | ||
181 | {} /* terminating entry */ | 188 | {} /* terminating entry */ |
182 | }; | 189 | }; |
183 | 190 | ||
@@ -1000,12 +1007,6 @@ static int mos7840_open(struct tty_struct *tty, | |||
1000 | status = mos7840_set_reg_sync(port, mos7840_port->ControlRegOffset, | 1007 | status = mos7840_set_reg_sync(port, mos7840_port->ControlRegOffset, |
1001 | Data); | 1008 | Data); |
1002 | 1009 | ||
1003 | /* force low_latency on so that our tty_push actually forces * | ||
1004 | * the data through,otherwise it is scheduled, and with * | ||
1005 | * high data rates (like with OHCI) data can get lost. */ | ||
1006 | if (tty) | ||
1007 | tty->low_latency = 1; | ||
1008 | |||
1009 | /* Check to see if we've set up our endpoint info yet * | 1010 | /* Check to see if we've set up our endpoint info yet * |
1010 | * (can't set it up in mos7840_startup as the structures * | 1011 | * (can't set it up in mos7840_startup as the structures * |
1011 | * were not set up at that time.) */ | 1012 | * were not set up at that time.) */ |
@@ -2477,9 +2478,14 @@ static int mos7840_startup(struct usb_serial *serial) | |||
2477 | mos7840_set_port_private(serial->port[i], mos7840_port); | 2478 | mos7840_set_port_private(serial->port[i], mos7840_port); |
2478 | spin_lock_init(&mos7840_port->pool_lock); | 2479 | spin_lock_init(&mos7840_port->pool_lock); |
2479 | 2480 | ||
2480 | mos7840_port->port_num = ((serial->port[i]->number - | 2481 | /* minor is not initialised until later by |
2481 | (serial->port[i]->serial->minor)) + | 2482 | * usb-serial.c:get_free_serial() and cannot therefore be used |
2482 | 1); | 2483 | * to index device instances */ |
2484 | mos7840_port->port_num = i + 1; | ||
2485 | dbg ("serial->port[i]->number = %d", serial->port[i]->number); | ||
2486 | dbg ("serial->port[i]->serial->minor = %d", serial->port[i]->serial->minor); | ||
2487 | dbg ("mos7840_port->port_num = %d", mos7840_port->port_num); | ||
2488 | dbg ("serial->minor = %d", serial->minor); | ||
2483 | 2489 | ||
2484 | if (mos7840_port->port_num == 1) { | 2490 | if (mos7840_port->port_num == 1) { |
2485 | mos7840_port->SpRegOffset = 0x0; | 2491 | mos7840_port->SpRegOffset = 0x0; |
@@ -2690,13 +2696,16 @@ static void mos7840_shutdown(struct usb_serial *serial) | |||
2690 | 2696 | ||
2691 | for (i = 0; i < serial->num_ports; ++i) { | 2697 | for (i = 0; i < serial->num_ports; ++i) { |
2692 | mos7840_port = mos7840_get_port_private(serial->port[i]); | 2698 | mos7840_port = mos7840_get_port_private(serial->port[i]); |
2693 | spin_lock_irqsave(&mos7840_port->pool_lock, flags); | 2699 | dbg ("mos7840_port %d = %p", i, mos7840_port); |
2694 | mos7840_port->zombie = 1; | 2700 | if (mos7840_port) { |
2695 | spin_unlock_irqrestore(&mos7840_port->pool_lock, flags); | 2701 | spin_lock_irqsave(&mos7840_port->pool_lock, flags); |
2696 | usb_kill_urb(mos7840_port->control_urb); | 2702 | mos7840_port->zombie = 1; |
2697 | kfree(mos7840_port->ctrl_buf); | 2703 | spin_unlock_irqrestore(&mos7840_port->pool_lock, flags); |
2698 | kfree(mos7840_port->dr); | 2704 | usb_kill_urb(mos7840_port->control_urb); |
2699 | kfree(mos7840_port); | 2705 | kfree(mos7840_port->ctrl_buf); |
2706 | kfree(mos7840_port->dr); | ||
2707 | kfree(mos7840_port); | ||
2708 | } | ||
2700 | mos7840_set_port_private(serial->port[i], NULL); | 2709 | mos7840_set_port_private(serial->port[i], NULL); |
2701 | } | 2710 | } |
2702 | 2711 | ||
diff --git a/drivers/usb/serial/opticon.c b/drivers/usb/serial/opticon.c index 839583dc8b6a..b500ad10b758 100644 --- a/drivers/usb/serial/opticon.c +++ b/drivers/usb/serial/opticon.c | |||
@@ -159,14 +159,6 @@ static int opticon_open(struct tty_struct *tty, struct usb_serial_port *port, | |||
159 | priv->port = port; | 159 | priv->port = port; |
160 | spin_unlock_irqrestore(&priv->lock, flags); | 160 | spin_unlock_irqrestore(&priv->lock, flags); |
161 | 161 | ||
162 | /* | ||
163 | * Force low_latency on so that our tty_push actually forces the data | ||
164 | * through, otherwise it is scheduled, and with high data rates (like | ||
165 | * with OHCI) data can get lost. | ||
166 | */ | ||
167 | if (tty) | ||
168 | tty->low_latency = 1; | ||
169 | |||
170 | /* Start reading from the device */ | 162 | /* Start reading from the device */ |
171 | usb_fill_bulk_urb(priv->bulk_read_urb, priv->udev, | 163 | usb_fill_bulk_urb(priv->bulk_read_urb, priv->udev, |
172 | usb_rcvbulkpipe(priv->udev, | 164 | usb_rcvbulkpipe(priv->udev, |
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 47bd070f24b7..7817b82889ca 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -936,9 +936,6 @@ static int option_open(struct tty_struct *tty, | |||
936 | usb_pipeout(urb->pipe), 0); */ | 936 | usb_pipeout(urb->pipe), 0); */ |
937 | } | 937 | } |
938 | 938 | ||
939 | if (tty) | ||
940 | tty->low_latency = 1; | ||
941 | |||
942 | option_send_setup(tty, port); | 939 | option_send_setup(tty, port); |
943 | 940 | ||
944 | return 0; | 941 | return 0; |
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index d9bf9a5c20ec..913225c61610 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c | |||
@@ -14,7 +14,7 @@ | |||
14 | Whom based his on the Keyspan driver by Hugh Blemings <hugh@blemings.org> | 14 | Whom based his on the Keyspan driver by Hugh Blemings <hugh@blemings.org> |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #define DRIVER_VERSION "v.1.3.2" | 17 | #define DRIVER_VERSION "v.1.3.3" |
18 | #define DRIVER_AUTHOR "Kevin Lloyd <klloyd@sierrawireless.com>" | 18 | #define DRIVER_AUTHOR "Kevin Lloyd <klloyd@sierrawireless.com>" |
19 | #define DRIVER_DESC "USB Driver for Sierra Wireless USB modems" | 19 | #define DRIVER_DESC "USB Driver for Sierra Wireless USB modems" |
20 | 20 | ||
@@ -259,9 +259,21 @@ static int sierra_send_setup(struct tty_struct *tty, | |||
259 | val |= 0x02; | 259 | val |= 0x02; |
260 | 260 | ||
261 | /* If composite device then properly report interface */ | 261 | /* If composite device then properly report interface */ |
262 | if (serial->num_ports == 1) | 262 | if (serial->num_ports == 1) { |
263 | interface = sierra_calc_interface(serial); | 263 | interface = sierra_calc_interface(serial); |
264 | 264 | ||
265 | /* Control message is sent only to interfaces with | ||
266 | * interrupt_in endpoints | ||
267 | */ | ||
268 | if (port->interrupt_in_urb) { | ||
269 | /* send control message */ | ||
270 | return usb_control_msg(serial->dev, | ||
271 | usb_rcvctrlpipe(serial->dev, 0), | ||
272 | 0x22, 0x21, val, interface, | ||
273 | NULL, 0, USB_CTRL_SET_TIMEOUT); | ||
274 | } | ||
275 | } | ||
276 | |||
265 | /* Otherwise the need to do non-composite mapping */ | 277 | /* Otherwise the need to do non-composite mapping */ |
266 | else { | 278 | else { |
267 | if (port->bulk_out_endpointAddress == 2) | 279 | if (port->bulk_out_endpointAddress == 2) |
@@ -270,12 +282,13 @@ static int sierra_send_setup(struct tty_struct *tty, | |||
270 | interface = 1; | 282 | interface = 1; |
271 | else if (port->bulk_out_endpointAddress == 5) | 283 | else if (port->bulk_out_endpointAddress == 5) |
272 | interface = 2; | 284 | interface = 2; |
273 | } | ||
274 | 285 | ||
275 | return usb_control_msg(serial->dev, | 286 | return usb_control_msg(serial->dev, |
276 | usb_rcvctrlpipe(serial->dev, 0), | 287 | usb_rcvctrlpipe(serial->dev, 0), |
277 | 0x22, 0x21, val, interface, | 288 | 0x22, 0x21, val, interface, |
278 | NULL, 0, USB_CTRL_SET_TIMEOUT); | 289 | NULL, 0, USB_CTRL_SET_TIMEOUT); |
290 | |||
291 | } | ||
279 | } | 292 | } |
280 | 293 | ||
281 | return 0; | 294 | return 0; |
@@ -585,9 +598,6 @@ static int sierra_open(struct tty_struct *tty, | |||
585 | } | 598 | } |
586 | } | 599 | } |
587 | 600 | ||
588 | if (tty) | ||
589 | tty->low_latency = 1; | ||
590 | |||
591 | sierra_send_setup(tty, port); | 601 | sierra_send_setup(tty, port); |
592 | 602 | ||
593 | /* start up the interrupt endpoint if we have one */ | 603 | /* start up the interrupt endpoint if we have one */ |
diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c index 9c4c700c7cc6..0a64bac306ee 100644 --- a/drivers/usb/serial/ti_usb_3410_5052.c +++ b/drivers/usb/serial/ti_usb_3410_5052.c | |||
@@ -50,11 +50,10 @@ | |||
50 | 50 | ||
51 | #define TI_TRANSFER_TIMEOUT 2 | 51 | #define TI_TRANSFER_TIMEOUT 2 |
52 | 52 | ||
53 | #define TI_DEFAULT_LOW_LATENCY 0 | ||
54 | #define TI_DEFAULT_CLOSING_WAIT 4000 /* in .01 secs */ | 53 | #define TI_DEFAULT_CLOSING_WAIT 4000 /* in .01 secs */ |
55 | 54 | ||
56 | /* supported setserial flags */ | 55 | /* supported setserial flags */ |
57 | #define TI_SET_SERIAL_FLAGS (ASYNC_LOW_LATENCY) | 56 | #define TI_SET_SERIAL_FLAGS 0 |
58 | 57 | ||
59 | /* read urb states */ | 58 | /* read urb states */ |
60 | #define TI_READ_URB_RUNNING 0 | 59 | #define TI_READ_URB_RUNNING 0 |
@@ -161,7 +160,6 @@ static int ti_buf_get(struct circ_buf *cb, char *buf, int count); | |||
161 | 160 | ||
162 | /* module parameters */ | 161 | /* module parameters */ |
163 | static int debug; | 162 | static int debug; |
164 | static int low_latency = TI_DEFAULT_LOW_LATENCY; | ||
165 | static int closing_wait = TI_DEFAULT_CLOSING_WAIT; | 163 | static int closing_wait = TI_DEFAULT_CLOSING_WAIT; |
166 | static ushort vendor_3410[TI_EXTRA_VID_PID_COUNT]; | 164 | static ushort vendor_3410[TI_EXTRA_VID_PID_COUNT]; |
167 | static unsigned int vendor_3410_count; | 165 | static unsigned int vendor_3410_count; |
@@ -296,10 +294,6 @@ MODULE_FIRMWARE("mts_edge.fw"); | |||
296 | module_param(debug, bool, S_IRUGO | S_IWUSR); | 294 | module_param(debug, bool, S_IRUGO | S_IWUSR); |
297 | MODULE_PARM_DESC(debug, "Enable debugging, 0=no, 1=yes"); | 295 | MODULE_PARM_DESC(debug, "Enable debugging, 0=no, 1=yes"); |
298 | 296 | ||
299 | module_param(low_latency, bool, S_IRUGO | S_IWUSR); | ||
300 | MODULE_PARM_DESC(low_latency, | ||
301 | "TTY low_latency flag, 0=off, 1=on, default is off"); | ||
302 | |||
303 | module_param(closing_wait, int, S_IRUGO | S_IWUSR); | 297 | module_param(closing_wait, int, S_IRUGO | S_IWUSR); |
304 | MODULE_PARM_DESC(closing_wait, | 298 | MODULE_PARM_DESC(closing_wait, |
305 | "Maximum wait for data to drain in close, in .01 secs, default is 4000"); | 299 | "Maximum wait for data to drain in close, in .01 secs, default is 4000"); |
@@ -448,7 +442,6 @@ static int ti_startup(struct usb_serial *serial) | |||
448 | spin_lock_init(&tport->tp_lock); | 442 | spin_lock_init(&tport->tp_lock); |
449 | tport->tp_uart_base_addr = (i == 0 ? | 443 | tport->tp_uart_base_addr = (i == 0 ? |
450 | TI_UART1_BASE_ADDR : TI_UART2_BASE_ADDR); | 444 | TI_UART1_BASE_ADDR : TI_UART2_BASE_ADDR); |
451 | tport->tp_flags = low_latency ? ASYNC_LOW_LATENCY : 0; | ||
452 | tport->tp_closing_wait = closing_wait; | 445 | tport->tp_closing_wait = closing_wait; |
453 | init_waitqueue_head(&tport->tp_msr_wait); | 446 | init_waitqueue_head(&tport->tp_msr_wait); |
454 | init_waitqueue_head(&tport->tp_write_wait); | 447 | init_waitqueue_head(&tport->tp_write_wait); |
@@ -528,10 +521,6 @@ static int ti_open(struct tty_struct *tty, | |||
528 | if (mutex_lock_interruptible(&tdev->td_open_close_lock)) | 521 | if (mutex_lock_interruptible(&tdev->td_open_close_lock)) |
529 | return -ERESTARTSYS; | 522 | return -ERESTARTSYS; |
530 | 523 | ||
531 | if (tty) | ||
532 | tty->low_latency = | ||
533 | (tport->tp_flags & ASYNC_LOW_LATENCY) ? 1 : 0; | ||
534 | |||
535 | port_number = port->number - port->serial->minor; | 524 | port_number = port->number - port->serial->minor; |
536 | 525 | ||
537 | memset(&(tport->tp_icount), 0x00, sizeof(tport->tp_icount)); | 526 | memset(&(tport->tp_icount), 0x00, sizeof(tport->tp_icount)); |
@@ -1454,7 +1443,6 @@ static int ti_set_serial_info(struct tty_struct *tty, struct ti_port *tport, | |||
1454 | return -EFAULT; | 1443 | return -EFAULT; |
1455 | 1444 | ||
1456 | tport->tp_flags = new_serial.flags & TI_SET_SERIAL_FLAGS; | 1445 | tport->tp_flags = new_serial.flags & TI_SET_SERIAL_FLAGS; |
1457 | tty->low_latency = (tport->tp_flags & ASYNC_LOW_LATENCY) ? 1 : 0; | ||
1458 | tport->tp_closing_wait = new_serial.closing_wait; | 1446 | tport->tp_closing_wait = new_serial.closing_wait; |
1459 | 1447 | ||
1460 | return 0; | 1448 | return 0; |
diff --git a/drivers/usb/serial/usb-serial.c b/drivers/usb/serial/usb-serial.c index 2a70563bbee1..0a566eea49c0 100644 --- a/drivers/usb/serial/usb-serial.c +++ b/drivers/usb/serial/usb-serial.c | |||
@@ -137,22 +137,10 @@ static void destroy_serial(struct kref *kref) | |||
137 | 137 | ||
138 | dbg("%s - %s", __func__, serial->type->description); | 138 | dbg("%s - %s", __func__, serial->type->description); |
139 | 139 | ||
140 | serial->type->shutdown(serial); | ||
141 | |||
142 | /* return the minor range that this device had */ | 140 | /* return the minor range that this device had */ |
143 | if (serial->minor != SERIAL_TTY_NO_MINOR) | 141 | if (serial->minor != SERIAL_TTY_NO_MINOR) |
144 | return_serial(serial); | 142 | return_serial(serial); |
145 | 143 | ||
146 | for (i = 0; i < serial->num_ports; ++i) | ||
147 | serial->port[i]->port.count = 0; | ||
148 | |||
149 | /* the ports are cleaned up and released in port_release() */ | ||
150 | for (i = 0; i < serial->num_ports; ++i) | ||
151 | if (serial->port[i]->dev.parent != NULL) { | ||
152 | device_unregister(&serial->port[i]->dev); | ||
153 | serial->port[i] = NULL; | ||
154 | } | ||
155 | |||
156 | /* If this is a "fake" port, we have to clean it up here, as it will | 144 | /* If this is a "fake" port, we have to clean it up here, as it will |
157 | * not get cleaned up in port_release() as it was never registered with | 145 | * not get cleaned up in port_release() as it was never registered with |
158 | * the driver core */ | 146 | * the driver core */ |
@@ -187,7 +175,7 @@ static int serial_open (struct tty_struct *tty, struct file *filp) | |||
187 | struct usb_serial *serial; | 175 | struct usb_serial *serial; |
188 | struct usb_serial_port *port; | 176 | struct usb_serial_port *port; |
189 | unsigned int portNumber; | 177 | unsigned int portNumber; |
190 | int retval; | 178 | int retval = 0; |
191 | 179 | ||
192 | dbg("%s", __func__); | 180 | dbg("%s", __func__); |
193 | 181 | ||
@@ -198,21 +186,24 @@ static int serial_open (struct tty_struct *tty, struct file *filp) | |||
198 | return -ENODEV; | 186 | return -ENODEV; |
199 | } | 187 | } |
200 | 188 | ||
189 | mutex_lock(&serial->disc_mutex); | ||
201 | portNumber = tty->index - serial->minor; | 190 | portNumber = tty->index - serial->minor; |
202 | port = serial->port[portNumber]; | 191 | port = serial->port[portNumber]; |
203 | if (!port) { | 192 | if (!port || serial->disconnected) |
204 | retval = -ENODEV; | ||
205 | goto bailout_kref_put; | ||
206 | } | ||
207 | |||
208 | if (port->serial->disconnected) { | ||
209 | retval = -ENODEV; | 193 | retval = -ENODEV; |
210 | goto bailout_kref_put; | 194 | else |
211 | } | 195 | get_device(&port->dev); |
196 | /* | ||
197 | * Note: Our locking order requirement does not allow port->mutex | ||
198 | * to be acquired while serial->disc_mutex is held. | ||
199 | */ | ||
200 | mutex_unlock(&serial->disc_mutex); | ||
201 | if (retval) | ||
202 | goto bailout_serial_put; | ||
212 | 203 | ||
213 | if (mutex_lock_interruptible(&port->mutex)) { | 204 | if (mutex_lock_interruptible(&port->mutex)) { |
214 | retval = -ERESTARTSYS; | 205 | retval = -ERESTARTSYS; |
215 | goto bailout_kref_put; | 206 | goto bailout_port_put; |
216 | } | 207 | } |
217 | 208 | ||
218 | ++port->port.count; | 209 | ++port->port.count; |
@@ -232,14 +223,20 @@ static int serial_open (struct tty_struct *tty, struct file *filp) | |||
232 | goto bailout_mutex_unlock; | 223 | goto bailout_mutex_unlock; |
233 | } | 224 | } |
234 | 225 | ||
235 | retval = usb_autopm_get_interface(serial->interface); | 226 | mutex_lock(&serial->disc_mutex); |
227 | if (serial->disconnected) | ||
228 | retval = -ENODEV; | ||
229 | else | ||
230 | retval = usb_autopm_get_interface(serial->interface); | ||
236 | if (retval) | 231 | if (retval) |
237 | goto bailout_module_put; | 232 | goto bailout_module_put; |
233 | |||
238 | /* only call the device specific open if this | 234 | /* only call the device specific open if this |
239 | * is the first time the port is opened */ | 235 | * is the first time the port is opened */ |
240 | retval = serial->type->open(tty, port, filp); | 236 | retval = serial->type->open(tty, port, filp); |
241 | if (retval) | 237 | if (retval) |
242 | goto bailout_interface_put; | 238 | goto bailout_interface_put; |
239 | mutex_unlock(&serial->disc_mutex); | ||
243 | } | 240 | } |
244 | 241 | ||
245 | mutex_unlock(&port->mutex); | 242 | mutex_unlock(&port->mutex); |
@@ -248,13 +245,16 @@ static int serial_open (struct tty_struct *tty, struct file *filp) | |||
248 | bailout_interface_put: | 245 | bailout_interface_put: |
249 | usb_autopm_put_interface(serial->interface); | 246 | usb_autopm_put_interface(serial->interface); |
250 | bailout_module_put: | 247 | bailout_module_put: |
248 | mutex_unlock(&serial->disc_mutex); | ||
251 | module_put(serial->type->driver.owner); | 249 | module_put(serial->type->driver.owner); |
252 | bailout_mutex_unlock: | 250 | bailout_mutex_unlock: |
253 | port->port.count = 0; | 251 | port->port.count = 0; |
254 | tty->driver_data = NULL; | 252 | tty->driver_data = NULL; |
255 | tty_port_tty_set(&port->port, NULL); | 253 | tty_port_tty_set(&port->port, NULL); |
256 | mutex_unlock(&port->mutex); | 254 | mutex_unlock(&port->mutex); |
257 | bailout_kref_put: | 255 | bailout_port_put: |
256 | put_device(&port->dev); | ||
257 | bailout_serial_put: | ||
258 | usb_serial_put(serial); | 258 | usb_serial_put(serial); |
259 | return retval; | 259 | return retval; |
260 | } | 260 | } |
@@ -262,6 +262,9 @@ bailout_kref_put: | |||
262 | static void serial_close(struct tty_struct *tty, struct file *filp) | 262 | static void serial_close(struct tty_struct *tty, struct file *filp) |
263 | { | 263 | { |
264 | struct usb_serial_port *port = tty->driver_data; | 264 | struct usb_serial_port *port = tty->driver_data; |
265 | struct usb_serial *serial; | ||
266 | struct module *owner; | ||
267 | int count; | ||
265 | 268 | ||
266 | if (!port) | 269 | if (!port) |
267 | return; | 270 | return; |
@@ -269,6 +272,8 @@ static void serial_close(struct tty_struct *tty, struct file *filp) | |||
269 | dbg("%s - port %d", __func__, port->number); | 272 | dbg("%s - port %d", __func__, port->number); |
270 | 273 | ||
271 | mutex_lock(&port->mutex); | 274 | mutex_lock(&port->mutex); |
275 | serial = port->serial; | ||
276 | owner = serial->type->driver.owner; | ||
272 | 277 | ||
273 | if (port->port.count == 0) { | 278 | if (port->port.count == 0) { |
274 | mutex_unlock(&port->mutex); | 279 | mutex_unlock(&port->mutex); |
@@ -281,7 +286,7 @@ static void serial_close(struct tty_struct *tty, struct file *filp) | |||
281 | * this before we drop the port count. The call is protected | 286 | * this before we drop the port count. The call is protected |
282 | * by the port mutex | 287 | * by the port mutex |
283 | */ | 288 | */ |
284 | port->serial->type->close(tty, port, filp); | 289 | serial->type->close(tty, port, filp); |
285 | 290 | ||
286 | if (port->port.count == (port->console ? 2 : 1)) { | 291 | if (port->port.count == (port->console ? 2 : 1)) { |
287 | struct tty_struct *tty = tty_port_tty_get(&port->port); | 292 | struct tty_struct *tty = tty_port_tty_get(&port->port); |
@@ -295,17 +300,23 @@ static void serial_close(struct tty_struct *tty, struct file *filp) | |||
295 | } | 300 | } |
296 | } | 301 | } |
297 | 302 | ||
298 | if (port->port.count == 1) { | ||
299 | mutex_lock(&port->serial->disc_mutex); | ||
300 | if (!port->serial->disconnected) | ||
301 | usb_autopm_put_interface(port->serial->interface); | ||
302 | mutex_unlock(&port->serial->disc_mutex); | ||
303 | module_put(port->serial->type->driver.owner); | ||
304 | } | ||
305 | --port->port.count; | 303 | --port->port.count; |
306 | 304 | count = port->port.count; | |
307 | mutex_unlock(&port->mutex); | 305 | mutex_unlock(&port->mutex); |
308 | usb_serial_put(port->serial); | 306 | put_device(&port->dev); |
307 | |||
308 | /* Mustn't dereference port any more */ | ||
309 | if (count == 0) { | ||
310 | mutex_lock(&serial->disc_mutex); | ||
311 | if (!serial->disconnected) | ||
312 | usb_autopm_put_interface(serial->interface); | ||
313 | mutex_unlock(&serial->disc_mutex); | ||
314 | } | ||
315 | usb_serial_put(serial); | ||
316 | |||
317 | /* Mustn't dereference serial any more */ | ||
318 | if (count == 0) | ||
319 | module_put(owner); | ||
309 | } | 320 | } |
310 | 321 | ||
311 | static int serial_write(struct tty_struct *tty, const unsigned char *buf, | 322 | static int serial_write(struct tty_struct *tty, const unsigned char *buf, |
@@ -549,7 +560,13 @@ static void kill_traffic(struct usb_serial_port *port) | |||
549 | 560 | ||
550 | static void port_free(struct usb_serial_port *port) | 561 | static void port_free(struct usb_serial_port *port) |
551 | { | 562 | { |
563 | /* | ||
564 | * Stop all the traffic before cancelling the work, so that | ||
565 | * nobody will restart it by calling usb_serial_port_softint. | ||
566 | */ | ||
552 | kill_traffic(port); | 567 | kill_traffic(port); |
568 | cancel_work_sync(&port->work); | ||
569 | |||
553 | usb_free_urb(port->read_urb); | 570 | usb_free_urb(port->read_urb); |
554 | usb_free_urb(port->write_urb); | 571 | usb_free_urb(port->write_urb); |
555 | usb_free_urb(port->interrupt_in_urb); | 572 | usb_free_urb(port->interrupt_in_urb); |
@@ -558,7 +575,6 @@ static void port_free(struct usb_serial_port *port) | |||
558 | kfree(port->bulk_out_buffer); | 575 | kfree(port->bulk_out_buffer); |
559 | kfree(port->interrupt_in_buffer); | 576 | kfree(port->interrupt_in_buffer); |
560 | kfree(port->interrupt_out_buffer); | 577 | kfree(port->interrupt_out_buffer); |
561 | flush_scheduled_work(); /* port->work */ | ||
562 | kfree(port); | 578 | kfree(port); |
563 | } | 579 | } |
564 | 580 | ||
@@ -1043,6 +1059,12 @@ void usb_serial_disconnect(struct usb_interface *interface) | |||
1043 | usb_set_intfdata(interface, NULL); | 1059 | usb_set_intfdata(interface, NULL); |
1044 | /* must set a flag, to signal subdrivers */ | 1060 | /* must set a flag, to signal subdrivers */ |
1045 | serial->disconnected = 1; | 1061 | serial->disconnected = 1; |
1062 | mutex_unlock(&serial->disc_mutex); | ||
1063 | |||
1064 | /* Unfortunately, many of the sub-drivers expect the port structures | ||
1065 | * to exist when their shutdown method is called, so we have to go | ||
1066 | * through this awkward two-step unregistration procedure. | ||
1067 | */ | ||
1046 | for (i = 0; i < serial->num_ports; ++i) { | 1068 | for (i = 0; i < serial->num_ports; ++i) { |
1047 | port = serial->port[i]; | 1069 | port = serial->port[i]; |
1048 | if (port) { | 1070 | if (port) { |
@@ -1052,11 +1074,21 @@ void usb_serial_disconnect(struct usb_interface *interface) | |||
1052 | tty_kref_put(tty); | 1074 | tty_kref_put(tty); |
1053 | } | 1075 | } |
1054 | kill_traffic(port); | 1076 | kill_traffic(port); |
1077 | cancel_work_sync(&port->work); | ||
1078 | device_del(&port->dev); | ||
1079 | } | ||
1080 | } | ||
1081 | serial->type->shutdown(serial); | ||
1082 | for (i = 0; i < serial->num_ports; ++i) { | ||
1083 | port = serial->port[i]; | ||
1084 | if (port) { | ||
1085 | put_device(&port->dev); | ||
1086 | serial->port[i] = NULL; | ||
1055 | } | 1087 | } |
1056 | } | 1088 | } |
1089 | |||
1057 | /* let the last holder of this object | 1090 | /* let the last holder of this object |
1058 | * cause it to be cleaned up */ | 1091 | * cause it to be cleaned up */ |
1059 | mutex_unlock(&serial->disc_mutex); | ||
1060 | usb_serial_put(serial); | 1092 | usb_serial_put(serial); |
1061 | dev_info(dev, "device disconnected\n"); | 1093 | dev_info(dev, "device disconnected\n"); |
1062 | } | 1094 | } |
diff --git a/drivers/usb/serial/visor.c b/drivers/usb/serial/visor.c index 4facce3d9364..5ac414bda718 100644 --- a/drivers/usb/serial/visor.c +++ b/drivers/usb/serial/visor.c | |||
@@ -296,14 +296,6 @@ static int visor_open(struct tty_struct *tty, struct usb_serial_port *port, | |||
296 | priv->throttled = 0; | 296 | priv->throttled = 0; |
297 | spin_unlock_irqrestore(&priv->lock, flags); | 297 | spin_unlock_irqrestore(&priv->lock, flags); |
298 | 298 | ||
299 | /* | ||
300 | * Force low_latency on so that our tty_push actually forces the data | ||
301 | * through, otherwise it is scheduled, and with high data rates (like | ||
302 | * with OHCI) data can get lost. | ||
303 | */ | ||
304 | if (tty) | ||
305 | tty->low_latency = 1; | ||
306 | |||
307 | /* Start reading from the device */ | 299 | /* Start reading from the device */ |
308 | usb_fill_bulk_urb(port->read_urb, serial->dev, | 300 | usb_fill_bulk_urb(port->read_urb, serial->dev, |
309 | usb_rcvbulkpipe(serial->dev, | 301 | usb_rcvbulkpipe(serial->dev, |
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index 96db479d1165..fa65a3b08601 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
@@ -1851,6 +1851,12 @@ UNUSUAL_DEV( 0xed06, 0x4500, 0x0001, 0x0001, | |||
1851 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 1851 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
1852 | US_FL_CAPACITY_HEURISTICS), | 1852 | US_FL_CAPACITY_HEURISTICS), |
1853 | 1853 | ||
1854 | /* Reported by Alessio Treglia <quadrispro@ubuntu.com> */ | ||
1855 | UNUSUAL_DEV( 0xed10, 0x7636, 0x0001, 0x0001, | ||
1856 | "TGE", | ||
1857 | "Digital MP3 Audio Player", | ||
1858 | US_SC_DEVICE, US_PR_DEVICE, NULL, US_FL_NOT_LOCKABLE ), | ||
1859 | |||
1854 | /* Control/Bulk transport for all SubClass values */ | 1860 | /* Control/Bulk transport for all SubClass values */ |
1855 | USUAL_DEV(US_SC_RBC, US_PR_CB, USB_US_TYPE_STOR), | 1861 | USUAL_DEV(US_SC_RBC, US_PR_CB, USB_US_TYPE_STOR), |
1856 | USUAL_DEV(US_SC_8020, US_PR_CB, USB_US_TYPE_STOR), | 1862 | USUAL_DEV(US_SC_8020, US_PR_CB, USB_US_TYPE_STOR), |
diff --git a/include/linux/usb/musb.h b/include/linux/usb/musb.h index d6aad0ea6033..d43755669261 100644 --- a/include/linux/usb/musb.h +++ b/include/linux/usb/musb.h | |||
@@ -7,6 +7,9 @@ | |||
7 | * key configuration differences between boards. | 7 | * key configuration differences between boards. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #ifndef __LINUX_USB_MUSB_H | ||
11 | #define __LINUX_USB_MUSB_H | ||
12 | |||
10 | /* The USB role is defined by the connector used on the board, so long as | 13 | /* The USB role is defined by the connector used on the board, so long as |
11 | * standards are being followed. (Developer boards sometimes won't.) | 14 | * standards are being followed. (Developer boards sometimes won't.) |
12 | */ | 15 | */ |
@@ -101,3 +104,5 @@ extern int __init tusb6010_setup_interface( | |||
101 | extern int tusb6010_platform_retime(unsigned is_refclk); | 104 | extern int tusb6010_platform_retime(unsigned is_refclk); |
102 | 105 | ||
103 | #endif /* OMAP2 */ | 106 | #endif /* OMAP2 */ |
107 | |||
108 | #endif /* __LINUX_USB_MUSB_H */ | ||