Skip to content

Commit acfe276

Browse files
committed
USB: serial: metro-usb: drop redundant URB reinitialisation
No need to reinitialise the interrupt-in URB with values that have not changed before (some) resubmissions. This also allows the interrupt-in callback to have a single path for URB resubmission. Reviewed-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Johan Hovold <[email protected]>
1 parent 168fc6c commit acfe276

File tree

1 file changed

+2
-18
lines changed

1 file changed

+2
-18
lines changed

drivers/usb/serial/metro-usb.c

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -135,23 +135,8 @@ static void metrousb_read_int_callback(struct urb *urb)
135135
throttled = metro_priv->throttled;
136136
spin_unlock_irqrestore(&metro_priv->lock, flags);
137137

138-
/* Continue trying to read if set. */
139-
if (!throttled) {
140-
usb_fill_int_urb(port->interrupt_in_urb, port->serial->dev,
141-
usb_rcvintpipe(port->serial->dev, port->interrupt_in_endpointAddress),
142-
port->interrupt_in_urb->transfer_buffer,
143-
port->interrupt_in_urb->transfer_buffer_length,
144-
metrousb_read_int_callback, port, 1);
145-
146-
result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC);
147-
148-
if (result)
149-
dev_err(&port->dev,
150-
"%s - failed submitting interrupt in urb, error code=%d\n",
151-
__func__, result);
152-
}
153-
return;
154-
138+
if (throttled)
139+
return;
155140
exit:
156141
/* Try to resubmit the urb. */
157142
result = usb_submit_urb(urb, GFP_ATOMIC);
@@ -337,7 +322,6 @@ static void metrousb_unthrottle(struct tty_struct *tty)
337322
spin_unlock_irqrestore(&metro_priv->lock, flags);
338323

339324
/* Submit the urb to read from the port. */
340-
port->interrupt_in_urb->dev = port->serial->dev;
341325
result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC);
342326
if (result)
343327
dev_err(tty->dev,

0 commit comments

Comments
 (0)