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