Commit 78fbe864 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

Merge tag 'usb-serial-4.19-rc1' of...

Merge tag 'usb-serial-4.19-rc1' of https://git.kernel.org/pub/scm/linux/kernel/git/johan/usb-serial into usb-next

Johan writes:

USB-serial updates for v4.19-rc1

Here are the USB-serial updates for 4.19-rc1, including:

 - gpio support for CP2102N devices
 - improved line-speed handling for cp210x
 - conversion to spin_lock_irqsave() in completion handlers
 - dropped kl5kusb105 support from the kl5kusb105 driver (sic!)

Included are also various lower-priority fixes and clean ups.

All but the final commit have been in linux-next, and with no reported
issues.
Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
parents 500f0716 c8acfe0a
...@@ -418,15 +418,6 @@ Current status: ...@@ -418,15 +418,6 @@ Current status:
why it is wise to cut down on the rate used is wise for large why it is wise to cut down on the rate used is wise for large
transfers until this is settled. transfers until this is settled.
Options supported:
If this driver is compiled as a module you can pass the following
options to it:
debug - extra verbose debugging info
(default: 0; nonzero enables)
use_lowlatency - use low_latency flag to speed up tty layer
when reading from the device.
(default: 0; nonzero enables)
See http://www.uuhaus.de/linux/palmconnect.html for up-to-date See http://www.uuhaus.de/linux/palmconnect.html for up-to-date
information on this driver. information on this driver.
......
This diff is collapsed.
...@@ -255,6 +255,7 @@ static void cyberjack_read_int_callback(struct urb *urb) ...@@ -255,6 +255,7 @@ static void cyberjack_read_int_callback(struct urb *urb)
struct device *dev = &port->dev; struct device *dev = &port->dev;
unsigned char *data = urb->transfer_buffer; unsigned char *data = urb->transfer_buffer;
int status = urb->status; int status = urb->status;
unsigned long flags;
int result; int result;
/* the urb might have been killed. */ /* the urb might have been killed. */
...@@ -270,13 +271,13 @@ static void cyberjack_read_int_callback(struct urb *urb) ...@@ -270,13 +271,13 @@ static void cyberjack_read_int_callback(struct urb *urb)
/* This is a announcement of coming bulk_ins. */ /* This is a announcement of coming bulk_ins. */
unsigned short size = ((unsigned short)data[3]<<8)+data[2]+3; unsigned short size = ((unsigned short)data[3]<<8)+data[2]+3;
spin_lock(&priv->lock); spin_lock_irqsave(&priv->lock, flags);
old_rdtodo = priv->rdtodo; old_rdtodo = priv->rdtodo;
if (old_rdtodo > SHRT_MAX - size) { if (old_rdtodo > SHRT_MAX - size) {
dev_dbg(dev, "To many bulk_in urbs to do.\n"); dev_dbg(dev, "To many bulk_in urbs to do.\n");
spin_unlock(&priv->lock); spin_unlock_irqrestore(&priv->lock, flags);
goto resubmit; goto resubmit;
} }
...@@ -285,7 +286,7 @@ static void cyberjack_read_int_callback(struct urb *urb) ...@@ -285,7 +286,7 @@ static void cyberjack_read_int_callback(struct urb *urb)
dev_dbg(dev, "%s - rdtodo: %d\n", __func__, priv->rdtodo); dev_dbg(dev, "%s - rdtodo: %d\n", __func__, priv->rdtodo);
spin_unlock(&priv->lock); spin_unlock_irqrestore(&priv->lock, flags);
if (!old_rdtodo) { if (!old_rdtodo) {
result = usb_submit_urb(port->read_urb, GFP_ATOMIC); result = usb_submit_urb(port->read_urb, GFP_ATOMIC);
...@@ -309,6 +310,7 @@ static void cyberjack_read_bulk_callback(struct urb *urb) ...@@ -309,6 +310,7 @@ static void cyberjack_read_bulk_callback(struct urb *urb)
struct cyberjack_private *priv = usb_get_serial_port_data(port); struct cyberjack_private *priv = usb_get_serial_port_data(port);
struct device *dev = &port->dev; struct device *dev = &port->dev;
unsigned char *data = urb->transfer_buffer; unsigned char *data = urb->transfer_buffer;
unsigned long flags;
short todo; short todo;
int result; int result;
int status = urb->status; int status = urb->status;
...@@ -325,7 +327,7 @@ static void cyberjack_read_bulk_callback(struct urb *urb) ...@@ -325,7 +327,7 @@ static void cyberjack_read_bulk_callback(struct urb *urb)
tty_flip_buffer_push(&port->port); tty_flip_buffer_push(&port->port);
} }
spin_lock(&priv->lock); spin_lock_irqsave(&priv->lock, flags);
/* Reduce urbs to do by one. */ /* Reduce urbs to do by one. */
priv->rdtodo -= urb->actual_length; priv->rdtodo -= urb->actual_length;
...@@ -334,7 +336,7 @@ static void cyberjack_read_bulk_callback(struct urb *urb) ...@@ -334,7 +336,7 @@ static void cyberjack_read_bulk_callback(struct urb *urb)
priv->rdtodo = 0; priv->rdtodo = 0;
todo = priv->rdtodo; todo = priv->rdtodo;
spin_unlock(&priv->lock); spin_unlock_irqrestore(&priv->lock, flags);
dev_dbg(dev, "%s - rdtodo: %d\n", __func__, todo); dev_dbg(dev, "%s - rdtodo: %d\n", __func__, todo);
...@@ -354,6 +356,7 @@ static void cyberjack_write_bulk_callback(struct urb *urb) ...@@ -354,6 +356,7 @@ static void cyberjack_write_bulk_callback(struct urb *urb)
struct cyberjack_private *priv = usb_get_serial_port_data(port); struct cyberjack_private *priv = usb_get_serial_port_data(port);
struct device *dev = &port->dev; struct device *dev = &port->dev;
int status = urb->status; int status = urb->status;
unsigned long flags;
set_bit(0, &port->write_urbs_free); set_bit(0, &port->write_urbs_free);
if (status) { if (status) {
...@@ -362,7 +365,7 @@ static void cyberjack_write_bulk_callback(struct urb *urb) ...@@ -362,7 +365,7 @@ static void cyberjack_write_bulk_callback(struct urb *urb)
return; return;
} }
spin_lock(&priv->lock); spin_lock_irqsave(&priv->lock, flags);
/* only do something if we have more data to send */ /* only do something if we have more data to send */
if (priv->wrfilled) { if (priv->wrfilled) {
...@@ -406,7 +409,7 @@ static void cyberjack_write_bulk_callback(struct urb *urb) ...@@ -406,7 +409,7 @@ static void cyberjack_write_bulk_callback(struct urb *urb)
} }
exit: exit:
spin_unlock(&priv->lock); spin_unlock_irqrestore(&priv->lock, flags);
usb_serial_port_softint(port); usb_serial_port_softint(port);
} }
......
...@@ -984,6 +984,7 @@ static void digi_write_bulk_callback(struct urb *urb) ...@@ -984,6 +984,7 @@ static void digi_write_bulk_callback(struct urb *urb)
struct usb_serial *serial; struct usb_serial *serial;
struct digi_port *priv; struct digi_port *priv;
struct digi_serial *serial_priv; struct digi_serial *serial_priv;
unsigned long flags;
int ret = 0; int ret = 0;
int status = urb->status; int status = urb->status;
...@@ -1004,15 +1005,15 @@ static void digi_write_bulk_callback(struct urb *urb) ...@@ -1004,15 +1005,15 @@ static void digi_write_bulk_callback(struct urb *urb)
/* handle oob callback */ /* handle oob callback */
if (priv->dp_port_num == serial_priv->ds_oob_port_num) { if (priv->dp_port_num == serial_priv->ds_oob_port_num) {
dev_dbg(&port->dev, "digi_write_bulk_callback: oob callback\n"); dev_dbg(&port->dev, "digi_write_bulk_callback: oob callback\n");
spin_lock(&priv->dp_port_lock); spin_lock_irqsave(&priv->dp_port_lock, flags);
priv->dp_write_urb_in_use = 0; priv->dp_write_urb_in_use = 0;
wake_up_interruptible(&port->write_wait); wake_up_interruptible(&port->write_wait);
spin_unlock(&priv->dp_port_lock); spin_unlock_irqrestore(&priv->dp_port_lock, flags);
return; return;
} }
/* try to send any buffered data on this port */ /* try to send any buffered data on this port */
spin_lock(&priv->dp_port_lock); spin_lock_irqsave(&priv->dp_port_lock, flags);
priv->dp_write_urb_in_use = 0; priv->dp_write_urb_in_use = 0;
if (priv->dp_out_buf_len > 0) { if (priv->dp_out_buf_len > 0) {
*((unsigned char *)(port->write_urb->transfer_buffer)) *((unsigned char *)(port->write_urb->transfer_buffer))
...@@ -1035,7 +1036,7 @@ static void digi_write_bulk_callback(struct urb *urb) ...@@ -1035,7 +1036,7 @@ static void digi_write_bulk_callback(struct urb *urb)
/* lost the race in write_chan(). */ /* lost the race in write_chan(). */
schedule_work(&priv->dp_wakeup_work); schedule_work(&priv->dp_wakeup_work);
spin_unlock(&priv->dp_port_lock); spin_unlock_irqrestore(&priv->dp_port_lock, flags);
if (ret && ret != -EPERM) if (ret && ret != -EPERM)
dev_err_console(port, dev_err_console(port,
"%s: usb_submit_urb failed, ret=%d, port=%d\n", "%s: usb_submit_urb failed, ret=%d, port=%d\n",
...@@ -1381,11 +1382,12 @@ static int digi_read_inb_callback(struct urb *urb) ...@@ -1381,11 +1382,12 @@ static int digi_read_inb_callback(struct urb *urb)
struct usb_serial_port *port = urb->context; struct usb_serial_port *port = urb->context;
struct digi_port *priv = usb_get_serial_port_data(port); struct digi_port *priv = usb_get_serial_port_data(port);
unsigned char *buf = urb->transfer_buffer; unsigned char *buf = urb->transfer_buffer;
unsigned long flags;
int opcode; int opcode;
int len; int len;
int port_status; int port_status;
unsigned char *data; unsigned char *data;
int flag, throttled; int tty_flag, throttled;
/* short/multiple packet check */ /* short/multiple packet check */
if (urb->actual_length < 2) { if (urb->actual_length < 2) {
...@@ -1407,7 +1409,7 @@ static int digi_read_inb_callback(struct urb *urb) ...@@ -1407,7 +1409,7 @@ static int digi_read_inb_callback(struct urb *urb)
return -1; return -1;
} }
spin_lock(&priv->dp_port_lock); spin_lock_irqsave(&priv->dp_port_lock, flags);
/* check for throttle; if set, do not resubmit read urb */ /* check for throttle; if set, do not resubmit read urb */
/* indicate the read chain needs to be restarted on unthrottle */ /* indicate the read chain needs to be restarted on unthrottle */
...@@ -1421,7 +1423,7 @@ static int digi_read_inb_callback(struct urb *urb) ...@@ -1421,7 +1423,7 @@ static int digi_read_inb_callback(struct urb *urb)
data = &buf[3]; data = &buf[3];
/* get flag from port_status */ /* get flag from port_status */
flag = 0; tty_flag = 0;
/* overrun is special, not associated with a char */ /* overrun is special, not associated with a char */
if (port_status & DIGI_OVERRUN_ERROR) if (port_status & DIGI_OVERRUN_ERROR)
...@@ -1430,21 +1432,21 @@ static int digi_read_inb_callback(struct urb *urb) ...@@ -1430,21 +1432,21 @@ static int digi_read_inb_callback(struct urb *urb)
/* break takes precedence over parity, */ /* break takes precedence over parity, */
/* which takes precedence over framing errors */ /* which takes precedence over framing errors */
if (port_status & DIGI_BREAK_ERROR) if (port_status & DIGI_BREAK_ERROR)
flag = TTY_BREAK; tty_flag = TTY_BREAK;
else if (port_status & DIGI_PARITY_ERROR) else if (port_status & DIGI_PARITY_ERROR)
flag = TTY_PARITY; tty_flag = TTY_PARITY;
else if (port_status & DIGI_FRAMING_ERROR) else if (port_status & DIGI_FRAMING_ERROR)
flag = TTY_FRAME; tty_flag = TTY_FRAME;
/* data length is len-1 (one byte of len is port_status) */ /* data length is len-1 (one byte of len is port_status) */
--len; --len;
if (len > 0) { if (len > 0) {
tty_insert_flip_string_fixed_flag(&port->port, data, tty_insert_flip_string_fixed_flag(&port->port, data,
flag, len); tty_flag, len);
tty_flip_buffer_push(&port->port); tty_flip_buffer_push(&port->port);
} }
} }
spin_unlock(&priv->dp_port_lock); spin_unlock_irqrestore(&priv->dp_port_lock, flags);
if (opcode == DIGI_CMD_RECEIVE_DISABLE) if (opcode == DIGI_CMD_RECEIVE_DISABLE)
dev_dbg(&port->dev, "%s: got RECEIVE_DISABLE\n", __func__); dev_dbg(&port->dev, "%s: got RECEIVE_DISABLE\n", __func__);
...@@ -1474,6 +1476,7 @@ static int digi_read_oob_callback(struct urb *urb) ...@@ -1474,6 +1476,7 @@ static int digi_read_oob_callback(struct urb *urb)
struct digi_port *priv = usb_get_serial_port_data(port); struct digi_port *priv = usb_get_serial_port_data(port);
unsigned char *buf = urb->transfer_buffer; unsigned char *buf = urb->transfer_buffer;
int opcode, line, status, val; int opcode, line, status, val;
unsigned long flags;
int i; int i;
unsigned int rts; unsigned int rts;
...@@ -1506,7 +1509,7 @@ static int digi_read_oob_callback(struct urb *urb) ...@@ -1506,7 +1509,7 @@ static int digi_read_oob_callback(struct urb *urb)
rts = C_CRTSCTS(tty); rts = C_CRTSCTS(tty);
if (tty && opcode == DIGI_CMD_READ_INPUT_SIGNALS) { if (tty && opcode == DIGI_CMD_READ_INPUT_SIGNALS) {
spin_lock(&priv->dp_port_lock); spin_lock_irqsave(&priv->dp_port_lock, flags);
/* convert from digi flags to termiox flags */ /* convert from digi flags to termiox flags */
if (val & DIGI_READ_INPUT_SIGNALS_CTS) { if (val & DIGI_READ_INPUT_SIGNALS_CTS) {
priv->dp_modem_signals |= TIOCM_CTS; priv->dp_modem_signals |= TIOCM_CTS;
...@@ -1530,12 +1533,12 @@ static int digi_read_oob_callback(struct urb *urb) ...@@ -1530,12 +1533,12 @@ static int digi_read_oob_callback(struct urb *urb)
else else
priv->dp_modem_signals &= ~TIOCM_CD; priv->dp_modem_signals &= ~TIOCM_CD;
spin_unlock(&priv->dp_port_lock); spin_unlock_irqrestore(&priv->dp_port_lock, flags);
} else if (opcode == DIGI_CMD_TRANSMIT_IDLE) { } else if (opcode == DIGI_CMD_TRANSMIT_IDLE) {
spin_lock(&priv->dp_port_lock); spin_lock_irqsave(&priv->dp_port_lock, flags);
priv->dp_transmit_idle = 1; priv->dp_transmit_idle = 1;
wake_up_interruptible(&priv->dp_transmit_idle_wait); wake_up_interruptible(&priv->dp_transmit_idle_wait);
spin_unlock(&priv->dp_port_lock); spin_unlock_irqrestore(&priv->dp_port_lock, flags);
} else if (opcode == DIGI_CMD_IFLUSH_FIFO) { } else if (opcode == DIGI_CMD_IFLUSH_FIFO) {
wake_up_interruptible(&priv->dp_flush_wait); wake_up_interruptible(&priv->dp_flush_wait);
} }
......
...@@ -648,6 +648,7 @@ static void edge_interrupt_callback(struct urb *urb) ...@@ -648,6 +648,7 @@ static void edge_interrupt_callback(struct urb *urb)
struct usb_serial_port *port; struct usb_serial_port *port;
unsigned char *data = urb->transfer_buffer; unsigned char *data = urb->transfer_buffer;
int length = urb->actual_length; int length = urb->actual_length;
unsigned long flags;
int bytes_avail; int bytes_avail;
int position; int position;
int txCredits; int txCredits;
...@@ -679,7 +680,7 @@ static void edge_interrupt_callback(struct urb *urb) ...@@ -679,7 +680,7 @@ static void edge_interrupt_callback(struct urb *urb)
if (length > 1) { if (length > 1) {
bytes_avail = data[0] | (data[1] << 8); bytes_avail = data[0] | (data[1] << 8);
if (bytes_avail) { if (bytes_avail) {
spin_lock(&edge_serial->es_lock); spin_lock_irqsave(&edge_serial->es_lock, flags);
edge_serial->rxBytesAvail += bytes_avail; edge_serial->rxBytesAvail += bytes_avail;
dev_dbg(dev, dev_dbg(dev,
"%s - bytes_avail=%d, rxBytesAvail=%d, read_in_progress=%d\n", "%s - bytes_avail=%d, rxBytesAvail=%d, read_in_progress=%d\n",
...@@ -702,7 +703,8 @@ static void edge_interrupt_callback(struct urb *urb) ...@@ -702,7 +703,8 @@ static void edge_interrupt_callback(struct urb *urb)
edge_serial->read_in_progress = false; edge_serial->read_in_progress = false;
} }
} }
spin_unlock(&edge_serial->es_lock); spin_unlock_irqrestore(&edge_serial->es_lock,
flags);
} }
} }
/* grab the txcredits for the ports if available */ /* grab the txcredits for the ports if available */
...@@ -715,9 +717,11 @@ static void edge_interrupt_callback(struct urb *urb) ...@@ -715,9 +717,11 @@ static void edge_interrupt_callback(struct urb *urb)
port = edge_serial->serial->port[portNumber]; port = edge_serial->serial->port[portNumber];
edge_port = usb_get_serial_port_data(port); edge_port = usb_get_serial_port_data(port);
if (edge_port->open) { if (edge_port->open) {
spin_lock(&edge_port->ep_lock); spin_lock_irqsave(&edge_port->ep_lock,
flags);
edge_port->txCredits += txCredits; edge_port->txCredits += txCredits;
spin_unlock(&edge_port->ep_lock); spin_unlock_irqrestore(&edge_port->ep_lock,
flags);
dev_dbg(dev, "%s - txcredits for port%d = %d\n", dev_dbg(dev, "%s - txcredits for port%d = %d\n",
__func__, portNumber, __func__, portNumber,
edge_port->txCredits); edge_port->txCredits);
...@@ -758,6 +762,7 @@ static void edge_bulk_in_callback(struct urb *urb) ...@@ -758,6 +762,7 @@ static void edge_bulk_in_callback(struct urb *urb)
int retval; int retval;
__u16 raw_data_length; __u16 raw_data_length;
int status = urb->status; int status = urb->status;
unsigned long flags;
if (status) { if (status) {
dev_dbg(&urb->dev->dev, "%s - nonzero read bulk status received: %d\n", dev_dbg(&urb->dev->dev, "%s - nonzero read bulk status received: %d\n",
...@@ -777,7 +782,7 @@ static void edge_bulk_in_callback(struct urb *urb) ...@@ -777,7 +782,7 @@ static void edge_bulk_in_callback(struct urb *urb)
usb_serial_debug_data(dev, __func__, raw_data_length, data); usb_serial_debug_data(dev, __func__, raw_data_length, data);
spin_lock(&edge_serial->es_lock); spin_lock_irqsave(&edge_serial->es_lock, flags);
/* decrement our rxBytes available by the number that we just got */ /* decrement our rxBytes available by the number that we just got */
edge_serial->rxBytesAvail -= raw_data_length; edge_serial->rxBytesAvail -= raw_data_length;
...@@ -801,7 +806,7 @@ static void edge_bulk_in_callback(struct urb *urb) ...@@ -801,7 +806,7 @@ static void edge_bulk_in_callback(struct urb *urb)
edge_serial->read_in_progress = false; edge_serial->read_in_progress = false;
} }
spin_unlock(&edge_serial->es_lock); spin_unlock_irqrestore(&edge_serial->es_lock, flags);
} }
......
...@@ -1729,6 +1729,7 @@ static void edge_bulk_in_callback(struct urb *urb) ...@@ -1729,6 +1729,7 @@ static void edge_bulk_in_callback(struct urb *urb)
struct edgeport_port *edge_port = urb->context; struct edgeport_port *edge_port = urb->context;
struct device *dev = &edge_port->port->dev; struct device *dev = &edge_port->port->dev;
unsigned char *data = urb->transfer_buffer; unsigned char *data = urb->transfer_buffer;
unsigned long flags;
int retval = 0; int retval = 0;
int port_number; int port_number;
int status = urb->status; int status = urb->status;
...@@ -1780,13 +1781,13 @@ static void edge_bulk_in_callback(struct urb *urb) ...@@ -1780,13 +1781,13 @@ static void edge_bulk_in_callback(struct urb *urb)
exit: exit:
/* continue read unless stopped */ /* continue read unless stopped */
spin_lock(&edge_port->ep_lock); spin_lock_irqsave(&edge_port->ep_lock, flags);
if (edge_port->ep_read_urb_state == EDGE_READ_URB_RUNNING) if (edge_port->ep_read_urb_state == EDGE_READ_URB_RUNNING)
retval = usb_submit_urb(urb, GFP_ATOMIC); retval = usb_submit_urb(urb, GFP_ATOMIC);
else if (edge_port->ep_read_urb_state == EDGE_READ_URB_STOPPING) else if (edge_port->ep_read_urb_state == EDGE_READ_URB_STOPPING)
edge_port->ep_read_urb_state = EDGE_READ_URB_STOPPED; edge_port->ep_read_urb_state = EDGE_READ_URB_STOPPED;
spin_unlock(&edge_port->ep_lock); spin_unlock_irqrestore(&edge_port->ep_lock, flags);
if (retval) if (retval)
dev_err(dev, "%s - usb_submit_urb failed with result %d\n", __func__, retval); dev_err(dev, "%s - usb_submit_urb failed with result %d\n", __func__, retval);
} }
......
...@@ -132,7 +132,7 @@ irda_usb_find_class_desc(struct usb_serial *serial, unsigned int ifnum) ...@@ -132,7 +132,7 @@ irda_usb_find_class_desc(struct usb_serial *serial, unsigned int ifnum)
0, ifnum, desc, sizeof(*desc), 1000); 0, ifnum, desc, sizeof(*desc), 1000);
dev_dbg(&serial->dev->dev, "%s - ret=%d\n", __func__, ret); dev_dbg(&serial->dev->dev, "%s - ret=%d\n", __func__, ret);
if (ret < sizeof(*desc)) { if (ret < (int)sizeof(*desc)) {
dev_dbg(&serial->dev->dev, dev_dbg(&serial->dev->dev,
"%s - class descriptor read %s (%d)\n", __func__, "%s - class descriptor read %s (%d)\n", __func__,
(ret < 0) ? "failed" : "too short", ret); (ret < 0) ? "failed" : "too short", ret);
......
...@@ -58,7 +58,6 @@ struct iuu_private { ...@@ -58,7 +58,6 @@ struct iuu_private {
u8 *buf; /* used for initialize speed */ u8 *buf; /* used for initialize speed */
u8 len; u8 len;
int vcc; /* vcc (either 3 or 5 V) */ int vcc; /* vcc (either 3 or 5 V) */
u32 baud;
u32 boost; u32 boost;
u32 clk; u32 clk;
}; };
...@@ -963,9 +962,6 @@ static int iuu_open(struct tty_struct *tty, struct usb_serial_port *port) ...@@ -963,9 +962,6 @@ static int iuu_open(struct tty_struct *tty, struct usb_serial_port *port)
struct iuu_private *priv = usb_get_serial_port_data(port); struct iuu_private *priv = usb_get_serial_port_data(port);
baud = tty->termios.c_ospeed; baud = tty->termios.c_ospeed;
tty->termios.c_ispeed = baud;
/* Re-encode speed */
tty_encode_baud_rate(tty, baud, baud);
dev_dbg(dev, "%s - baud %d\n", __func__, baud); dev_dbg(dev, "%s - baud %d\n", __func__, baud);
usb_clear_halt(serial->dev, port->write_urb->pipe); usb_clear_halt(serial->dev, port->write_urb->pipe);
...@@ -991,7 +987,6 @@ static int iuu_open(struct tty_struct *tty, struct usb_serial_port *port) ...@@ -991,7 +987,6 @@ static int iuu_open(struct tty_struct *tty, struct usb_serial_port *port)
if (boost < 100) if (boost < 100)
boost = 100; boost = 100;
priv->boost = boost; priv->boost = boost;
priv->baud = baud;
switch (clockmode) { switch (clockmode) {
case 2: /* 3.680 Mhz */ case 2: /* 3.680 Mhz */
priv->clk = IUU_CLK_3680000; priv->clk = IUU_CLK_3680000;
......
...@@ -67,7 +67,6 @@ static int klsi_105_prepare_write_buffer(struct usb_serial_port *port, ...@@ -67,7 +67,6 @@ static int klsi_105_prepare_write_buffer(struct usb_serial_port *port,
*/ */
static const struct usb_device_id id_table[] = { static const struct usb_device_id id_table[] = {
{ USB_DEVICE(PALMCONNECT_VID, PALMCONNECT_PID) }, { USB_DEVICE(PALMCONNECT_VID, PALMCONNECT_PID) },
{ USB_DEVICE(KLSI_VID, KLSI_KL5KUSB105D_PID) },
{ } /* Terminating entry */ { } /* Terminating entry */
}; };
......
...@@ -7,9 +7,6 @@ ...@@ -7,9 +7,6 @@
#define PALMCONNECT_VID 0x0830 #define PALMCONNECT_VID 0x0830
#define PALMCONNECT_PID 0x0080 #define PALMCONNECT_PID 0x0080
#define KLSI_VID 0x05e9
#define KLSI_KL5KUSB105D_PID 0x00c0
/* Vendor commands: */ /* Vendor commands: */
......
...@@ -190,8 +190,10 @@ static int kobil_open(struct tty_struct *tty, struct usb_serial_port *port) ...@@ -190,8 +190,10 @@ static int kobil_open(struct tty_struct *tty, struct usb_serial_port *port)
KOBIL_TIMEOUT KOBIL_TIMEOUT
); );
dev_dbg(dev, "%s - Send get_HW_version URB returns: %i\n", __func__, result); dev_dbg(dev, "%s - Send get_HW_version URB returns: %i\n", __func__, result);
dev_dbg(dev, "Hardware version: %i.%i.%i\n", transfer_buffer[0], if (result >= 3) {
transfer_buffer[1], transfer_buffer[2]); dev_dbg(dev, "Hardware version: %i.%i.%i\n", transfer_buffer[0],
transfer_buffer[1], transfer_buffer[2]);
}
/* get firmware version */ /* get firmware version */
result = usb_control_msg(port->serial->dev, result = usb_control_msg(port->serial->dev,
...@@ -205,8 +207,10 @@ static int kobil_open(struct tty_struct *tty, struct usb_serial_port *port) ...@@ -205,8 +207,10 @@ static int kobil_open(struct tty_struct *tty, struct usb_serial_port *port)
KOBIL_TIMEOUT KOBIL_TIMEOUT
); );
dev_dbg(dev, "%s - Send get_FW_version URB returns: %i\n", __func__, result); dev_dbg(dev, "%s - Send get_FW_version URB returns: %i\n", __func__, result);
dev_dbg(dev, "Firmware version: %i.%i.%i\n", transfer_buffer[0], if (result >= 3) {
transfer_buffer[1], transfer_buffer[2]); dev_dbg(dev, "Firmware version: %i.%i.%i\n", transfer_buffer[0],
transfer_buffer[1], transfer_buffer[2]);
}
if (priv->device_type == KOBIL_ADAPTER_B_PRODUCT_ID || if (priv->device_type == KOBIL_ADAPTER_B_PRODUCT_ID ||
priv->device_type == KOBIL_ADAPTER_K_PRODUCT_ID) { priv->device_type == KOBIL_ADAPTER_K_PRODUCT_ID) {
...@@ -393,12 +397,20 @@ static int kobil_tiocmget(struct tty_struct *tty) ...@@ -393,12 +397,20 @@ static int kobil_tiocmget(struct tty_struct *tty)
transfer_buffer_length, transfer_buffer_length,
KOBIL_TIMEOUT); KOBIL_TIMEOUT);
dev_dbg(&port->dev, "%s - Send get_status_line_state URB returns: %i. Statusline: %02x\n", dev_dbg(&port->dev, "Send get_status_line_state URB returns: %i\n",
__func__, result, transfer_buffer[0]); result);
if (result < 1) {
if (result >= 0)
result = -EIO;
goto out_free;
}
dev_dbg(&port->dev, "Statusline: %02x\n", transfer_buffer[0]);
result = 0; result = 0;
if ((transfer_buffer[0] & SUSBCR_GSL_DSR) != 0) if ((transfer_buffer[0] & SUSBCR_GSL_DSR) != 0)
result = TIOCM_DSR; result = TIOCM_DSR;
out_free:
kfree(transfer_buffer); kfree(transfer_buffer);
return result; return result;
} }
......
...@@ -340,14 +340,15 @@ static void async_complete(struct urb *urb) ...@@ -340,14 +340,15 @@ static void async_complete(struct urb *urb)
{ {
struct urbtracker *urbtrack = urb->context; struct urbtracker *urbtrack = urb->context;
int status = urb->status; int status = urb->status;
unsigned long flags;
if (unlikely(status)) if (unlikely(status))
dev_dbg(&urb->dev->dev, "%s - nonzero urb status received: %d\n", __func__, status); dev_dbg(&urb->dev->dev, "%s - nonzero urb status received: %d\n", __func__, status);
/* remove the urbtracker from the active_urbs list */ /* remove the urbtracker from the active_urbs list */
spin_lock(&urbtrack->mos_parport->listlock); spin_lock_irqsave(&urbtrack->mos_parport->listlock, flags);
list_del(&urbtrack->urblist_entry); list_del(&urbtrack->urblist_entry);
spin_unlock(&urbtrack->mos_parport->listlock); spin_unlock_irqrestore(&urbtrack->mos_parport->listlock, flags);
kref_put(&urbtrack->ref_count, destroy_urbtracker); kref_put(&urbtrack->ref_count, destroy_urbtracker);
} }
...@@ -1526,8 +1527,6 @@ static void change_port_settings(struct tty_struct *tty, ...@@ -1526,8 +1527,6 @@ static void change_port_settings(struct tty_struct *tty,
struct usb_serial *serial; struct usb_serial *serial;
int baud; int baud;
unsigned cflag; unsigned cflag;
unsigned iflag;
__u8 mask = 0xff;
__u8 lData; __u8 lData;
__u8 lParity; __u8 lParity;
__u8 lStop; __u8 lStop;
...@@ -1551,23 +1550,19 @@ static void change_port_settings(struct tty_struct *tty, ...@@ -1551,23 +1550,19 @@ static void change_port_settings(struct tty_struct *tty,
lParity = 0x00; /* No parity */ lParity = 0x00; /* No parity */
cflag = tty->termios.c_cflag; cflag = tty->termios.c_cflag;
iflag = tty->termios.c_iflag;
/* Change the number of bits */ /* Change the number of bits */
switch (cflag & CSIZE) { switch (cflag & CSIZE) {
case CS5: case CS5:
lData = UART_LCR_WLEN5; lData = UART_LCR_WLEN5;
mask = 0x1f;
break; break;
case CS6: case CS6:
lData = UART_LCR_WLEN6; lData = UART_LCR_WLEN6;
mask = 0x3f;
break; break;
case CS7: case CS7:
lData = UART_LCR_WLEN7; lData = UART_LCR_WLEN7;
mask = 0x7f;
break; break;
default: default:
case CS8: case CS8:
...@@ -1685,11 +1680,8 @@ static void mos7720_set_termios(struct tty_struct *tty, ...@@ -1685,11 +1680,8 @@ static void mos7720_set_termios(struct tty_struct *tty,
struct usb_serial_port *port, struct ktermios *old_termios) struct usb_serial_port *port, struct ktermios *old_termios)
{ {
int status; int status;
struct usb_serial *serial;
struct moschip_port *mos7720_port; struct moschip_port *mos7720_port;
serial = port->serial;
mos7720_port = usb_get_serial_port_data(port); mos7720_port = usb_get_serial_port_data(port);
if (mos7720_port == NULL) if (mos7720_port == NULL)
......
...@@ -805,18 +805,19 @@ static void mos7840_bulk_out_data_callback(struct urb *urb) ...@@ -805,18 +805,19 @@ static void mos7840_bulk_out_data_callback(struct urb *urb)
struct moschip_port *mos7840_port; struct moschip_port *mos7840_port;
struct usb_serial_port *port; struct usb_serial_port *port;
int status = urb->status; int status = urb->status;
unsigned long flags;
int i; int i;
mos7840_port = urb->context; mos7840_port = urb->context;
port = mos7840_port->port; port = mos7840_port->port;
spin_lock(&mos7840_port->pool_lock); spin_lock_irqsave(&mos7840_port->pool_lock, flags);
for (i = 0; i < NUM_URBS; i++) { for (i = 0; i < NUM_URBS; i++) {
if (urb == mos7840_port->write_urb_pool[i]) { if (urb == mos7840_port->write_urb_pool[i]) {
mos7840_port->busy[i] = 0; mos7840_port->busy[i] = 0;
break; break;
} }
} }
spin_unlock(&mos7840_port->pool_lock); spin_unlock_irqrestore(&mos7840_port->pool_lock, flags);
if (status) { if (status) {
dev_dbg(&port->dev, "nonzero write bulk status received:%d\n", status); dev_dbg(&port->dev, "nonzero write bulk status received:%d\n", status);
......
...@@ -194,7 +194,7 @@ static inline int qt2_getregister(struct usb_device *dev, ...@@ -194,7 +194,7 @@ static inline int qt2_getregister(struct usb_device *dev,
ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
QT_SET_GET_REGISTER, 0xc0, reg, QT_SET_GET_REGISTER, 0xc0, reg,
uart, data, sizeof(*data), QT2_USB_TIMEOUT); uart, data, sizeof(*data), QT2_USB_TIMEOUT);
if (ret < sizeof(*data)) { if (ret < (int)sizeof(*data)) {
if (ret >= 0) if (ret >= 0)
ret = -EIO; ret = -EIO;
} }
...@@ -621,16 +621,17 @@ static void qt2_write_bulk_callback(struct urb *urb) ...@@ -621,16 +621,17 @@ static void qt2_write_bulk_callback(struct urb *urb)
{ {
struct usb_serial_port *port; struct usb_serial_port *port;
struct qt2_port_private *port_priv; struct qt2_port_private *port_priv;
unsigned long flags;
port = urb->context; port = urb->context;
port_priv = usb_get_serial_port_data(port); port_priv = usb_get_serial_port_data(port);
spin_lock(&port_priv->urb_lock); spin_lock_irqsave(&port_priv->urb_lock, flags);
port_priv->urb_in_use = false; port_priv->urb_in_use = false;
usb_serial_port_softint(port); usb_serial_port_softint(port);
spin_unlock(&port_priv->urb_lock); spin_unlock_irqrestore(&port_priv->urb_lock, flags);
} }
......
...@@ -409,6 +409,7 @@ static void sierra_outdat_callback(struct urb *urb) ...@@ -409,6 +409,7 @@ static void sierra_outdat_callback(struct urb *urb)
struct sierra_port_private *portdata = usb_get_serial_port_data(port); struct sierra_port_private *portdata = usb_get_serial_port_data(port);
struct sierra_intf_private *intfdata; struct sierra_intf_private *intfdata;
int status = urb->status; int status = urb->status;
unsigned long flags;
intfdata = usb_get_serial_data(port->serial); intfdata = usb_get_serial_data(port->serial);
...@@ -419,12 +420,12 @@ static void sierra_outdat_callback(struct urb *urb) ...@@ -419,12 +420,12 @@ static void sierra_outdat_callback(struct urb *urb)
dev_dbg(&port->dev, "%s - nonzero write bulk status " dev_dbg(&port->dev, "%s - nonzero write bulk status "
"received: %d\n", __func__, status); "received: %d\n", __func__, status);
spin_lock(&portdata->lock); spin_lock_irqsave(&portdata->lock, flags);
--portdata->outstanding_urbs; --portdata->outstanding_urbs;
spin_unlock(&portdata->lock); spin_unlock_irqrestore(&portdata->lock, flags);
spin_lock(&intfdata->susp_lock); spin_lock_irqsave(&intfdata->susp_lock, flags);
--intfdata->in_flight; --intfdata->in_flight;
spin_unlock(&intfdata->susp_lock); spin_unlock_irqrestore(&intfdata->susp_lock, flags);
usb_serial_port_softint(port); usb_serial_port_softint(port);
} }
...@@ -770,9 +771,9 @@ static void sierra_close(struct usb_serial_port *port) ...@@ -770,9 +771,9 @@ static void sierra_close(struct usb_serial_port *port)
kfree(urb->transfer_buffer); kfree(urb->transfer_buffer);
usb_free_urb(urb); usb_free_urb(urb);
usb_autopm_put_interface_async(serial->interface); usb_autopm_put_interface_async(serial->interface);
spin_lock(&portdata->lock); spin_lock_irq(&portdata->lock);
portdata->outstanding_urbs--; portdata->outstanding_urbs--;
spin_unlock(&portdata->lock); spin_unlock_irq(&portdata->lock);
} }
sierra_stop_rx_urbs(port); sierra_stop_rx_urbs(port);
......
...@@ -104,7 +104,7 @@ static inline int ssu100_getregister(struct usb_device *dev, ...@@ -104,7 +104,7 @@ static inline int ssu100_getregister(struct usb_device *dev,
ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
QT_SET_GET_REGISTER, 0xc0, reg, QT_SET_GET_REGISTER, 0xc0, reg,
uart, data, sizeof(*data), 300); uart, data, sizeof(*data), 300);
if (ret < sizeof(*data)) { if (ret < (int)sizeof(*data)) {
if (ret >= 0) if (ret >= 0)
ret = -EIO; ret = -EIO;
} }
......
...@@ -35,6 +35,7 @@ static void symbol_int_callback(struct urb *urb) ...@@ -35,6 +35,7 @@ static void symbol_int_callback(struct urb *urb)
struct symbol_private *priv = usb_get_serial_port_data(port); struct symbol_private *priv = usb_get_serial_port_data(port);
unsigned char *data = urb->transfer_buffer; unsigned char *data = urb->transfer_buffer;
int status = urb->status; int status = urb->status;
unsigned long flags;
int result; int result;
int data_length; int data_length;
...@@ -73,7 +74,7 @@ static void symbol_int_callback(struct urb *urb) ...@@ -73,7 +74,7 @@ static void symbol_int_callback(struct urb *urb)
} }
exit: exit:
spin_lock(&priv->lock); spin_lock_irqsave(&priv->lock, flags);
/* Continue trying to always read if we should */ /* Continue trying to always read if we should */
if (!priv->throttled) { if (!priv->throttled) {
...@@ -84,7 +85,7 @@ static void symbol_int_callback(struct urb *urb) ...@@ -84,7 +85,7 @@ static void symbol_int_callback(struct urb *urb)
__func__, result); __func__, result);
} else } else
priv->actually_throttled = true; priv->actually_throttled = true;
spin_unlock(&priv->lock); spin_unlock_irqrestore(&priv->lock, flags);
} }
static int symbol_open(struct tty_struct *tty, struct usb_serial_port *port) static int symbol_open(struct tty_struct *tty, struct usb_serial_port *port)
......
...@@ -1215,6 +1215,7 @@ static void ti_bulk_in_callback(struct urb *urb) ...@@ -1215,6 +1215,7 @@ static void ti_bulk_in_callback(struct urb *urb)
struct usb_serial_port *port = tport->tp_port; struct usb_serial_port *port = tport->tp_port;
struct device *dev = &urb->dev->dev; struct device *dev = &urb->dev->dev;
int status = urb->status; int status = urb->status;
unsigned long flags;
int retval = 0; int retval = 0;
switch (status) { switch (status) {
...@@ -1247,20 +1248,20 @@ static void ti_bulk_in_callback(struct urb *urb) ...@@ -1247,20 +1248,20 @@ static void ti_bulk_in_callback(struct urb *urb)
__func__); __func__);
else else
ti_recv(port, urb->transfer_buffer, urb->actual_length); ti_recv(port, urb->transfer_buffer, urb->actual_length);
spin_lock(&tport->tp_lock); spin_lock_irqsave(&tport->tp_lock, flags);
port->icount.rx += urb->actual_length; port->icount.rx += urb->actual_length;
spin_unlock(&tport->tp_lock); spin_unlock_irqrestore(&tport->tp_lock, flags);
} }
exit: exit:
/* continue to read unless stopping */ /* continue to read unless stopping */
spin_lock(&tport->tp_lock); spin_lock_irqsave(&tport->tp_lock, flags);
if (tport->tp_read_urb_state == TI_READ_URB_RUNNING) if (tport->tp_read_urb_state == TI_READ_URB_RUNNING)
retval = usb_submit_urb(urb, GFP_ATOMIC); retval = usb_submit_urb(urb, GFP_ATOMIC);
else if (tport->tp_read_urb_state == TI_READ_URB_STOPPING) else if (tport->tp_read_urb_state == TI_READ_URB_STOPPING)
tport->tp_read_urb_state = TI_READ_URB_STOPPED; tport->tp_read_urb_state = TI_READ_URB_STOPPED;
spin_unlock(&tport->tp_lock); spin_unlock_irqrestore(&tport->tp_lock, flags);
if (retval) if (retval)
dev_err(dev, "%s - resubmit read urb failed, %d\n", dev_err(dev, "%s - resubmit read urb failed, %d\n",
__func__, retval); __func__, retval);
......
...@@ -326,6 +326,7 @@ static void usb_wwan_outdat_callback(struct urb *urb) ...@@ -326,6 +326,7 @@ static void usb_wwan_outdat_callback(struct urb *urb)
struct usb_serial_port *port; struct usb_serial_port *port;
struct usb_wwan_port_private *portdata; struct usb_wwan_port_private *portdata;
struct usb_wwan_intf_private *intfdata; struct usb_wwan_intf_private *intfdata;
unsigned long flags;
int i; int i;
port = urb->context; port = urb->context;
...@@ -334,9 +335,9 @@ static void usb_wwan_outdat_callback(struct urb *urb) ...@@ -334,9 +335,9 @@ static void usb_wwan_outdat_callback(struct urb *urb)
usb_serial_port_softint(port); usb_serial_port_softint(port);
usb_autopm_put_interface_async(port->serial->interface); usb_autopm_put_interface_async(port->serial->interface);
portdata = usb_get_serial_port_data(port); portdata = usb_get_serial_port_data(port);
spin_lock(&intfdata->susp_lock); spin_lock_irqsave(&intfdata->susp_lock, flags);
intfdata->in_flight--; intfdata->in_flight--;
spin_unlock(&intfdata->susp_lock); spin_unlock_irqrestore(&intfdata->susp_lock, flags);
for (i = 0; i < N_OUT_URB; ++i) { for (i = 0; i < N_OUT_URB; ++i) {
if (portdata->out_urbs[i] == urb) { if (portdata->out_urbs[i] == urb) {
......
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