Commit 155591d3 authored by Jiri Slaby's avatar Jiri Slaby Committed by Johan Hovold

USB: serial: make usb_serial_driver::chars_in_buffer return uint

tty_operations::chars_in_buffer is being switched to return uint. Do the
same for usb_serial_driver's chars_in_buffer.
Signed-off-by: default avatarJiri Slaby <jslaby@suse.cz>
[ johan: amend commit message ]
Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
parent 94cc7aea
...@@ -129,7 +129,7 @@ static void cypress_set_termios(struct tty_struct *tty, ...@@ -129,7 +129,7 @@ static void cypress_set_termios(struct tty_struct *tty,
static int cypress_tiocmget(struct tty_struct *tty); static int cypress_tiocmget(struct tty_struct *tty);
static int cypress_tiocmset(struct tty_struct *tty, static int cypress_tiocmset(struct tty_struct *tty,
unsigned int set, unsigned int clear); unsigned int set, unsigned int clear);
static int cypress_chars_in_buffer(struct tty_struct *tty); static unsigned int cypress_chars_in_buffer(struct tty_struct *tty);
static void cypress_throttle(struct tty_struct *tty); static void cypress_throttle(struct tty_struct *tty);
static void cypress_unthrottle(struct tty_struct *tty); static void cypress_unthrottle(struct tty_struct *tty);
static void cypress_set_dead(struct usb_serial_port *port); static void cypress_set_dead(struct usb_serial_port *port);
...@@ -970,18 +970,18 @@ static void cypress_set_termios(struct tty_struct *tty, ...@@ -970,18 +970,18 @@ static void cypress_set_termios(struct tty_struct *tty,
/* returns amount of data still left in soft buffer */ /* returns amount of data still left in soft buffer */
static int cypress_chars_in_buffer(struct tty_struct *tty) static unsigned int cypress_chars_in_buffer(struct tty_struct *tty)
{ {
struct usb_serial_port *port = tty->driver_data; struct usb_serial_port *port = tty->driver_data;
struct cypress_private *priv = usb_get_serial_port_data(port); struct cypress_private *priv = usb_get_serial_port_data(port);
int chars = 0; unsigned int chars;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&priv->lock, flags); spin_lock_irqsave(&priv->lock, flags);
chars = kfifo_len(&priv->write_fifo); chars = kfifo_len(&priv->write_fifo);
spin_unlock_irqrestore(&priv->lock, flags); spin_unlock_irqrestore(&priv->lock, flags);
dev_dbg(&port->dev, "%s - returns %d\n", __func__, chars); dev_dbg(&port->dev, "%s - returns %u\n", __func__, chars);
return chars; return chars;
} }
......
...@@ -224,7 +224,7 @@ static int digi_write(struct tty_struct *tty, struct usb_serial_port *port, ...@@ -224,7 +224,7 @@ static int digi_write(struct tty_struct *tty, struct usb_serial_port *port,
const unsigned char *buf, int count); const unsigned char *buf, int count);
static void digi_write_bulk_callback(struct urb *urb); static void digi_write_bulk_callback(struct urb *urb);
static unsigned int digi_write_room(struct tty_struct *tty); static unsigned int digi_write_room(struct tty_struct *tty);
static int digi_chars_in_buffer(struct tty_struct *tty); static unsigned int digi_chars_in_buffer(struct tty_struct *tty);
static int digi_open(struct tty_struct *tty, struct usb_serial_port *port); static int digi_open(struct tty_struct *tty, struct usb_serial_port *port);
static void digi_close(struct usb_serial_port *port); static void digi_close(struct usb_serial_port *port);
static void digi_dtr_rts(struct usb_serial_port *port, int on); static void digi_dtr_rts(struct usb_serial_port *port, int on);
...@@ -1040,7 +1040,7 @@ static unsigned int digi_write_room(struct tty_struct *tty) ...@@ -1040,7 +1040,7 @@ static unsigned int digi_write_room(struct tty_struct *tty)
} }
static int digi_chars_in_buffer(struct tty_struct *tty) static unsigned int digi_chars_in_buffer(struct tty_struct *tty)
{ {
struct usb_serial_port *port = tty->driver_data; struct usb_serial_port *port = tty->driver_data;
struct digi_port *priv = usb_get_serial_port_data(port); struct digi_port *priv = usb_get_serial_port_data(port);
......
...@@ -247,11 +247,11 @@ unsigned int usb_serial_generic_write_room(struct tty_struct *tty) ...@@ -247,11 +247,11 @@ unsigned int usb_serial_generic_write_room(struct tty_struct *tty)
return room; return room;
} }
int usb_serial_generic_chars_in_buffer(struct tty_struct *tty) unsigned int usb_serial_generic_chars_in_buffer(struct tty_struct *tty)
{ {
struct usb_serial_port *port = tty->driver_data; struct usb_serial_port *port = tty->driver_data;
unsigned long flags; unsigned long flags;
int chars; unsigned int chars;
if (!port->bulk_out_size) if (!port->bulk_out_size)
return 0; return 0;
...@@ -260,7 +260,7 @@ int usb_serial_generic_chars_in_buffer(struct tty_struct *tty) ...@@ -260,7 +260,7 @@ int usb_serial_generic_chars_in_buffer(struct tty_struct *tty)
chars = kfifo_len(&port->write_fifo) + port->tx_bytes; chars = kfifo_len(&port->write_fifo) + port->tx_bytes;
spin_unlock_irqrestore(&port->lock, flags); spin_unlock_irqrestore(&port->lock, flags);
dev_dbg(&port->dev, "%s - returns %d\n", __func__, chars); dev_dbg(&port->dev, "%s - returns %u\n", __func__, chars);
return chars; return chars;
} }
EXPORT_SYMBOL_GPL(usb_serial_generic_chars_in_buffer); EXPORT_SYMBOL_GPL(usb_serial_generic_chars_in_buffer);
......
...@@ -1391,11 +1391,11 @@ static unsigned int edge_write_room(struct tty_struct *tty) ...@@ -1391,11 +1391,11 @@ static unsigned int edge_write_room(struct tty_struct *tty)
* system, * system,
* Otherwise we return a negative error number. * Otherwise we return a negative error number.
*****************************************************************************/ *****************************************************************************/
static int edge_chars_in_buffer(struct tty_struct *tty) static unsigned int edge_chars_in_buffer(struct tty_struct *tty)
{ {
struct usb_serial_port *port = tty->driver_data; struct usb_serial_port *port = tty->driver_data;
struct edgeport_port *edge_port = usb_get_serial_port_data(port); struct edgeport_port *edge_port = usb_get_serial_port_data(port);
int num_chars; unsigned int num_chars;
unsigned long flags; unsigned long flags;
if (edge_port == NULL) if (edge_port == NULL)
...@@ -1413,7 +1413,7 @@ static int edge_chars_in_buffer(struct tty_struct *tty) ...@@ -1413,7 +1413,7 @@ static int edge_chars_in_buffer(struct tty_struct *tty)
edge_port->txfifo.count; edge_port->txfifo.count;
spin_unlock_irqrestore(&edge_port->ep_lock, flags); spin_unlock_irqrestore(&edge_port->ep_lock, flags);
if (num_chars) { if (num_chars) {
dev_dbg(&port->dev, "%s - returns %d\n", __func__, num_chars); dev_dbg(&port->dev, "%s - returns %u\n", __func__, num_chars);
} }
return num_chars; return num_chars;
......
...@@ -2087,11 +2087,11 @@ static unsigned int edge_write_room(struct tty_struct *tty) ...@@ -2087,11 +2087,11 @@ static unsigned int edge_write_room(struct tty_struct *tty)
return room; return room;
} }
static int edge_chars_in_buffer(struct tty_struct *tty) static unsigned int edge_chars_in_buffer(struct tty_struct *tty)
{ {
struct usb_serial_port *port = tty->driver_data; struct usb_serial_port *port = tty->driver_data;
struct edgeport_port *edge_port = usb_get_serial_port_data(port); struct edgeport_port *edge_port = usb_get_serial_port_data(port);
int chars = 0; unsigned int chars;
unsigned long flags; unsigned long flags;
if (edge_port == NULL) if (edge_port == NULL)
return 0; return 0;
...@@ -2100,7 +2100,7 @@ static int edge_chars_in_buffer(struct tty_struct *tty) ...@@ -2100,7 +2100,7 @@ static int edge_chars_in_buffer(struct tty_struct *tty)
chars = kfifo_len(&port->write_fifo); chars = kfifo_len(&port->write_fifo);
spin_unlock_irqrestore(&edge_port->ep_lock, flags); spin_unlock_irqrestore(&edge_port->ep_lock, flags);
dev_dbg(&port->dev, "%s - returns %d\n", __func__, chars); dev_dbg(&port->dev, "%s - returns %u\n", __func__, chars);
return chars; return chars;
} }
......
...@@ -949,11 +949,11 @@ static int mos7720_open(struct tty_struct *tty, struct usb_serial_port *port) ...@@ -949,11 +949,11 @@ static int mos7720_open(struct tty_struct *tty, struct usb_serial_port *port)
* system, * system,
* Otherwise we return a negative error number. * Otherwise we return a negative error number.
*/ */
static int mos7720_chars_in_buffer(struct tty_struct *tty) static unsigned int mos7720_chars_in_buffer(struct tty_struct *tty)
{ {
struct usb_serial_port *port = tty->driver_data; struct usb_serial_port *port = tty->driver_data;
int i; int i;
int chars = 0; unsigned int chars = 0;
struct moschip_port *mos7720_port; struct moschip_port *mos7720_port;
mos7720_port = usb_get_serial_port_data(port); mos7720_port = usb_get_serial_port_data(port);
...@@ -965,7 +965,7 @@ static int mos7720_chars_in_buffer(struct tty_struct *tty) ...@@ -965,7 +965,7 @@ static int mos7720_chars_in_buffer(struct tty_struct *tty)
mos7720_port->write_urb_pool[i]->status == -EINPROGRESS) mos7720_port->write_urb_pool[i]->status == -EINPROGRESS)
chars += URB_TRANSFER_BUFFER_SIZE; chars += URB_TRANSFER_BUFFER_SIZE;
} }
dev_dbg(&port->dev, "%s - returns %d\n", __func__, chars); dev_dbg(&port->dev, "%s - returns %u\n", __func__, chars);
return chars; return chars;
} }
......
...@@ -735,12 +735,12 @@ static int mos7840_open(struct tty_struct *tty, struct usb_serial_port *port) ...@@ -735,12 +735,12 @@ static int mos7840_open(struct tty_struct *tty, struct usb_serial_port *port)
* Otherwise we return zero. * Otherwise we return zero.
*****************************************************************************/ *****************************************************************************/
static int mos7840_chars_in_buffer(struct tty_struct *tty) static unsigned int mos7840_chars_in_buffer(struct tty_struct *tty)
{ {
struct usb_serial_port *port = tty->driver_data; struct usb_serial_port *port = tty->driver_data;
struct moschip_port *mos7840_port = usb_get_serial_port_data(port); struct moschip_port *mos7840_port = usb_get_serial_port_data(port);
int i; int i;
int chars = 0; unsigned int chars = 0;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&mos7840_port->pool_lock, flags); spin_lock_irqsave(&mos7840_port->pool_lock, flags);
...@@ -751,7 +751,7 @@ static int mos7840_chars_in_buffer(struct tty_struct *tty) ...@@ -751,7 +751,7 @@ static int mos7840_chars_in_buffer(struct tty_struct *tty)
} }
} }
spin_unlock_irqrestore(&mos7840_port->pool_lock, flags); spin_unlock_irqrestore(&mos7840_port->pool_lock, flags);
dev_dbg(&port->dev, "%s - returns %d\n", __func__, chars); dev_dbg(&port->dev, "%s - returns %u\n", __func__, chars);
return chars; return chars;
} }
......
...@@ -289,12 +289,12 @@ static unsigned int opticon_write_room(struct tty_struct *tty) ...@@ -289,12 +289,12 @@ static unsigned int opticon_write_room(struct tty_struct *tty)
return 2048; return 2048;
} }
static int opticon_chars_in_buffer(struct tty_struct *tty) static unsigned int opticon_chars_in_buffer(struct tty_struct *tty)
{ {
struct usb_serial_port *port = tty->driver_data; struct usb_serial_port *port = tty->driver_data;
struct opticon_private *priv = usb_get_serial_port_data(port); struct opticon_private *priv = usb_get_serial_port_data(port);
unsigned long flags; unsigned long flags;
int count; unsigned int count;
spin_lock_irqsave(&priv->lock, flags); spin_lock_irqsave(&priv->lock, flags);
count = priv->outstanding_bytes; count = priv->outstanding_bytes;
......
...@@ -127,7 +127,7 @@ static void oti6858_write_bulk_callback(struct urb *urb); ...@@ -127,7 +127,7 @@ static void oti6858_write_bulk_callback(struct urb *urb);
static int oti6858_write(struct tty_struct *tty, struct usb_serial_port *port, static int oti6858_write(struct tty_struct *tty, struct usb_serial_port *port,
const unsigned char *buf, int count); const unsigned char *buf, int count);
static unsigned int oti6858_write_room(struct tty_struct *tty); static unsigned int oti6858_write_room(struct tty_struct *tty);
static int oti6858_chars_in_buffer(struct tty_struct *tty); static unsigned int oti6858_chars_in_buffer(struct tty_struct *tty);
static int oti6858_tiocmget(struct tty_struct *tty); static int oti6858_tiocmget(struct tty_struct *tty);
static int oti6858_tiocmset(struct tty_struct *tty, static int oti6858_tiocmset(struct tty_struct *tty,
unsigned int set, unsigned int clear); unsigned int set, unsigned int clear);
...@@ -376,10 +376,10 @@ static unsigned int oti6858_write_room(struct tty_struct *tty) ...@@ -376,10 +376,10 @@ static unsigned int oti6858_write_room(struct tty_struct *tty)
return room; return room;
} }
static int oti6858_chars_in_buffer(struct tty_struct *tty) static unsigned int oti6858_chars_in_buffer(struct tty_struct *tty)
{ {
struct usb_serial_port *port = tty->driver_data; struct usb_serial_port *port = tty->driver_data;
int chars = 0; unsigned int chars;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&port->lock, flags); spin_lock_irqsave(&port->lock, flags);
......
...@@ -632,19 +632,19 @@ static unsigned int sierra_write_room(struct tty_struct *tty) ...@@ -632,19 +632,19 @@ static unsigned int sierra_write_room(struct tty_struct *tty)
return 2048; return 2048;
} }
static int sierra_chars_in_buffer(struct tty_struct *tty) static unsigned int sierra_chars_in_buffer(struct tty_struct *tty)
{ {
struct usb_serial_port *port = tty->driver_data; struct usb_serial_port *port = tty->driver_data;
struct sierra_port_private *portdata = usb_get_serial_port_data(port); struct sierra_port_private *portdata = usb_get_serial_port_data(port);
unsigned long flags; unsigned long flags;
int chars; unsigned int chars;
/* NOTE: This overcounts somewhat. */ /* NOTE: This overcounts somewhat. */
spin_lock_irqsave(&portdata->lock, flags); spin_lock_irqsave(&portdata->lock, flags);
chars = portdata->outstanding_urbs * MAX_TRANSFER; chars = portdata->outstanding_urbs * MAX_TRANSFER;
spin_unlock_irqrestore(&portdata->lock, flags); spin_unlock_irqrestore(&portdata->lock, flags);
dev_dbg(&port->dev, "%s - %d\n", __func__, chars); dev_dbg(&port->dev, "%s - %u\n", __func__, chars);
return chars; return chars;
} }
......
...@@ -308,7 +308,7 @@ static void ti_close(struct usb_serial_port *port); ...@@ -308,7 +308,7 @@ static void ti_close(struct usb_serial_port *port);
static int ti_write(struct tty_struct *tty, struct usb_serial_port *port, static int ti_write(struct tty_struct *tty, struct usb_serial_port *port,
const unsigned char *data, int count); const unsigned char *data, int count);
static unsigned int ti_write_room(struct tty_struct *tty); static unsigned int ti_write_room(struct tty_struct *tty);
static int ti_chars_in_buffer(struct tty_struct *tty); static unsigned int ti_chars_in_buffer(struct tty_struct *tty);
static bool ti_tx_empty(struct usb_serial_port *port); static bool ti_tx_empty(struct usb_serial_port *port);
static void ti_throttle(struct tty_struct *tty); static void ti_throttle(struct tty_struct *tty);
static void ti_unthrottle(struct tty_struct *tty); static void ti_unthrottle(struct tty_struct *tty);
...@@ -826,18 +826,18 @@ static unsigned int ti_write_room(struct tty_struct *tty) ...@@ -826,18 +826,18 @@ static unsigned int ti_write_room(struct tty_struct *tty)
} }
static int ti_chars_in_buffer(struct tty_struct *tty) static unsigned int ti_chars_in_buffer(struct tty_struct *tty)
{ {
struct usb_serial_port *port = tty->driver_data; struct usb_serial_port *port = tty->driver_data;
struct ti_port *tport = usb_get_serial_port_data(port); struct ti_port *tport = usb_get_serial_port_data(port);
int chars = 0; unsigned int chars;
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&tport->tp_lock, flags); spin_lock_irqsave(&tport->tp_lock, flags);
chars = kfifo_len(&port->write_fifo); chars = kfifo_len(&port->write_fifo);
spin_unlock_irqrestore(&tport->tp_lock, flags); spin_unlock_irqrestore(&tport->tp_lock, flags);
dev_dbg(&port->dev, "%s - returns %d\n", __func__, chars); dev_dbg(&port->dev, "%s - returns %u\n", __func__, chars);
return chars; return chars;
} }
......
...@@ -17,7 +17,7 @@ extern int usb_wwan_tiocmset(struct tty_struct *tty, ...@@ -17,7 +17,7 @@ extern int usb_wwan_tiocmset(struct tty_struct *tty,
unsigned int set, unsigned int clear); unsigned int set, unsigned int clear);
extern int usb_wwan_write(struct tty_struct *tty, struct usb_serial_port *port, extern int usb_wwan_write(struct tty_struct *tty, struct usb_serial_port *port,
const unsigned char *buf, int count); const unsigned char *buf, int count);
extern int usb_wwan_chars_in_buffer(struct tty_struct *tty); extern unsigned int usb_wwan_chars_in_buffer(struct tty_struct *tty);
#ifdef CONFIG_PM #ifdef CONFIG_PM
extern int usb_wwan_suspend(struct usb_serial *serial, pm_message_t message); extern int usb_wwan_suspend(struct usb_serial *serial, pm_message_t message);
extern int usb_wwan_resume(struct usb_serial *serial); extern int usb_wwan_resume(struct usb_serial *serial);
......
...@@ -299,12 +299,12 @@ unsigned int usb_wwan_write_room(struct tty_struct *tty) ...@@ -299,12 +299,12 @@ unsigned int usb_wwan_write_room(struct tty_struct *tty)
} }
EXPORT_SYMBOL(usb_wwan_write_room); EXPORT_SYMBOL(usb_wwan_write_room);
int usb_wwan_chars_in_buffer(struct tty_struct *tty) unsigned int usb_wwan_chars_in_buffer(struct tty_struct *tty)
{ {
struct usb_serial_port *port = tty->driver_data; struct usb_serial_port *port = tty->driver_data;
struct usb_wwan_port_private *portdata; struct usb_wwan_port_private *portdata;
int i; int i;
int data_len = 0; unsigned int data_len = 0;
struct urb *this_urb; struct urb *this_urb;
portdata = usb_get_serial_port_data(port); portdata = usb_get_serial_port_data(port);
...@@ -316,7 +316,7 @@ int usb_wwan_chars_in_buffer(struct tty_struct *tty) ...@@ -316,7 +316,7 @@ int usb_wwan_chars_in_buffer(struct tty_struct *tty)
if (this_urb && test_bit(i, &portdata->out_busy)) if (this_urb && test_bit(i, &portdata->out_busy))
data_len += this_urb->transfer_buffer_length; data_len += this_urb->transfer_buffer_length;
} }
dev_dbg(&port->dev, "%s: %d\n", __func__, data_len); dev_dbg(&port->dev, "%s: %u\n", __func__, data_len);
return data_len; return data_len;
} }
EXPORT_SYMBOL(usb_wwan_chars_in_buffer); EXPORT_SYMBOL(usb_wwan_chars_in_buffer);
......
...@@ -284,7 +284,7 @@ struct usb_serial_driver { ...@@ -284,7 +284,7 @@ struct usb_serial_driver {
void (*set_termios)(struct tty_struct *tty, void (*set_termios)(struct tty_struct *tty,
struct usb_serial_port *port, struct ktermios *old); struct usb_serial_port *port, struct ktermios *old);
void (*break_ctl)(struct tty_struct *tty, int break_state); void (*break_ctl)(struct tty_struct *tty, int break_state);
int (*chars_in_buffer)(struct tty_struct *tty); unsigned int (*chars_in_buffer)(struct tty_struct *tty);
void (*wait_until_sent)(struct tty_struct *tty, long timeout); void (*wait_until_sent)(struct tty_struct *tty, long timeout);
bool (*tx_empty)(struct usb_serial_port *port); bool (*tx_empty)(struct usb_serial_port *port);
void (*throttle)(struct tty_struct *tty); void (*throttle)(struct tty_struct *tty);
...@@ -348,7 +348,7 @@ int usb_serial_generic_write(struct tty_struct *tty, struct usb_serial_port *por ...@@ -348,7 +348,7 @@ int usb_serial_generic_write(struct tty_struct *tty, struct usb_serial_port *por
void usb_serial_generic_close(struct usb_serial_port *port); void usb_serial_generic_close(struct usb_serial_port *port);
int usb_serial_generic_resume(struct usb_serial *serial); int usb_serial_generic_resume(struct usb_serial *serial);
unsigned int usb_serial_generic_write_room(struct tty_struct *tty); unsigned int usb_serial_generic_write_room(struct tty_struct *tty);
int usb_serial_generic_chars_in_buffer(struct tty_struct *tty); unsigned int usb_serial_generic_chars_in_buffer(struct tty_struct *tty);
void usb_serial_generic_wait_until_sent(struct tty_struct *tty, long timeout); void usb_serial_generic_wait_until_sent(struct tty_struct *tty, long timeout);
void usb_serial_generic_read_bulk_callback(struct urb *urb); void usb_serial_generic_read_bulk_callback(struct urb *urb);
void usb_serial_generic_write_bulk_callback(struct urb *urb); void usb_serial_generic_write_bulk_callback(struct urb *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