Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Jiri Slaby <jslaby@suse.cz>
[ johan: amend commit message ]
Signed-off-by: Johan Hovold <johan@kernel.org>

authored by

Jiri Slaby and committed by
Johan Hovold
155591d3 94cc7aea

+39 -39
+4 -4
drivers/usb/serial/cypress_m8.c
··· 129 129 static int cypress_tiocmget(struct tty_struct *tty); 130 130 static int cypress_tiocmset(struct tty_struct *tty, 131 131 unsigned int set, unsigned int clear); 132 - static int cypress_chars_in_buffer(struct tty_struct *tty); 132 + static unsigned int cypress_chars_in_buffer(struct tty_struct *tty); 133 133 static void cypress_throttle(struct tty_struct *tty); 134 134 static void cypress_unthrottle(struct tty_struct *tty); 135 135 static void cypress_set_dead(struct usb_serial_port *port); ··· 970 970 971 971 972 972 /* returns amount of data still left in soft buffer */ 973 - static int cypress_chars_in_buffer(struct tty_struct *tty) 973 + static unsigned int cypress_chars_in_buffer(struct tty_struct *tty) 974 974 { 975 975 struct usb_serial_port *port = tty->driver_data; 976 976 struct cypress_private *priv = usb_get_serial_port_data(port); 977 - int chars = 0; 977 + unsigned int chars; 978 978 unsigned long flags; 979 979 980 980 spin_lock_irqsave(&priv->lock, flags); 981 981 chars = kfifo_len(&priv->write_fifo); 982 982 spin_unlock_irqrestore(&priv->lock, flags); 983 983 984 - dev_dbg(&port->dev, "%s - returns %d\n", __func__, chars); 984 + dev_dbg(&port->dev, "%s - returns %u\n", __func__, chars); 985 985 return chars; 986 986 } 987 987
+2 -2
drivers/usb/serial/digi_acceleport.c
··· 224 224 const unsigned char *buf, int count); 225 225 static void digi_write_bulk_callback(struct urb *urb); 226 226 static unsigned int digi_write_room(struct tty_struct *tty); 227 - static int digi_chars_in_buffer(struct tty_struct *tty); 227 + static unsigned int digi_chars_in_buffer(struct tty_struct *tty); 228 228 static int digi_open(struct tty_struct *tty, struct usb_serial_port *port); 229 229 static void digi_close(struct usb_serial_port *port); 230 230 static void digi_dtr_rts(struct usb_serial_port *port, int on); ··· 1040 1040 1041 1041 } 1042 1042 1043 - static int digi_chars_in_buffer(struct tty_struct *tty) 1043 + static unsigned int digi_chars_in_buffer(struct tty_struct *tty) 1044 1044 { 1045 1045 struct usb_serial_port *port = tty->driver_data; 1046 1046 struct digi_port *priv = usb_get_serial_port_data(port);
+3 -3
drivers/usb/serial/generic.c
··· 247 247 return room; 248 248 } 249 249 250 - int usb_serial_generic_chars_in_buffer(struct tty_struct *tty) 250 + unsigned int usb_serial_generic_chars_in_buffer(struct tty_struct *tty) 251 251 { 252 252 struct usb_serial_port *port = tty->driver_data; 253 253 unsigned long flags; 254 - int chars; 254 + unsigned int chars; 255 255 256 256 if (!port->bulk_out_size) 257 257 return 0; ··· 260 260 chars = kfifo_len(&port->write_fifo) + port->tx_bytes; 261 261 spin_unlock_irqrestore(&port->lock, flags); 262 262 263 - dev_dbg(&port->dev, "%s - returns %d\n", __func__, chars); 263 + dev_dbg(&port->dev, "%s - returns %u\n", __func__, chars); 264 264 return chars; 265 265 } 266 266 EXPORT_SYMBOL_GPL(usb_serial_generic_chars_in_buffer);
+3 -3
drivers/usb/serial/io_edgeport.c
··· 1391 1391 * system, 1392 1392 * Otherwise we return a negative error number. 1393 1393 *****************************************************************************/ 1394 - static int edge_chars_in_buffer(struct tty_struct *tty) 1394 + static unsigned int edge_chars_in_buffer(struct tty_struct *tty) 1395 1395 { 1396 1396 struct usb_serial_port *port = tty->driver_data; 1397 1397 struct edgeport_port *edge_port = usb_get_serial_port_data(port); 1398 - int num_chars; 1398 + unsigned int num_chars; 1399 1399 unsigned long flags; 1400 1400 1401 1401 if (edge_port == NULL) ··· 1413 1413 edge_port->txfifo.count; 1414 1414 spin_unlock_irqrestore(&edge_port->ep_lock, flags); 1415 1415 if (num_chars) { 1416 - dev_dbg(&port->dev, "%s - returns %d\n", __func__, num_chars); 1416 + dev_dbg(&port->dev, "%s - returns %u\n", __func__, num_chars); 1417 1417 } 1418 1418 1419 1419 return num_chars;
+3 -3
drivers/usb/serial/io_ti.c
··· 2087 2087 return room; 2088 2088 } 2089 2089 2090 - static int edge_chars_in_buffer(struct tty_struct *tty) 2090 + static unsigned int edge_chars_in_buffer(struct tty_struct *tty) 2091 2091 { 2092 2092 struct usb_serial_port *port = tty->driver_data; 2093 2093 struct edgeport_port *edge_port = usb_get_serial_port_data(port); 2094 - int chars = 0; 2094 + unsigned int chars; 2095 2095 unsigned long flags; 2096 2096 if (edge_port == NULL) 2097 2097 return 0; ··· 2100 2100 chars = kfifo_len(&port->write_fifo); 2101 2101 spin_unlock_irqrestore(&edge_port->ep_lock, flags); 2102 2102 2103 - dev_dbg(&port->dev, "%s - returns %d\n", __func__, chars); 2103 + dev_dbg(&port->dev, "%s - returns %u\n", __func__, chars); 2104 2104 return chars; 2105 2105 } 2106 2106
+3 -3
drivers/usb/serial/mos7720.c
··· 949 949 * system, 950 950 * Otherwise we return a negative error number. 951 951 */ 952 - static int mos7720_chars_in_buffer(struct tty_struct *tty) 952 + static unsigned int mos7720_chars_in_buffer(struct tty_struct *tty) 953 953 { 954 954 struct usb_serial_port *port = tty->driver_data; 955 955 int i; 956 - int chars = 0; 956 + unsigned int chars = 0; 957 957 struct moschip_port *mos7720_port; 958 958 959 959 mos7720_port = usb_get_serial_port_data(port); ··· 965 965 mos7720_port->write_urb_pool[i]->status == -EINPROGRESS) 966 966 chars += URB_TRANSFER_BUFFER_SIZE; 967 967 } 968 - dev_dbg(&port->dev, "%s - returns %d\n", __func__, chars); 968 + dev_dbg(&port->dev, "%s - returns %u\n", __func__, chars); 969 969 return chars; 970 970 } 971 971
+3 -3
drivers/usb/serial/mos7840.c
··· 735 735 * Otherwise we return zero. 736 736 *****************************************************************************/ 737 737 738 - static int mos7840_chars_in_buffer(struct tty_struct *tty) 738 + static unsigned int mos7840_chars_in_buffer(struct tty_struct *tty) 739 739 { 740 740 struct usb_serial_port *port = tty->driver_data; 741 741 struct moschip_port *mos7840_port = usb_get_serial_port_data(port); 742 742 int i; 743 - int chars = 0; 743 + unsigned int chars = 0; 744 744 unsigned long flags; 745 745 746 746 spin_lock_irqsave(&mos7840_port->pool_lock, flags); ··· 751 751 } 752 752 } 753 753 spin_unlock_irqrestore(&mos7840_port->pool_lock, flags); 754 - dev_dbg(&port->dev, "%s - returns %d\n", __func__, chars); 754 + dev_dbg(&port->dev, "%s - returns %u\n", __func__, chars); 755 755 return chars; 756 756 757 757 }
+2 -2
drivers/usb/serial/opticon.c
··· 289 289 return 2048; 290 290 } 291 291 292 - static int opticon_chars_in_buffer(struct tty_struct *tty) 292 + static unsigned int opticon_chars_in_buffer(struct tty_struct *tty) 293 293 { 294 294 struct usb_serial_port *port = tty->driver_data; 295 295 struct opticon_private *priv = usb_get_serial_port_data(port); 296 296 unsigned long flags; 297 - int count; 297 + unsigned int count; 298 298 299 299 spin_lock_irqsave(&priv->lock, flags); 300 300 count = priv->outstanding_bytes;
+3 -3
drivers/usb/serial/oti6858.c
··· 127 127 static int oti6858_write(struct tty_struct *tty, struct usb_serial_port *port, 128 128 const unsigned char *buf, int count); 129 129 static unsigned int oti6858_write_room(struct tty_struct *tty); 130 - static int oti6858_chars_in_buffer(struct tty_struct *tty); 130 + static unsigned int oti6858_chars_in_buffer(struct tty_struct *tty); 131 131 static int oti6858_tiocmget(struct tty_struct *tty); 132 132 static int oti6858_tiocmset(struct tty_struct *tty, 133 133 unsigned int set, unsigned int clear); ··· 376 376 return room; 377 377 } 378 378 379 - static int oti6858_chars_in_buffer(struct tty_struct *tty) 379 + static unsigned int oti6858_chars_in_buffer(struct tty_struct *tty) 380 380 { 381 381 struct usb_serial_port *port = tty->driver_data; 382 - int chars = 0; 382 + unsigned int chars; 383 383 unsigned long flags; 384 384 385 385 spin_lock_irqsave(&port->lock, flags);
+3 -3
drivers/usb/serial/sierra.c
··· 632 632 return 2048; 633 633 } 634 634 635 - static int sierra_chars_in_buffer(struct tty_struct *tty) 635 + static unsigned int sierra_chars_in_buffer(struct tty_struct *tty) 636 636 { 637 637 struct usb_serial_port *port = tty->driver_data; 638 638 struct sierra_port_private *portdata = usb_get_serial_port_data(port); 639 639 unsigned long flags; 640 - int chars; 640 + unsigned int chars; 641 641 642 642 /* NOTE: This overcounts somewhat. */ 643 643 spin_lock_irqsave(&portdata->lock, flags); 644 644 chars = portdata->outstanding_urbs * MAX_TRANSFER; 645 645 spin_unlock_irqrestore(&portdata->lock, flags); 646 646 647 - dev_dbg(&port->dev, "%s - %d\n", __func__, chars); 647 + dev_dbg(&port->dev, "%s - %u\n", __func__, chars); 648 648 649 649 return chars; 650 650 }
+4 -4
drivers/usb/serial/ti_usb_3410_5052.c
··· 308 308 static int ti_write(struct tty_struct *tty, struct usb_serial_port *port, 309 309 const unsigned char *data, int count); 310 310 static unsigned int ti_write_room(struct tty_struct *tty); 311 - static int ti_chars_in_buffer(struct tty_struct *tty); 311 + static unsigned int ti_chars_in_buffer(struct tty_struct *tty); 312 312 static bool ti_tx_empty(struct usb_serial_port *port); 313 313 static void ti_throttle(struct tty_struct *tty); 314 314 static void ti_unthrottle(struct tty_struct *tty); ··· 826 826 } 827 827 828 828 829 - static int ti_chars_in_buffer(struct tty_struct *tty) 829 + static unsigned int ti_chars_in_buffer(struct tty_struct *tty) 830 830 { 831 831 struct usb_serial_port *port = tty->driver_data; 832 832 struct ti_port *tport = usb_get_serial_port_data(port); 833 - int chars = 0; 833 + unsigned int chars; 834 834 unsigned long flags; 835 835 836 836 spin_lock_irqsave(&tport->tp_lock, flags); 837 837 chars = kfifo_len(&port->write_fifo); 838 838 spin_unlock_irqrestore(&tport->tp_lock, flags); 839 839 840 - dev_dbg(&port->dev, "%s - returns %d\n", __func__, chars); 840 + dev_dbg(&port->dev, "%s - returns %u\n", __func__, chars); 841 841 return chars; 842 842 } 843 843
+1 -1
drivers/usb/serial/usb-wwan.h
··· 17 17 unsigned int set, unsigned int clear); 18 18 extern int usb_wwan_write(struct tty_struct *tty, struct usb_serial_port *port, 19 19 const unsigned char *buf, int count); 20 - extern int usb_wwan_chars_in_buffer(struct tty_struct *tty); 20 + extern unsigned int usb_wwan_chars_in_buffer(struct tty_struct *tty); 21 21 #ifdef CONFIG_PM 22 22 extern int usb_wwan_suspend(struct usb_serial *serial, pm_message_t message); 23 23 extern int usb_wwan_resume(struct usb_serial *serial);
+3 -3
drivers/usb/serial/usb_wwan.c
··· 299 299 } 300 300 EXPORT_SYMBOL(usb_wwan_write_room); 301 301 302 - int usb_wwan_chars_in_buffer(struct tty_struct *tty) 302 + unsigned int usb_wwan_chars_in_buffer(struct tty_struct *tty) 303 303 { 304 304 struct usb_serial_port *port = tty->driver_data; 305 305 struct usb_wwan_port_private *portdata; 306 306 int i; 307 - int data_len = 0; 307 + unsigned int data_len = 0; 308 308 struct urb *this_urb; 309 309 310 310 portdata = usb_get_serial_port_data(port); ··· 316 316 if (this_urb && test_bit(i, &portdata->out_busy)) 317 317 data_len += this_urb->transfer_buffer_length; 318 318 } 319 - dev_dbg(&port->dev, "%s: %d\n", __func__, data_len); 319 + dev_dbg(&port->dev, "%s: %u\n", __func__, data_len); 320 320 return data_len; 321 321 } 322 322 EXPORT_SYMBOL(usb_wwan_chars_in_buffer);
+2 -2
include/linux/usb/serial.h
··· 284 284 void (*set_termios)(struct tty_struct *tty, 285 285 struct usb_serial_port *port, struct ktermios *old); 286 286 void (*break_ctl)(struct tty_struct *tty, int break_state); 287 - int (*chars_in_buffer)(struct tty_struct *tty); 287 + unsigned int (*chars_in_buffer)(struct tty_struct *tty); 288 288 void (*wait_until_sent)(struct tty_struct *tty, long timeout); 289 289 bool (*tx_empty)(struct usb_serial_port *port); 290 290 void (*throttle)(struct tty_struct *tty); ··· 348 348 void usb_serial_generic_close(struct usb_serial_port *port); 349 349 int usb_serial_generic_resume(struct usb_serial *serial); 350 350 unsigned int usb_serial_generic_write_room(struct tty_struct *tty); 351 - int usb_serial_generic_chars_in_buffer(struct tty_struct *tty); 351 + unsigned int usb_serial_generic_chars_in_buffer(struct tty_struct *tty); 352 352 void usb_serial_generic_wait_until_sent(struct tty_struct *tty, long timeout); 353 353 void usb_serial_generic_read_bulk_callback(struct urb *urb); 354 354 void usb_serial_generic_write_bulk_callback(struct urb *urb);