Commit c3cdeb68 authored by Ganesh Varadarajan's avatar Ganesh Varadarajan Committed by Vojtech Pavlik

USB serial drivers

Several functions in the serial drivers can be called from bottom
half or interrupt context. They must use the GFP_ATOMIC flag for
calls to kmalloc() and usb_submit_urb().
  
Functions which must use GFP_ATOMIC:
1. All *_callback() functions.
2. Any code which is inside a spinlock.
3. write(), throttle(), unthrottle(), which may be called by
   the line discipline in bottom half context.
  
Functions which can use GFP_KERNEL:
1. open(), close(), startup(), shutdown(), set_termios().
parent 869de8b7
...@@ -262,7 +262,7 @@ static int cyberjack_write (struct usb_serial_port *port, int from_user, const u ...@@ -262,7 +262,7 @@ static int cyberjack_write (struct usb_serial_port *port, int from_user, const u
port); port);
/* send the data out the bulk port */ /* send the data out the bulk port */
result = usb_submit_urb(port->write_urb, GFP_KERNEL); result = usb_submit_urb(port->write_urb, GFP_ATOMIC);
if (result) { if (result) {
err(__FUNCTION__ " - failed submitting write urb, error %d", result); err(__FUNCTION__ " - failed submitting write urb, error %d", result);
/* Throw away data. No better idea what to do with it. */ /* Throw away data. No better idea what to do with it. */
...@@ -331,7 +331,7 @@ static void cyberjack_read_int_callback( struct urb *urb ) ...@@ -331,7 +331,7 @@ static void cyberjack_read_int_callback( struct urb *urb )
if( !old_rdtodo ) { if( !old_rdtodo ) {
port->read_urb->dev = port->serial->dev; port->read_urb->dev = port->serial->dev;
result = usb_submit_urb(port->read_urb, GFP_KERNEL); result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
if( result ) if( result )
err(__FUNCTION__ " - failed resubmitting read urb, error %d", result); err(__FUNCTION__ " - failed resubmitting read urb, error %d", result);
dbg(__FUNCTION__ " - usb_submit_urb(read urb)"); dbg(__FUNCTION__ " - usb_submit_urb(read urb)");
...@@ -387,7 +387,7 @@ static void cyberjack_read_bulk_callback (struct urb *urb) ...@@ -387,7 +387,7 @@ static void cyberjack_read_bulk_callback (struct urb *urb)
/* Continue to read if we have still urbs to do. */ /* Continue to read if we have still urbs to do. */
if( priv->rdtodo /* || (urb->actual_length==port->bulk_in_endpointAddress)*/ ) { if( priv->rdtodo /* || (urb->actual_length==port->bulk_in_endpointAddress)*/ ) {
port->read_urb->dev = port->serial->dev; port->read_urb->dev = port->serial->dev;
result = usb_submit_urb(port->read_urb, GFP_KERNEL); result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
if (result) if (result)
err(__FUNCTION__ " - failed resubmitting read urb, error %d", result); err(__FUNCTION__ " - failed resubmitting read urb, error %d", result);
dbg(__FUNCTION__ " - usb_submit_urb(read urb)"); dbg(__FUNCTION__ " - usb_submit_urb(read urb)");
...@@ -440,7 +440,7 @@ static void cyberjack_write_bulk_callback (struct urb *urb) ...@@ -440,7 +440,7 @@ static void cyberjack_write_bulk_callback (struct urb *urb)
port); port);
/* send the data out the bulk port */ /* send the data out the bulk port */
result = usb_submit_urb(port->write_urb, GFP_KERNEL); result = usb_submit_urb(port->write_urb, GFP_ATOMIC);
if (result) { if (result) {
err(__FUNCTION__ " - failed submitting write urb, error %d", result); err(__FUNCTION__ " - failed submitting write urb, error %d", result);
/* Throw away data. No better idea what to do with it. */ /* Throw away data. No better idea what to do with it. */
......
...@@ -676,7 +676,7 @@ dbg( "digi_write_oob_command: TOP: port=%d, count=%d", oob_priv->dp_port_num, co ...@@ -676,7 +676,7 @@ dbg( "digi_write_oob_command: TOP: port=%d, count=%d", oob_priv->dp_port_num, co
oob_port->write_urb->transfer_buffer_length = len; oob_port->write_urb->transfer_buffer_length = len;
oob_port->write_urb->dev = port->serial->dev; oob_port->write_urb->dev = port->serial->dev;
if( (ret=usb_submit_urb(oob_port->write_urb, GFP_KERNEL)) == 0 ) { if( (ret=usb_submit_urb(oob_port->write_urb, GFP_ATOMIC)) == 0 ) {
oob_priv->dp_write_urb_in_use = 1; oob_priv->dp_write_urb_in_use = 1;
count -= len; count -= len;
buf += len; buf += len;
...@@ -764,7 +764,7 @@ count ); ...@@ -764,7 +764,7 @@ count );
} }
port->write_urb->dev = port->serial->dev; port->write_urb->dev = port->serial->dev;
if( (ret=usb_submit_urb(port->write_urb, GFP_KERNEL)) == 0 ) { if( (ret=usb_submit_urb(port->write_urb, GFP_ATOMIC)) == 0 ) {
priv->dp_write_urb_in_use = 1; priv->dp_write_urb_in_use = 1;
priv->dp_out_buf_len = 0; priv->dp_out_buf_len = 0;
count -= len; count -= len;
...@@ -841,7 +841,7 @@ port_priv->dp_port_num, modem_signals ); ...@@ -841,7 +841,7 @@ port_priv->dp_port_num, modem_signals );
oob_port->write_urb->transfer_buffer_length = 8; oob_port->write_urb->transfer_buffer_length = 8;
oob_port->write_urb->dev = port->serial->dev; oob_port->write_urb->dev = port->serial->dev;
if( (ret=usb_submit_urb(oob_port->write_urb, GFP_KERNEL)) == 0 ) { if( (ret=usb_submit_urb(oob_port->write_urb, GFP_ATOMIC)) == 0 ) {
oob_priv->dp_write_urb_in_use = 1; oob_priv->dp_write_urb_in_use = 1;
port_priv->dp_modem_signals = port_priv->dp_modem_signals =
(port_priv->dp_modem_signals&~(TIOCM_DTR|TIOCM_RTS)) (port_priv->dp_modem_signals&~(TIOCM_DTR|TIOCM_RTS))
...@@ -962,7 +962,7 @@ dbg( "digi_rx_unthrottle: TOP: port=%d", priv->dp_port_num ); ...@@ -962,7 +962,7 @@ dbg( "digi_rx_unthrottle: TOP: port=%d", priv->dp_port_num );
/* restart read chain */ /* restart read chain */
if( priv->dp_throttle_restart ) { if( priv->dp_throttle_restart ) {
port->read_urb->dev = port->serial->dev; port->read_urb->dev = port->serial->dev;
ret = usb_submit_urb( port->read_urb, GFP_KERNEL ); ret = usb_submit_urb( port->read_urb, GFP_ATOMIC );
} }
/* turn throttle off */ /* turn throttle off */
...@@ -1323,7 +1323,7 @@ priv->dp_port_num, count, from_user, in_interrupt() ); ...@@ -1323,7 +1323,7 @@ priv->dp_port_num, count, from_user, in_interrupt() );
/* copy in new data */ /* copy in new data */
memcpy( data, from_user ? user_buf : buf, new_len ); memcpy( data, from_user ? user_buf : buf, new_len );
if( (ret=usb_submit_urb(port->write_urb, GFP_KERNEL)) == 0 ) { if( (ret=usb_submit_urb(port->write_urb, GFP_ATOMIC)) == 0 ) {
priv->dp_write_urb_in_use = 1; priv->dp_write_urb_in_use = 1;
ret = new_len; ret = new_len;
priv->dp_out_buf_len = 0; priv->dp_out_buf_len = 0;
...@@ -1399,7 +1399,7 @@ dbg( "digi_write_bulk_callback: TOP, urb->status=%d", urb->status ); ...@@ -1399,7 +1399,7 @@ dbg( "digi_write_bulk_callback: TOP, urb->status=%d", urb->status );
memcpy( port->write_urb->transfer_buffer+2, priv->dp_out_buf, memcpy( port->write_urb->transfer_buffer+2, priv->dp_out_buf,
priv->dp_out_buf_len ); priv->dp_out_buf_len );
if( (ret=usb_submit_urb(port->write_urb, GFP_KERNEL)) == 0 ) { if( (ret=usb_submit_urb(port->write_urb, GFP_ATOMIC)) == 0 ) {
priv->dp_write_urb_in_use = 1; priv->dp_write_urb_in_use = 1;
priv->dp_out_buf_len = 0; priv->dp_out_buf_len = 0;
} }
...@@ -1837,7 +1837,7 @@ dbg( "digi_read_bulk_callback: TOP" ); ...@@ -1837,7 +1837,7 @@ dbg( "digi_read_bulk_callback: TOP" );
/* continue read */ /* continue read */
urb->dev = port->serial->dev; urb->dev = port->serial->dev;
if( (ret=usb_submit_urb(urb, GFP_KERNEL)) != 0 ) { if( (ret=usb_submit_urb(urb, GFP_ATOMIC)) != 0 ) {
err( __FUNCTION__ ": failed resubmitting urb, ret=%d, port=%d", err( __FUNCTION__ ": failed resubmitting urb, ret=%d, port=%d",
ret, priv->dp_port_num ); ret, priv->dp_port_num );
} }
......
...@@ -256,7 +256,7 @@ static int empeg_write (struct usb_serial_port *port, int from_user, const unsig ...@@ -256,7 +256,7 @@ static int empeg_write (struct usb_serial_port *port, int from_user, const unsig
} }
if (urb->transfer_buffer == NULL) { if (urb->transfer_buffer == NULL) {
urb->transfer_buffer = kmalloc (URB_TRANSFER_BUFFER_SIZE, GFP_KERNEL); urb->transfer_buffer = kmalloc (URB_TRANSFER_BUFFER_SIZE, GFP_ATOMIC);
if (urb->transfer_buffer == NULL) { if (urb->transfer_buffer == NULL) {
err(__FUNCTION__" no more kernel memory..."); err(__FUNCTION__" no more kernel memory...");
goto exit; goto exit;
...@@ -288,7 +288,7 @@ static int empeg_write (struct usb_serial_port *port, int from_user, const unsig ...@@ -288,7 +288,7 @@ static int empeg_write (struct usb_serial_port *port, int from_user, const unsig
urb->transfer_flags |= USB_QUEUE_BULK; urb->transfer_flags |= USB_QUEUE_BULK;
/* send it down the pipe */ /* send it down the pipe */
status = usb_submit_urb(urb, GFP_KERNEL); status = usb_submit_urb(urb, GFP_ATOMIC);
if (status) { if (status) {
err(__FUNCTION__ " - usb_submit_urb(write bulk) failed with status = %d", status); err(__FUNCTION__ " - usb_submit_urb(write bulk) failed with status = %d", status);
bytes_sent = status; bytes_sent = status;
...@@ -441,7 +441,7 @@ static void empeg_read_bulk_callback (struct urb *urb) ...@@ -441,7 +441,7 @@ static void empeg_read_bulk_callback (struct urb *urb)
port->read_urb->transfer_flags |= USB_QUEUE_BULK; port->read_urb->transfer_flags |= USB_QUEUE_BULK;
result = usb_submit_urb(port->read_urb, GFP_KERNEL); result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
if (result) if (result)
err(__FUNCTION__ " - failed resubmitting read urb, error %d", result); err(__FUNCTION__ " - failed resubmitting read urb, error %d", result);
...@@ -466,7 +466,7 @@ static void empeg_unthrottle (struct usb_serial_port *port) ...@@ -466,7 +466,7 @@ static void empeg_unthrottle (struct usb_serial_port *port)
port->read_urb->dev = port->serial->dev; port->read_urb->dev = port->serial->dev;
result = usb_submit_urb(port->read_urb, GFP_KERNEL); result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
if (result) if (result)
err(__FUNCTION__ " - failed submitting read urb, error %d", result); err(__FUNCTION__ " - failed submitting read urb, error %d", result);
......
...@@ -469,7 +469,7 @@ static int ftdi_sio_write (struct usb_serial_port *port, int from_user, ...@@ -469,7 +469,7 @@ static int ftdi_sio_write (struct usb_serial_port *port, int from_user,
port->write_urb->transfer_buffer, count, port->write_urb->transfer_buffer, count,
ftdi_sio_write_bulk_callback, port); ftdi_sio_write_bulk_callback, port);
result = usb_submit_urb(port->write_urb, GFP_KERNEL); result = usb_submit_urb(port->write_urb, GFP_ATOMIC);
if (result) { if (result) {
err(__FUNCTION__ " - failed submitting write urb, error %d", result); err(__FUNCTION__ " - failed submitting write urb, error %d", result);
return 0; return 0;
...@@ -631,7 +631,7 @@ static void ftdi_sio_read_bulk_callback (struct urb *urb) ...@@ -631,7 +631,7 @@ static void ftdi_sio_read_bulk_callback (struct urb *urb)
port->read_urb->transfer_buffer, port->read_urb->transfer_buffer_length, port->read_urb->transfer_buffer, port->read_urb->transfer_buffer_length,
ftdi_sio_read_bulk_callback, port); ftdi_sio_read_bulk_callback, port);
result = usb_submit_urb(port->read_urb, GFP_KERNEL); result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
if (result) if (result)
err(__FUNCTION__ " - failed resubmitting read urb, error %d", result); err(__FUNCTION__ " - failed resubmitting read urb, error %d", result);
......
...@@ -790,7 +790,7 @@ static void edge_interrupt_callback (struct urb *urb) ...@@ -790,7 +790,7 @@ static void edge_interrupt_callback (struct urb *urb)
/* we have pending bytes on the bulk in pipe, send a request */ /* we have pending bytes on the bulk in pipe, send a request */
edge_serial->read_urb->dev = edge_serial->serial->dev; edge_serial->read_urb->dev = edge_serial->serial->dev;
result = usb_submit_urb(edge_serial->read_urb, GFP_KERNEL); result = usb_submit_urb(edge_serial->read_urb, GFP_ATOMIC);
if (result) { if (result) {
dbg(__FUNCTION__" - usb_submit_urb(read bulk) failed with result = %d", result); dbg(__FUNCTION__" - usb_submit_urb(read bulk) failed with result = %d", result);
} }
...@@ -867,7 +867,7 @@ static void edge_bulk_in_callback (struct urb *urb) ...@@ -867,7 +867,7 @@ static void edge_bulk_in_callback (struct urb *urb)
/* there is, so resubmit our urb */ /* there is, so resubmit our urb */
edge_serial->read_urb->dev = edge_serial->serial->dev; edge_serial->read_urb->dev = edge_serial->serial->dev;
status = usb_submit_urb(edge_serial->read_urb, GFP_KERNEL); status = usb_submit_urb(edge_serial->read_urb, GFP_ATOMIC);
if (status) { if (status) {
err(__FUNCTION__" - usb_submit_urb(read bulk) failed, status = %d", status); err(__FUNCTION__" - usb_submit_urb(read bulk) failed, status = %d", status);
} }
...@@ -1435,7 +1435,7 @@ static void send_more_port_data(struct edgeport_serial *edge_serial, struct edge ...@@ -1435,7 +1435,7 @@ static void send_more_port_data(struct edgeport_serial *edge_serial, struct edge
/* build the data header for the buffer and port that we are about to send out */ /* build the data header for the buffer and port that we are about to send out */
count = fifo->count; count = fifo->count;
buffer = kmalloc (count+2, GFP_KERNEL); buffer = kmalloc (count+2, GFP_ATOMIC);
if (buffer == NULL) { if (buffer == NULL) {
err(__FUNCTION__" - no more kernel memory..."); err(__FUNCTION__" - no more kernel memory...");
edge_port->write_in_progress = FALSE; edge_port->write_in_progress = FALSE;
...@@ -1474,7 +1474,7 @@ static void send_more_port_data(struct edgeport_serial *edge_serial, struct edge ...@@ -1474,7 +1474,7 @@ static void send_more_port_data(struct edgeport_serial *edge_serial, struct edge
urb->transfer_flags |= USB_QUEUE_BULK; urb->transfer_flags |= USB_QUEUE_BULK;
urb->dev = edge_serial->serial->dev; urb->dev = edge_serial->serial->dev;
status = usb_submit_urb(urb, GFP_KERNEL); status = usb_submit_urb(urb, GFP_ATOMIC);
if (status) { if (status) {
/* something went wrong */ /* something went wrong */
dbg(__FUNCTION__" - usb_submit_urb(write bulk) failed"); dbg(__FUNCTION__" - usb_submit_urb(write bulk) failed");
...@@ -2431,7 +2431,7 @@ static int send_iosp_ext_cmd (struct edgeport_port *edge_port, __u8 command, __u ...@@ -2431,7 +2431,7 @@ static int send_iosp_ext_cmd (struct edgeport_port *edge_port, __u8 command, __u
dbg(__FUNCTION__" - %d, %d", command, param); dbg(__FUNCTION__" - %d, %d", command, param);
buffer = kmalloc (10, GFP_KERNEL); buffer = kmalloc (10, GFP_ATOMIC);
if (!buffer) { if (!buffer) {
err(__FUNCTION__" - kmalloc(%d) failed.\n", 10); err(__FUNCTION__" - kmalloc(%d) failed.\n", 10);
return -ENOMEM; return -ENOMEM;
...@@ -2467,7 +2467,7 @@ static int write_cmd_usb (struct edgeport_port *edge_port, unsigned char *buffer ...@@ -2467,7 +2467,7 @@ static int write_cmd_usb (struct edgeport_port *edge_port, unsigned char *buffer
usb_serial_debug_data (__FILE__, __FUNCTION__, length, buffer); usb_serial_debug_data (__FILE__, __FUNCTION__, length, buffer);
/* Allocate our next urb */ /* Allocate our next urb */
urb = usb_alloc_urb (0, GFP_KERNEL); urb = usb_alloc_urb (0, GFP_ATOMIC);
if (!urb) if (!urb)
return -ENOMEM; return -ENOMEM;
...@@ -2482,7 +2482,7 @@ static int write_cmd_usb (struct edgeport_port *edge_port, unsigned char *buffer ...@@ -2482,7 +2482,7 @@ static int write_cmd_usb (struct edgeport_port *edge_port, unsigned char *buffer
urb->transfer_flags |= USB_QUEUE_BULK; urb->transfer_flags |= USB_QUEUE_BULK;
edge_port->commandPending = TRUE; edge_port->commandPending = TRUE;
status = usb_submit_urb(urb, GFP_KERNEL); status = usb_submit_urb(urb, GFP_ATOMIC);
if (status) { if (status) {
/* something went wrong */ /* something went wrong */
...@@ -2532,7 +2532,7 @@ static int send_cmd_write_baud_rate (struct edgeport_port *edge_port, int baudRa ...@@ -2532,7 +2532,7 @@ static int send_cmd_write_baud_rate (struct edgeport_port *edge_port, int baudRa
} }
// Alloc memory for the string of commands. // Alloc memory for the string of commands.
cmdBuffer = kmalloc (0x100, GFP_KERNEL); cmdBuffer = kmalloc (0x100, GFP_ATOMIC);
if (!cmdBuffer) { if (!cmdBuffer) {
err(__FUNCTION__" - kmalloc(%d) failed.\n", 0x100); err(__FUNCTION__" - kmalloc(%d) failed.\n", 0x100);
return -ENOMEM; return -ENOMEM;
...@@ -2618,7 +2618,7 @@ static int send_cmd_write_uart_register (struct edgeport_port *edge_port, __u8 r ...@@ -2618,7 +2618,7 @@ static int send_cmd_write_uart_register (struct edgeport_port *edge_port, __u8 r
dbg (__FUNCTION__" - write to %s register 0x%02x", (regNum == MCR) ? "MCR" : "LCR", regValue); dbg (__FUNCTION__" - write to %s register 0x%02x", (regNum == MCR) ? "MCR" : "LCR", regValue);
// Alloc memory for the string of commands. // Alloc memory for the string of commands.
cmdBuffer = kmalloc (0x10, GFP_KERNEL); cmdBuffer = kmalloc (0x10, GFP_ATOMIC);
if (cmdBuffer == NULL ) { if (cmdBuffer == NULL ) {
return -ENOMEM; return -ENOMEM;
} }
......
...@@ -297,7 +297,7 @@ static void ipaq_read_bulk_callback(struct urb *urb) ...@@ -297,7 +297,7 @@ static void ipaq_read_bulk_callback(struct urb *urb)
usb_rcvbulkpipe(serial->dev, port->bulk_in_endpointAddress), usb_rcvbulkpipe(serial->dev, port->bulk_in_endpointAddress),
port->read_urb->transfer_buffer, port->read_urb->transfer_buffer_length, port->read_urb->transfer_buffer, port->read_urb->transfer_buffer_length,
ipaq_read_bulk_callback, port); ipaq_read_bulk_callback, port);
result = usb_submit_urb(port->read_urb, GFP_KERNEL); result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
if (result) if (result)
err(__FUNCTION__ " - failed resubmitting read urb, error %d", result); err(__FUNCTION__ " - failed resubmitting read urb, error %d", result);
return; return;
...@@ -412,7 +412,7 @@ static int ipaq_write_flush(struct usb_serial_port *port) ...@@ -412,7 +412,7 @@ static int ipaq_write_flush(struct usb_serial_port *port)
usb_sndbulkpipe(serial->dev, port->bulk_out_endpointAddress), usb_sndbulkpipe(serial->dev, port->bulk_out_endpointAddress),
port->write_urb->transfer_buffer, count, ipaq_write_bulk_callback, port->write_urb->transfer_buffer, count, ipaq_write_bulk_callback,
port); port);
result = usb_submit_urb(urb, GFP_KERNEL); result = usb_submit_urb(urb, GFP_ATOMIC);
if (result) { if (result) {
err(__FUNCTION__ " - failed submitting write urb, error %d", result); err(__FUNCTION__ " - failed submitting write urb, error %d", result);
} }
......
...@@ -405,7 +405,7 @@ static int ir_write (struct usb_serial_port *port, int from_user, const unsigned ...@@ -405,7 +405,7 @@ static int ir_write (struct usb_serial_port *port, int from_user, const unsigned
= USB_QUEUE_BULK = USB_QUEUE_BULK
| USB_ZERO_PACKET; | USB_ZERO_PACKET;
result = usb_submit_urb (port->write_urb, GFP_KERNEL); result = usb_submit_urb (port->write_urb, GFP_ATOMIC);
if (result) if (result)
err("%s - failed submitting write urb, error %d", __FUNCTION__, result); err("%s - failed submitting write urb, error %d", __FUNCTION__, result);
else else
...@@ -515,7 +515,7 @@ static void ir_read_bulk_callback (struct urb *urb) ...@@ -515,7 +515,7 @@ static void ir_read_bulk_callback (struct urb *urb)
port->read_urb->transfer_flags = USB_QUEUE_BULK; port->read_urb->transfer_flags = USB_QUEUE_BULK;
result = usb_submit_urb(port->read_urb, GFP_KERNEL); result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
if (result) if (result)
err("%s - failed resubmitting read urb, error %d", err("%s - failed resubmitting read urb, error %d",
......
...@@ -378,7 +378,7 @@ static int keyspan_write(struct usb_serial_port *port, int from_user, ...@@ -378,7 +378,7 @@ static int keyspan_write(struct usb_serial_port *port, int from_user,
this_urb->transfer_flags &= ~USB_ASYNC_UNLINK; this_urb->transfer_flags &= ~USB_ASYNC_UNLINK;
this_urb->dev = port->serial->dev; this_urb->dev = port->serial->dev;
if ((err = usb_submit_urb(this_urb, GFP_KERNEL)) != 0) { if ((err = usb_submit_urb(this_urb, GFP_ATOMIC)) != 0) {
dbg("usb_submit_urb(write bulk) failed (%d)\n", err); dbg("usb_submit_urb(write bulk) failed (%d)\n", err);
} }
p_priv->tx_start_time[flip] = jiffies; p_priv->tx_start_time[flip] = jiffies;
...@@ -436,7 +436,7 @@ static void usa26_indat_callback(struct urb *urb) ...@@ -436,7 +436,7 @@ static void usa26_indat_callback(struct urb *urb)
/* Resubmit urb so we continue receiving */ /* Resubmit urb so we continue receiving */
urb->dev = port->serial->dev; urb->dev = port->serial->dev;
if ((err = usb_submit_urb(urb, GFP_KERNEL)) != 0) { if ((err = usb_submit_urb(urb, GFP_ATOMIC)) != 0) {
dbg(__FUNCTION__ "resubmit read urb failed. (%d)\n", err); dbg(__FUNCTION__ "resubmit read urb failed. (%d)\n", err);
} }
return; return;
...@@ -535,7 +535,7 @@ static void usa26_instat_callback(struct urb *urb) ...@@ -535,7 +535,7 @@ static void usa26_instat_callback(struct urb *urb)
exit: exit:
/* Resubmit urb so we continue receiving */ /* Resubmit urb so we continue receiving */
urb->dev = serial->dev; urb->dev = serial->dev;
if ((err = usb_submit_urb(urb, GFP_KERNEL)) != 0) { if ((err = usb_submit_urb(urb, GFP_ATOMIC)) != 0) {
dbg(__FUNCTION__ "resubmit read urb failed. (%d)\n", err); dbg(__FUNCTION__ "resubmit read urb failed. (%d)\n", err);
} }
} }
...@@ -586,7 +586,7 @@ static void usa28_indat_callback(struct urb *urb) ...@@ -586,7 +586,7 @@ static void usa28_indat_callback(struct urb *urb)
/* Resubmit urb so we continue receiving */ /* Resubmit urb so we continue receiving */
urb->dev = port->serial->dev; urb->dev = port->serial->dev;
if ((err = usb_submit_urb(urb, GFP_KERNEL)) != 0) { if ((err = usb_submit_urb(urb, GFP_ATOMIC)) != 0) {
dbg(__FUNCTION__ "resubmit read urb failed. (%d)\n", dbg(__FUNCTION__ "resubmit read urb failed. (%d)\n",
err); err);
} }
...@@ -671,7 +671,7 @@ static void usa28_instat_callback(struct urb *urb) ...@@ -671,7 +671,7 @@ static void usa28_instat_callback(struct urb *urb)
exit: exit:
/* Resubmit urb so we continue receiving */ /* Resubmit urb so we continue receiving */
urb->dev = serial->dev; urb->dev = serial->dev;
if ((err = usb_submit_urb(urb, GFP_KERNEL)) != 0) { if ((err = usb_submit_urb(urb, GFP_ATOMIC)) != 0) {
dbg(__FUNCTION__ "resubmit read urb failed. (%d)\n", err); dbg(__FUNCTION__ "resubmit read urb failed. (%d)\n", err);
} }
} }
...@@ -764,7 +764,7 @@ static void usa49_instat_callback(struct urb *urb) ...@@ -764,7 +764,7 @@ static void usa49_instat_callback(struct urb *urb)
/* Resubmit urb so we continue receiving */ /* Resubmit urb so we continue receiving */
urb->dev = serial->dev; urb->dev = serial->dev;
if ((err = usb_submit_urb(urb, GFP_KERNEL)) != 0) { if ((err = usb_submit_urb(urb, GFP_ATOMIC)) != 0) {
dbg(__FUNCTION__ "resubmit read urb failed. (%d)\n", err); dbg(__FUNCTION__ "resubmit read urb failed. (%d)\n", err);
} }
} }
...@@ -819,7 +819,7 @@ static void usa49_indat_callback(struct urb *urb) ...@@ -819,7 +819,7 @@ static void usa49_indat_callback(struct urb *urb)
/* Resubmit urb so we continue receiving */ /* Resubmit urb so we continue receiving */
urb->dev = port->serial->dev; urb->dev = port->serial->dev;
if ((err = usb_submit_urb(urb, GFP_KERNEL)) != 0) { if ((err = usb_submit_urb(urb, GFP_ATOMIC)) != 0) {
dbg(__FUNCTION__ "resubmit read urb failed. (%d)\n", err); dbg(__FUNCTION__ "resubmit read urb failed. (%d)\n", err);
} }
} }
......
...@@ -292,7 +292,7 @@ static void keyspan_pda_rx_unthrottle (struct usb_serial_port *port) ...@@ -292,7 +292,7 @@ static void keyspan_pda_rx_unthrottle (struct usb_serial_port *port)
/* just restart the receive interrupt URB */ /* just restart the receive interrupt URB */
dbg("keyspan_pda_rx_unthrottle port %d", port->number); dbg("keyspan_pda_rx_unthrottle port %d", port->number);
port->interrupt_in_urb->dev = port->serial->dev; port->interrupt_in_urb->dev = port->serial->dev;
if (usb_submit_urb(port->interrupt_in_urb, GFP_KERNEL)) if (usb_submit_urb(port->interrupt_in_urb, GFP_ATOMIC))
dbg(" usb_submit_urb(read urb) failed"); dbg(" usb_submit_urb(read urb) failed");
return; return;
} }
...@@ -584,7 +584,7 @@ static int keyspan_pda_write(struct usb_serial_port *port, int from_user, ...@@ -584,7 +584,7 @@ static int keyspan_pda_write(struct usb_serial_port *port, int from_user,
priv->tx_room -= count; priv->tx_room -= count;
port->write_urb->dev = port->serial->dev; port->write_urb->dev = port->serial->dev;
rc = usb_submit_urb(port->write_urb, GFP_KERNEL); rc = usb_submit_urb(port->write_urb, GFP_ATOMIC);
if (rc) { if (rc) {
dbg(" usb_submit_urb(write bulk) failed"); dbg(" usb_submit_urb(write bulk) failed");
goto exit; goto exit;
......
...@@ -519,7 +519,7 @@ static int klsi_105_write (struct usb_serial_port *port, int from_user, ...@@ -519,7 +519,7 @@ static int klsi_105_write (struct usb_serial_port *port, int from_user,
} }
if (urb->transfer_buffer == NULL) { if (urb->transfer_buffer == NULL) {
urb->transfer_buffer = kmalloc (URB_TRANSFER_BUFFER_SIZE, GFP_KERNEL); urb->transfer_buffer = kmalloc (URB_TRANSFER_BUFFER_SIZE, GFP_ATOMIC);
if (urb->transfer_buffer == NULL) { if (urb->transfer_buffer == NULL) {
err(__FUNCTION__ " - no more kernel memory..."); err(__FUNCTION__ " - no more kernel memory...");
goto exit; goto exit;
...@@ -555,7 +555,7 @@ static int klsi_105_write (struct usb_serial_port *port, int from_user, ...@@ -555,7 +555,7 @@ static int klsi_105_write (struct usb_serial_port *port, int from_user,
/* send the data out the bulk port */ /* send the data out the bulk port */
result = usb_submit_urb(urb, GFP_KERNEL); result = usb_submit_urb(urb, GFP_ATOMIC);
if (result) { if (result) {
err(__FUNCTION__ err(__FUNCTION__
" - failed submitting write urb, error %d", result); " - failed submitting write urb, error %d", result);
...@@ -721,7 +721,7 @@ static void klsi_105_read_bulk_callback (struct urb *urb) ...@@ -721,7 +721,7 @@ static void klsi_105_read_bulk_callback (struct urb *urb)
port->read_urb->transfer_buffer_length, port->read_urb->transfer_buffer_length,
klsi_105_read_bulk_callback, klsi_105_read_bulk_callback,
port); port);
rc = usb_submit_urb(port->read_urb, GFP_KERNEL); rc = usb_submit_urb(port->read_urb, GFP_ATOMIC);
if (rc) if (rc)
err(__FUNCTION__ err(__FUNCTION__
" - failed resubmitting read urb, error %d", rc); " - failed resubmitting read urb, error %d", rc);
...@@ -1019,7 +1019,7 @@ static void klsi_105_unthrottle (struct usb_serial_port *port) ...@@ -1019,7 +1019,7 @@ static void klsi_105_unthrottle (struct usb_serial_port *port)
dbg(__FUNCTION__ " - port %d", port->number); dbg(__FUNCTION__ " - port %d", port->number);
port->read_urb->dev = port->serial->dev; port->read_urb->dev = port->serial->dev;
result = usb_submit_urb(port->read_urb, GFP_KERNEL); result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
if (result) if (result)
err(__FUNCTION__ " - failed submitting read urb, error %d", err(__FUNCTION__ " - failed submitting read urb, error %d",
result); result);
......
...@@ -470,7 +470,7 @@ static int mct_u232_write (struct usb_serial_port *port, int from_user, ...@@ -470,7 +470,7 @@ static int mct_u232_write (struct usb_serial_port *port, int from_user,
port); port);
/* send the data out the bulk port */ /* send the data out the bulk port */
result = usb_submit_urb(port->write_urb, GFP_KERNEL); result = usb_submit_urb(port->write_urb, GFP_ATOMIC);
if (result) { if (result) {
err(__FUNCTION__ err(__FUNCTION__
" - failed submitting write urb, error %d", result); " - failed submitting write urb, error %d", result);
......
...@@ -265,7 +265,7 @@ static void omninet_read_bulk_callback (struct urb *urb) ...@@ -265,7 +265,7 @@ static void omninet_read_bulk_callback (struct urb *urb)
usb_rcvbulkpipe(serial->dev, port->bulk_in_endpointAddress), usb_rcvbulkpipe(serial->dev, port->bulk_in_endpointAddress),
urb->transfer_buffer, urb->transfer_buffer_length, urb->transfer_buffer, urb->transfer_buffer_length,
omninet_read_bulk_callback, port); omninet_read_bulk_callback, port);
result = usb_submit_urb(urb, GFP_KERNEL); result = usb_submit_urb(urb, GFP_ATOMIC);
if (result) if (result)
err(__FUNCTION__ " - failed resubmitting read urb, error %d", result); err(__FUNCTION__ " - failed resubmitting read urb, error %d", result);
...@@ -316,7 +316,7 @@ static int omninet_write (struct usb_serial_port *port, int from_user, const uns ...@@ -316,7 +316,7 @@ static int omninet_write (struct usb_serial_port *port, int from_user, const uns
wport->write_urb->transfer_buffer_length = 64; wport->write_urb->transfer_buffer_length = 64;
wport->write_urb->dev = serial->dev; wport->write_urb->dev = serial->dev;
result = usb_submit_urb(wport->write_urb, GFP_KERNEL); result = usb_submit_urb(wport->write_urb, GFP_ATOMIC);
if (result) if (result)
err(__FUNCTION__ " - failed submitting write urb, error %d", result); err(__FUNCTION__ " - failed submitting write urb, error %d", result);
else else
......
...@@ -195,7 +195,7 @@ static int pl2303_write (struct usb_serial_port *port, int from_user, const uns ...@@ -195,7 +195,7 @@ static int pl2303_write (struct usb_serial_port *port, int from_user, const uns
port->write_urb->transfer_buffer_length = count; port->write_urb->transfer_buffer_length = count;
port->write_urb->dev = port->serial->dev; port->write_urb->dev = port->serial->dev;
result = usb_submit_urb (port->write_urb, GFP_KERNEL); result = usb_submit_urb (port->write_urb, GFP_ATOMIC);
if (result) if (result)
err(__FUNCTION__ " - failed submitting write urb, error %d", result); err(__FUNCTION__ " - failed submitting write urb, error %d", result);
else else
...@@ -643,7 +643,7 @@ static void pl2303_read_bulk_callback (struct urb *urb) ...@@ -643,7 +643,7 @@ static void pl2303_read_bulk_callback (struct urb *urb)
dbg (__FUNCTION__ " - caught -EPROTO, resubmitting the urb"); dbg (__FUNCTION__ " - caught -EPROTO, resubmitting the urb");
urb->status = 0; urb->status = 0;
urb->dev = serial->dev; urb->dev = serial->dev;
result = usb_submit_urb(urb, GFP_KERNEL); result = usb_submit_urb(urb, GFP_ATOMIC);
if (result) if (result)
err(__FUNCTION__ " - failed resubmitting read urb, error %d", result); err(__FUNCTION__ " - failed resubmitting read urb, error %d", result);
return; return;
...@@ -668,7 +668,7 @@ static void pl2303_read_bulk_callback (struct urb *urb) ...@@ -668,7 +668,7 @@ static void pl2303_read_bulk_callback (struct urb *urb)
/* Schedule the next read _if_ we are still open */ /* Schedule the next read _if_ we are still open */
if (port->open_count) { if (port->open_count) {
urb->dev = serial->dev; urb->dev = serial->dev;
result = usb_submit_urb(urb, GFP_KERNEL); result = usb_submit_urb(urb, GFP_ATOMIC);
if (result) if (result)
err(__FUNCTION__ " - failed resubmitting read urb, error %d", result); err(__FUNCTION__ " - failed resubmitting read urb, error %d", result);
} }
...@@ -697,7 +697,7 @@ static void pl2303_write_bulk_callback (struct urb *urb) ...@@ -697,7 +697,7 @@ static void pl2303_write_bulk_callback (struct urb *urb)
dbg (__FUNCTION__ " - nonzero write bulk status received: %d", urb->status); dbg (__FUNCTION__ " - nonzero write bulk status received: %d", urb->status);
port->write_urb->transfer_buffer_length = 1; port->write_urb->transfer_buffer_length = 1;
port->write_urb->dev = port->serial->dev; port->write_urb->dev = port->serial->dev;
result = usb_submit_urb (port->write_urb, GFP_KERNEL); result = usb_submit_urb (port->write_urb, GFP_ATOMIC);
if (result) if (result)
err(__FUNCTION__ " - failed resubmitting write urb, error %d", result); err(__FUNCTION__ " - failed resubmitting write urb, error %d", result);
......
...@@ -899,7 +899,7 @@ static int generic_write (struct usb_serial_port *port, int from_user, const uns ...@@ -899,7 +899,7 @@ static int generic_write (struct usb_serial_port *port, int from_user, const uns
generic_write_bulk_callback), port); 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_KERNEL); result = usb_submit_urb(port->write_urb, GFP_ATOMIC);
if (result) if (result)
err(__FUNCTION__ " - failed submitting write urb, error %d", result); err(__FUNCTION__ " - failed submitting write urb, error %d", result);
else else
...@@ -989,7 +989,7 @@ static void generic_read_bulk_callback (struct urb *urb) ...@@ -989,7 +989,7 @@ static void generic_read_bulk_callback (struct urb *urb)
((serial->type->read_bulk_callback) ? ((serial->type->read_bulk_callback) ?
serial->type->read_bulk_callback : serial->type->read_bulk_callback :
generic_read_bulk_callback), port); generic_read_bulk_callback), port);
result = usb_submit_urb(port->read_urb, GFP_KERNEL); result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
if (result) if (result)
err(__FUNCTION__ " - failed resubmitting read urb, error %d", result); err(__FUNCTION__ " - failed resubmitting read urb, error %d", result);
} }
......
...@@ -344,13 +344,13 @@ static int visor_write (struct usb_serial_port *port, int from_user, const unsig ...@@ -344,13 +344,13 @@ static int visor_write (struct usb_serial_port *port, int from_user, const unsig
dbg(__FUNCTION__ " - port %d", port->number); dbg(__FUNCTION__ " - port %d", port->number);
buffer = kmalloc (count, GFP_KERNEL); buffer = kmalloc (count, GFP_ATOMIC);
if (!buffer) { if (!buffer) {
err ("out of memory"); err ("out of memory");
return -ENOMEM; return -ENOMEM;
} }
urb = usb_alloc_urb(0, GFP_KERNEL); urb = usb_alloc_urb(0, GFP_ATOMIC);
if (!urb) { if (!urb) {
err ("no more free urbs"); err ("no more free urbs");
kfree (buffer); kfree (buffer);
...@@ -377,7 +377,7 @@ static int visor_write (struct usb_serial_port *port, int from_user, const unsig ...@@ -377,7 +377,7 @@ static int visor_write (struct usb_serial_port *port, int from_user, const unsig
urb->transfer_flags |= USB_QUEUE_BULK; urb->transfer_flags |= USB_QUEUE_BULK;
/* send it down the pipe */ /* send it down the pipe */
status = usb_submit_urb(urb, GFP_KERNEL); status = usb_submit_urb(urb, GFP_ATOMIC);
if (status) { if (status) {
err(__FUNCTION__ " - usb_submit_urb(write bulk) failed with status = %d", status); err(__FUNCTION__ " - usb_submit_urb(write bulk) failed with status = %d", status);
count = status; count = status;
...@@ -491,7 +491,7 @@ static void visor_read_bulk_callback (struct urb *urb) ...@@ -491,7 +491,7 @@ static void visor_read_bulk_callback (struct urb *urb)
port->read_urb->transfer_buffer, port->read_urb->transfer_buffer,
port->read_urb->transfer_buffer_length, port->read_urb->transfer_buffer_length,
visor_read_bulk_callback, port); visor_read_bulk_callback, port);
result = usb_submit_urb(port->read_urb, GFP_KERNEL); result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
if (result) if (result)
err(__FUNCTION__ " - failed resubmitting read urb, error %d", result); err(__FUNCTION__ " - failed resubmitting read urb, error %d", result);
return; return;
...@@ -512,7 +512,7 @@ static void visor_unthrottle (struct usb_serial_port *port) ...@@ -512,7 +512,7 @@ static void visor_unthrottle (struct usb_serial_port *port)
dbg(__FUNCTION__ " - port %d", port->number); dbg(__FUNCTION__ " - port %d", port->number);
port->read_urb->dev = port->serial->dev; port->read_urb->dev = port->serial->dev;
result = usb_submit_urb(port->read_urb, GFP_KERNEL); result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
if (result) if (result)
err(__FUNCTION__ " - failed submitting read urb, error %d", result); err(__FUNCTION__ " - failed submitting read urb, error %d", result);
} }
......
...@@ -240,7 +240,7 @@ static void command_port_read_callback (struct urb *urb) ...@@ -240,7 +240,7 @@ static void command_port_read_callback (struct urb *urb)
usb_rcvbulkpipe(serial->dev, port->bulk_in_endpointAddress), usb_rcvbulkpipe(serial->dev, port->bulk_in_endpointAddress),
port->read_urb->transfer_buffer, port->read_urb->transfer_buffer_length, port->read_urb->transfer_buffer, port->read_urb->transfer_buffer_length,
command_port_read_callback, port); command_port_read_callback, port);
result = usb_submit_urb(port->read_urb, GFP_KERNEL); result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
if (result) if (result)
dbg(__FUNCTION__ " - failed resubmitting read urb, error %d", result); dbg(__FUNCTION__ " - failed resubmitting read urb, error %d", result);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment