Skip to content

Commit

Permalink
USB: serial: metro-usb: drop redundant URB reinitialisation
Browse files Browse the repository at this point in the history
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 <gregkh@linuxfoundation.org>
Signed-off-by: Johan Hovold <johan@kernel.org>
  • Loading branch information
Johan Hovold committed Feb 8, 2017
1 parent 168fc6c commit acfe276
Showing 1 changed file with 2 additions and 18 deletions.
20 changes: 2 additions & 18 deletions drivers/usb/serial/metro-usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,23 +135,8 @@ static void metrousb_read_int_callback(struct urb *urb)
throttled = metro_priv->throttled;
spin_unlock_irqrestore(&metro_priv->lock, flags);

/* Continue trying to read if set. */
if (!throttled) {
usb_fill_int_urb(port->interrupt_in_urb, port->serial->dev,
usb_rcvintpipe(port->serial->dev, port->interrupt_in_endpointAddress),
port->interrupt_in_urb->transfer_buffer,
port->interrupt_in_urb->transfer_buffer_length,
metrousb_read_int_callback, port, 1);

result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC);

if (result)
dev_err(&port->dev,
"%s - failed submitting interrupt in urb, error code=%d\n",
__func__, result);
}
return;

if (throttled)
return;
exit:
/* Try to resubmit the urb. */
result = usb_submit_urb(urb, GFP_ATOMIC);
Expand Down Expand Up @@ -337,7 +322,6 @@ static void metrousb_unthrottle(struct tty_struct *tty)
spin_unlock_irqrestore(&metro_priv->lock, flags);

/* Submit the urb to read from the port. */
port->interrupt_in_urb->dev = port->serial->dev;
result = usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC);
if (result)
dev_err(tty->dev,
Expand Down

0 comments on commit acfe276

Please sign in to comment.