USB: serial: remove unnecessary re-initialisation of generic urbs
The generic read and write bulk urbs are initialised when allocated in usb_serial_probe. The only field that needs to be updated after that is the transfer_buffer_length of the write urb. Signed-off-by: Johan Hovold <jhovold@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
41bd72f904
commit
056afc0f01
@@ -256,7 +256,6 @@ error_no_buffer:
|
|||||||
*/
|
*/
|
||||||
static int usb_serial_generic_write_start(struct usb_serial_port *port)
|
static int usb_serial_generic_write_start(struct usb_serial_port *port)
|
||||||
{
|
{
|
||||||
struct usb_serial *serial = port->serial;
|
|
||||||
unsigned char *data;
|
unsigned char *data;
|
||||||
int result;
|
int result;
|
||||||
int count;
|
int count;
|
||||||
@@ -281,15 +280,7 @@ static int usb_serial_generic_write_start(struct usb_serial_port *port)
|
|||||||
count = kfifo_out_locked(&port->write_fifo, data, port->bulk_out_size, &port->lock);
|
count = kfifo_out_locked(&port->write_fifo, data, port->bulk_out_size, &port->lock);
|
||||||
usb_serial_debug_data(debug, &port->dev, __func__, count, data);
|
usb_serial_debug_data(debug, &port->dev, __func__, count, data);
|
||||||
|
|
||||||
/* set up our urb */
|
port->write_urb->transfer_buffer_length = count;
|
||||||
usb_fill_bulk_urb(port->write_urb, serial->dev,
|
|
||||||
usb_sndbulkpipe(serial->dev,
|
|
||||||
port->bulk_out_endpointAddress),
|
|
||||||
port->write_urb->transfer_buffer, count,
|
|
||||||
((serial->type->write_bulk_callback) ?
|
|
||||||
serial->type->write_bulk_callback :
|
|
||||||
usb_serial_generic_write_bulk_callback),
|
|
||||||
port);
|
|
||||||
|
|
||||||
/* send the data out the bulk port */
|
/* send the data out the bulk port */
|
||||||
result = usb_submit_urb(port->write_urb, GFP_ATOMIC);
|
result = usb_submit_urb(port->write_urb, GFP_ATOMIC);
|
||||||
@@ -405,21 +396,9 @@ int usb_serial_generic_chars_in_buffer(struct tty_struct *tty)
|
|||||||
int usb_serial_generic_submit_read_urb(struct usb_serial_port *port,
|
int usb_serial_generic_submit_read_urb(struct usb_serial_port *port,
|
||||||
gfp_t mem_flags)
|
gfp_t mem_flags)
|
||||||
{
|
{
|
||||||
struct urb *urb = port->read_urb;
|
|
||||||
struct usb_serial *serial = port->serial;
|
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
/* Continue reading from device */
|
result = usb_submit_urb(port->read_urb, mem_flags);
|
||||||
usb_fill_bulk_urb(urb, serial->dev,
|
|
||||||
usb_rcvbulkpipe(serial->dev,
|
|
||||||
port->bulk_in_endpointAddress),
|
|
||||||
urb->transfer_buffer,
|
|
||||||
urb->transfer_buffer_length,
|
|
||||||
((serial->type->read_bulk_callback) ?
|
|
||||||
serial->type->read_bulk_callback :
|
|
||||||
usb_serial_generic_read_bulk_callback), port);
|
|
||||||
|
|
||||||
result = usb_submit_urb(urb, mem_flags);
|
|
||||||
if (result && result != -EPERM) {
|
if (result && result != -EPERM) {
|
||||||
dev_err(&port->dev,
|
dev_err(&port->dev,
|
||||||
"%s - failed submitting read urb, error %d\n",
|
"%s - failed submitting read urb, error %d\n",
|
||||||
|
Reference in New Issue
Block a user