[SERIAL] Convert fifosize to an unsigned int

Some UARTs have more than 255 bytes of FIFO, which can't be
represented by an unsigned char. Change the kernel's internal
structure to be an unsigned int, but still export an unsigned char
via the TIOCGSERIAL ioctl. If the TIOCSSERIAL ioctl provides a
fifo size of 0, assume this means "don't change" otherwise we'll
corrupt the larger fifo sizes.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>

authored by Russell King and committed by Russell King 947deee8 4faf4e0e

+7 -5
+1 -2
drivers/serial/mpc52xx_uart.c
··· 728 728 729 729 spin_lock_init(&port->lock); 730 730 port->uartclk = __res.bi_ipbfreq / 2; /* Look at CTLR doc */ 731 - port->fifosize = 255; /* Should be 512 ! But it can't be */ 732 - /* stored in a unsigned char */ 731 + port->fifosize = 512; 733 732 port->iotype = UPIO_MEM; 734 733 port->flags = UPF_BOOT_AUTOCONF | 735 734 ( uart_console(port) ? 0 : UPF_IOREMAP );
+4 -2
drivers/serial/serial_core.c
··· 691 691 (new_serial.baud_base != port->uartclk / 16) || 692 692 (close_delay != state->close_delay) || 693 693 (closing_wait != state->closing_wait) || 694 - (new_serial.xmit_fifo_size != port->fifosize) || 694 + (new_serial.xmit_fifo_size && 695 + new_serial.xmit_fifo_size != port->fifosize) || 695 696 (((new_flags ^ old_flags) & ~UPF_USR_MASK) != 0)) 696 697 goto exit; 697 698 port->flags = ((port->flags & ~UPF_USR_MASK) | ··· 797 796 port->custom_divisor = new_serial.custom_divisor; 798 797 state->close_delay = close_delay; 799 798 state->closing_wait = closing_wait; 800 - port->fifosize = new_serial.xmit_fifo_size; 799 + if (new_serial.xmit_fifo_size) 800 + port->fifosize = new_serial.xmit_fifo_size; 801 801 if (state->info->tty) 802 802 state->info->tty->low_latency = 803 803 (port->flags & UPF_LOW_LATENCY) ? 1 : 0;
+2 -1
include/linux/serial_core.h
··· 214 214 unsigned char __iomem *membase; /* read/write[bwl] */ 215 215 unsigned int irq; /* irq number */ 216 216 unsigned int uartclk; /* base uart clock */ 217 - unsigned char fifosize; /* tx fifo size */ 217 + unsigned int fifosize; /* tx fifo size */ 218 218 unsigned char x_char; /* xon/xoff char */ 219 219 unsigned char regshift; /* reg offset shift */ 220 220 unsigned char iotype; /* io access style */ 221 + unsigned char unused1; 221 222 222 223 #define UPIO_PORT (0) 223 224 #define UPIO_HUB6 (1)