diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2009-07-09 12:58:43 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-07-12 18:16:40 -0400 |
commit | f092c240494f2d807401d93f95f683909b90af96 (patch) | |
tree | ae123a40cb9957c1ff47f832a500ae4343cf5a6e /drivers/usb/serial | |
parent | 4d2fae8b3597bc787f1f1c06637ce5ab8187e5a7 (diff) |
USB: option: remove unnecessary and erroneous code
This patch (as1264) removes a bunch of unnecessary and erroneous stuff
from the option USB-serial driver. Clearly there's no need to verify
that the device pointer stored in the URBs is right or to store the
same pointer over again. After all, the pointer can't change once it
has been set up.
There's also no need to call usb_clear_halt for the IN endpoint
multiple times -- in fact, doing so is an error since every time after
the first there will be active URBs queued for that endpoint. Since
the Clear-Halts don't appear to be needed at all, the patch simply
removes them.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/serial')
-rw-r--r-- | drivers/usb/serial/option.c | 27 |
1 files changed, 1 insertions, 26 deletions
diff --git a/drivers/usb/serial/option.c b/drivers/usb/serial/option.c index 4526064752f..98262dd552b 100644 --- a/drivers/usb/serial/option.c +++ b/drivers/usb/serial/option.c | |||
@@ -748,7 +748,6 @@ static int option_write(struct tty_struct *tty, struct usb_serial_port *port, | |||
748 | memcpy(this_urb->transfer_buffer, buf, todo); | 748 | memcpy(this_urb->transfer_buffer, buf, todo); |
749 | this_urb->transfer_buffer_length = todo; | 749 | this_urb->transfer_buffer_length = todo; |
750 | 750 | ||
751 | this_urb->dev = port->serial->dev; | ||
752 | err = usb_submit_urb(this_urb, GFP_ATOMIC); | 751 | err = usb_submit_urb(this_urb, GFP_ATOMIC); |
753 | if (err) { | 752 | if (err) { |
754 | dbg("usb_submit_urb %p (write bulk) failed " | 753 | dbg("usb_submit_urb %p (write bulk) failed " |
@@ -876,7 +875,6 @@ static void option_instat_callback(struct urb *urb) | |||
876 | 875 | ||
877 | /* Resubmit urb so we continue receiving IRQ data */ | 876 | /* Resubmit urb so we continue receiving IRQ data */ |
878 | if (status != -ESHUTDOWN && status != -ENOENT) { | 877 | if (status != -ESHUTDOWN && status != -ENOENT) { |
879 | urb->dev = serial->dev; | ||
880 | err = usb_submit_urb(urb, GFP_ATOMIC); | 878 | err = usb_submit_urb(urb, GFP_ATOMIC); |
881 | if (err) | 879 | if (err) |
882 | dbg("%s: resubmit intr urb failed. (%d)", | 880 | dbg("%s: resubmit intr urb failed. (%d)", |
@@ -937,23 +935,11 @@ static int option_open(struct tty_struct *tty, | |||
937 | 935 | ||
938 | dbg("%s", __func__); | 936 | dbg("%s", __func__); |
939 | 937 | ||
940 | /* Reset low level data toggle and start reading from endpoints */ | 938 | /* Start reading from the IN endpoint */ |
941 | for (i = 0; i < N_IN_URB; i++) { | 939 | for (i = 0; i < N_IN_URB; i++) { |
942 | urb = portdata->in_urbs[i]; | 940 | urb = portdata->in_urbs[i]; |
943 | if (!urb) | 941 | if (!urb) |
944 | continue; | 942 | continue; |
945 | if (urb->dev != serial->dev) { | ||
946 | dbg("%s: dev %p != %p", __func__, | ||
947 | urb->dev, serial->dev); | ||
948 | continue; | ||
949 | } | ||
950 | |||
951 | /* | ||
952 | * make sure endpoint data toggle is synchronized with the | ||
953 | * device | ||
954 | */ | ||
955 | usb_clear_halt(urb->dev, urb->pipe); | ||
956 | |||
957 | err = usb_submit_urb(urb, GFP_KERNEL); | 943 | err = usb_submit_urb(urb, GFP_KERNEL); |
958 | if (err) { | 944 | if (err) { |
959 | dbg("%s: submit urb %d failed (%d) %d", | 945 | dbg("%s: submit urb %d failed (%d) %d", |
@@ -962,16 +948,6 @@ static int option_open(struct tty_struct *tty, | |||
962 | } | 948 | } |
963 | } | 949 | } |
964 | 950 | ||
965 | /* Reset low level data toggle on out endpoints */ | ||
966 | for (i = 0; i < N_OUT_URB; i++) { | ||
967 | urb = portdata->out_urbs[i]; | ||
968 | if (!urb) | ||
969 | continue; | ||
970 | urb->dev = serial->dev; | ||
971 | /* usb_settoggle(urb->dev, usb_pipeendpoint(urb->pipe), | ||
972 | usb_pipeout(urb->pipe), 0); */ | ||
973 | } | ||
974 | |||
975 | option_send_setup(port); | 951 | option_send_setup(port); |
976 | 952 | ||
977 | return 0; | 953 | return 0; |
@@ -1234,7 +1210,6 @@ static int option_resume(struct usb_serial *serial) | |||
1234 | dbg("%s: No interrupt URB for port %d\n", __func__, i); | 1210 | dbg("%s: No interrupt URB for port %d\n", __func__, i); |
1235 | continue; | 1211 | continue; |
1236 | } | 1212 | } |
1237 | port->interrupt_in_urb->dev = serial->dev; | ||
1238 | err = usb_submit_urb(port->interrupt_in_urb, GFP_NOIO); | 1213 | err = usb_submit_urb(port->interrupt_in_urb, GFP_NOIO); |
1239 | dbg("Submitted interrupt URB for port %d (result %d)", i, err); | 1214 | dbg("Submitted interrupt URB for port %d (result %d)", i, err); |
1240 | if (err < 0) { | 1215 | if (err < 0) { |