serial: make uart_console_write->putchar()'s character an unsigned char
authorJiri Slaby <jslaby@suse.cz>
Thu, 3 Mar 2022 08:08:31 +0000 (09:08 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 3 Mar 2022 14:06:31 +0000 (15:06 +0100)
Currently, uart_console_write->putchar's second parameter (the
character) is of type int. It makes little sense, provided uart_console_write()
accepts the input string as "const char *s" and passes its content -- the
characters -- to putchar(). So switch the character's type to unsigned
char.

We don't use char as that is signed on some platforms. That would cause
troubles for drivers which (implicitly) cast the char to u16 when
writing to the device. Sign extension would happen in that case and the
value written would be completely different to the provided char. DZ is
an example of such a driver -- on MIPS, it uses u16 for dz_out in
dz_console_putchar().

Note we do the char -> uchar conversion implicitly in
uart_console_write(). Provided we do not change size of the data type,
sign extension does not happen there, so the problem is void.

This makes the types consistent and unified with the rest of the uart
layer, which uses unsigned char in most places already. One exception is
xmit_buf, but that is going to be converted later.

Cc: Paul Cercueil <paul@crapouillou.net>
Cc: Tobias Klauser <tklauser@distanz.ch>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Vineet Gupta <vgupta@kernel.org>
Cc: Nicolas Ferre <nicolas.ferre@microchip.com>
Cc: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: Ludovic Desroches <ludovic.desroches@microchip.com>
Cc: Florian Fainelli <f.fainelli@gmail.com>
Cc: bcm-kernel-feedback-list@broadcom.com
Cc: Alexander Shiyan <shc_work@mail.ru>
Cc: Baruch Siach <baruch@tkos.co.il>
Cc: "Maciej W. Rozycki" <macro@orcam.me.uk>
Cc: Paul Walmsley <paul.walmsley@sifive.com>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: NXP Linux Team <linux-imx@nxp.com>
Cc: Karol Gugala <kgugala@antmicro.com>
Cc: Mateusz Holenko <mholenko@antmicro.com>
Cc: Vladimir Zapolskiy <vz@mleia.com>
Cc: Neil Armstrong <narmstrong@baylibre.com>
Cc: Kevin Hilman <khilman@baylibre.com>
Cc: Jerome Brunet <jbrunet@baylibre.com>
Cc: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Cc: Taichi Sugaya <sugaya.taichi@socionext.com>
Cc: Takao Orito <orito.takao@socionext.com>
Cc: Liviu Dudau <liviu.dudau@arm.com>
Cc: Sudeep Holla <sudeep.holla@arm.com>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: "Andreas Färber" <afaerber@suse.de>
Cc: Manivannan Sadhasivam <mani@kernel.org>
Cc: Michael Ellerman <mpe@ellerman.id.au>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Andy Gross <agross@kernel.org>
Cc: Bjorn Andersson <bjorn.andersson@linaro.org>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
Cc: Orson Zhai <orsonzhai@gmail.com>
Cc: Baolin Wang <baolin.wang7@gmail.com>
Cc: Chunyan Zhang <zhang.lyra@gmail.com>
Cc: Patrice Chotard <patrice.chotard@foss.st.com>
Cc: Maxime Coquelin <mcoquelin.stm32@gmail.com>
Cc: Alexandre Torgue <alexandre.torgue@foss.st.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Peter Korsgaard <peter@korsgaard.com>
Cc: Michal Simek <michal.simek@xilinx.com>
Acked-by: Richard Genoud <richard.genoud@gmail.com> [atmel_serial]
Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Acked-by: Paul Cercueil <paul@crapouillou.net>
Acked-by: Neil Armstrong <narmstrong@baylibre.com> # meson_serial
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Link: https://lore.kernel.org/r/20220303080831.21783-1-jslaby@suse.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
62 files changed:
drivers/tty/goldfish.c
drivers/tty/hvc/hvc_dcc.c
drivers/tty/serial/21285.c
drivers/tty/serial/8250/8250_early.c
drivers/tty/serial/8250/8250_ingenic.c
drivers/tty/serial/8250/8250_port.c
drivers/tty/serial/altera_jtaguart.c
drivers/tty/serial/altera_uart.c
drivers/tty/serial/amba-pl010.c
drivers/tty/serial/amba-pl011.c
drivers/tty/serial/apbuart.c
drivers/tty/serial/ar933x_uart.c
drivers/tty/serial/arc_uart.c
drivers/tty/serial/atmel_serial.c
drivers/tty/serial/bcm63xx_uart.c
drivers/tty/serial/clps711x.c
drivers/tty/serial/digicolor-usart.c
drivers/tty/serial/dz.c
drivers/tty/serial/earlycon-arm-semihost.c
drivers/tty/serial/earlycon-riscv-sbi.c
drivers/tty/serial/fsl_linflexuart.c
drivers/tty/serial/fsl_lpuart.c
drivers/tty/serial/imx.c
drivers/tty/serial/imx_earlycon.c
drivers/tty/serial/ip22zilog.c
drivers/tty/serial/lantiq.c
drivers/tty/serial/liteuart.c
drivers/tty/serial/lpc32xx_hs.c
drivers/tty/serial/meson_uart.c
drivers/tty/serial/milbeaut_usio.c
drivers/tty/serial/mps2-uart.c
drivers/tty/serial/mvebu-uart.c
drivers/tty/serial/mxs-auart.c
drivers/tty/serial/omap-serial.c
drivers/tty/serial/owl-uart.c
drivers/tty/serial/pch_uart.c
drivers/tty/serial/pic32_uart.c
drivers/tty/serial/pmac_zilog.c
drivers/tty/serial/pxa.c
drivers/tty/serial/qcom_geni_serial.c
drivers/tty/serial/rda-uart.c
drivers/tty/serial/sa1100.c
drivers/tty/serial/samsung_tty.c
drivers/tty/serial/sb1250-duart.c
drivers/tty/serial/sccnxp.c
drivers/tty/serial/serial_core.c
drivers/tty/serial/serial_txx9.c
drivers/tty/serial/sh-sci.c
drivers/tty/serial/sifive.c
drivers/tty/serial/sprd_serial.c
drivers/tty/serial/st-asc.c
drivers/tty/serial/stm32-usart.c
drivers/tty/serial/sunplus-uart.c
drivers/tty/serial/sunsab.c
drivers/tty/serial/sunsu.c
drivers/tty/serial/sunzilog.c
drivers/tty/serial/uartlite.c
drivers/tty/serial/vr41xx_siu.c
drivers/tty/serial/vt8500_serial.c
drivers/tty/serial/xilinx_uartps.c
drivers/tty/serial/zs.c
include/linux/serial_core.h

index 5ed19a9857adf72f55e7cf72171a053fe5a52201..ad13532e92fe25bc11124ee6171df9633263341f 100644 (file)
@@ -434,7 +434,7 @@ static int goldfish_tty_remove(struct platform_device *pdev)
 }
 
 #ifdef CONFIG_GOLDFISH_TTY_EARLY_CONSOLE
-static void gf_early_console_putchar(struct uart_port *port, int ch)
+static void gf_early_console_putchar(struct uart_port *port, unsigned char ch)
 {
        __raw_writel(ch, port->membase);
 }
index 8e0edb7d93fdaff3243868a5a1da0f85c3ca5d94..bd61f9372d83f168cc97af9fd871489ef0547e08 100644 (file)
@@ -15,7 +15,7 @@
 #define DCC_STATUS_RX          (1 << 30)
 #define DCC_STATUS_TX          (1 << 29)
 
-static void dcc_uart_console_putchar(struct uart_port *port, int ch)
+static void dcc_uart_console_putchar(struct uart_port *port, unsigned char ch)
 {
        while (__dcc_getstatus() & DCC_STATUS_TX)
                cpu_relax();
index 09baef4ccc39ae7fb4fcfd894b5b3dc838e05b2a..7520cc02fd4dc05a214cfc210e4a47f7ce5acb86 100644 (file)
@@ -403,7 +403,7 @@ static void serial21285_setup_ports(void)
 }
 
 #ifdef CONFIG_SERIAL_21285_CONSOLE
-static void serial21285_console_putchar(struct uart_port *port, int ch)
+static void serial21285_console_putchar(struct uart_port *port, unsigned char ch)
 {
        while (*CSR_UARTFLG & 0x20)
                barrier();
index c171ce6db69102ed4911353226f7810cfddcf123..e52585064565fa5f25367dbd451702214514f498 100644 (file)
@@ -86,7 +86,7 @@ static void serial8250_early_out(struct uart_port *port, int offset, int value)
 
 #define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE)
 
-static void serial_putc(struct uart_port *port, int c)
+static void serial_putc(struct uart_port *port, unsigned char c)
 {
        unsigned int status;
 
index 65402d05eff9301e77c91288e6219101e21973b7..cff91aa03f2906d85056813abe657e4962d125df 100644 (file)
@@ -52,7 +52,7 @@ static void early_out(struct uart_port *port, int offset, uint8_t value)
        writel(value, port->membase + (offset << 2));
 }
 
-static void ingenic_early_console_putc(struct uart_port *port, int c)
+static void ingenic_early_console_putc(struct uart_port *port, unsigned char c)
 {
        uint8_t lsr;
 
index 25b84d30e771f0b2f24f1814c8e117deaf37d720..267026892264a355259ff195e898e73551f2ad2e 100644 (file)
@@ -3305,7 +3305,7 @@ EXPORT_SYMBOL_GPL(serial8250_set_defaults);
 
 #ifdef CONFIG_SERIAL_8250_CONSOLE
 
-static void serial8250_console_putchar(struct uart_port *port, int ch)
+static void serial8250_console_putchar(struct uart_port *port, unsigned char ch)
 {
        struct uart_8250_port *up = up_to_u8250p(port);
 
index 37bffe406b18ea9ece7f10d0e1f609a7d8e85c16..1c16345d0a1f2ed811a6d7e754093e0a1c6033ce 100644 (file)
@@ -298,7 +298,7 @@ static struct altera_jtaguart altera_jtaguart_ports[ALTERA_JTAGUART_MAXPORTS];
 #if defined(CONFIG_SERIAL_ALTERA_JTAGUART_CONSOLE)
 
 #if defined(CONFIG_SERIAL_ALTERA_JTAGUART_CONSOLE_BYPASS)
-static void altera_jtaguart_console_putc(struct uart_port *port, int c)
+static void altera_jtaguart_console_putc(struct uart_port *port, unsigned char c)
 {
        unsigned long status;
        unsigned long flags;
@@ -318,7 +318,7 @@ static void altera_jtaguart_console_putc(struct uart_port *port, int c)
        spin_unlock_irqrestore(&port->lock, flags);
 }
 #else
-static void altera_jtaguart_console_putc(struct uart_port *port, int c)
+static void altera_jtaguart_console_putc(struct uart_port *port, unsigned char c)
 {
        unsigned long flags;
 
index 64a352b40197101577089053feeadf3d24e2a767..8b749ed557c67e15741eff8b196a23a1f9617aca 100644 (file)
@@ -438,7 +438,7 @@ static struct altera_uart altera_uart_ports[CONFIG_SERIAL_ALTERA_UART_MAXPORTS];
 
 #if defined(CONFIG_SERIAL_ALTERA_UART_CONSOLE)
 
-static void altera_uart_console_putc(struct uart_port *port, int c)
+static void altera_uart_console_putc(struct uart_port *port, unsigned char c)
 {
        while (!(altera_uart_readl(port, ALTERA_UART_STATUS_REG) &
                 ALTERA_UART_STATUS_TRDY_MSK))
index b73375214ac323b3e9ae217ab7946d6389a1003b..fae0b581ff422523f27afc9f6e8b4b92f895231f 100644 (file)
@@ -551,7 +551,7 @@ static struct uart_amba_port *amba_ports[UART_NR];
 
 #ifdef CONFIG_SERIAL_AMBA_PL010_CONSOLE
 
-static void pl010_console_putchar(struct uart_port *port, int ch)
+static void pl010_console_putchar(struct uart_port *port, unsigned char ch)
 {
        unsigned int status;
 
index ba053a68529f771d81cd3c7cf73ce938859da50b..51ecb050ae40fd97325c109dcbdea421889ad671 100644 (file)
@@ -2255,7 +2255,7 @@ static struct uart_amba_port *amba_ports[UART_NR];
 
 #ifdef CONFIG_SERIAL_AMBA_PL011_CONSOLE
 
-static void pl011_console_putchar(struct uart_port *port, int ch)
+static void pl011_console_putchar(struct uart_port *port, unsigned char ch)
 {
        struct uart_amba_port *uap =
            container_of(port, struct uart_amba_port, port);
@@ -2471,7 +2471,7 @@ static struct console amba_console = {
 
 #define AMBA_CONSOLE   (&amba_console)
 
-static void qdf2400_e44_putc(struct uart_port *port, int c)
+static void qdf2400_e44_putc(struct uart_port *port, unsigned char c)
 {
        while (readl(port->membase + UART01x_FR) & UART01x_FR_TXFF)
                cpu_relax();
@@ -2487,7 +2487,7 @@ static void qdf2400_e44_early_write(struct console *con, const char *s, unsigned
        uart_console_write(&dev->port, s, n, qdf2400_e44_putc);
 }
 
-static void pl011_putc(struct uart_port *port, int c)
+static void pl011_putc(struct uart_port *port, unsigned char c)
 {
        while (readl(port->membase + UART01x_FR) & UART01x_FR_TXFF)
                cpu_relax();
index d8c937bdf3f9e9c49a69a97e7136bcef465b714b..9ef82d870ff25a1b0464fcc3e9e5a796731ebe64 100644 (file)
@@ -413,7 +413,7 @@ static void apbuart_flush_fifo(struct uart_port *port)
 
 #ifdef CONFIG_SERIAL_GRLIB_GAISLER_APBUART_CONSOLE
 
-static void apbuart_console_putchar(struct uart_port *port, int ch)
+static void apbuart_console_putchar(struct uart_port *port, unsigned char ch)
 {
        unsigned int status;
        do {
index 8cabe50c4a331fe555bfea7dea8a1c07b9df0e61..6269dbf935460771fa80e61ab180179d3b3f4e7f 100644 (file)
@@ -613,7 +613,7 @@ static void ar933x_uart_wait_xmitr(struct ar933x_uart_port *up)
        } while ((status & AR933X_UART_DATA_TX_CSR) == 0);
 }
 
-static void ar933x_uart_console_putchar(struct uart_port *port, int ch)
+static void ar933x_uart_console_putchar(struct uart_port *port, unsigned char ch)
 {
        struct ar933x_uart_port *up =
                container_of(port, struct ar933x_uart_port, port);
index 596217d10d5c7a00d5dac6d0258a00d011dd3c9c..2a09e92ef9ede92fc01cbeb9495607f281642719 100644 (file)
@@ -508,7 +508,7 @@ static int arc_serial_console_setup(struct console *co, char *options)
        return uart_set_options(port, co, baud, parity, bits, flow);
 }
 
-static void arc_serial_console_putchar(struct uart_port *port, int ch)
+static void arc_serial_console_putchar(struct uart_port *port, unsigned char ch)
 {
        while (!(UART_GET_STATUS(port) & TXEMPTY))
                cpu_relax();
index 73d43919898d4a0c663ba3b87e9d01cf712f5d8d..3a45e4fc7993ad0f95001ba587bea92c91ee1557 100644 (file)
@@ -2541,7 +2541,7 @@ static int atmel_init_port(struct atmel_uart_port *atmel_port,
 }
 
 #ifdef CONFIG_SERIAL_ATMEL_CONSOLE
-static void atmel_console_putchar(struct uart_port *port, int ch)
+static void atmel_console_putchar(struct uart_port *port, unsigned char ch)
 {
        while (!(atmel_uart_readl(port, ATMEL_US_CSR) & ATMEL_US_TXRDY))
                cpu_relax();
index 6471a54b616b161ac975db8e69185e363e9bc517..53b43174aa40955c4d271690efec3e912d7fa790 100644 (file)
@@ -681,7 +681,7 @@ static void wait_for_xmitr(struct uart_port *port)
 /*
  * output given char
  */
-static void bcm_console_putchar(struct uart_port *port, int ch)
+static void bcm_console_putchar(struct uart_port *port, unsigned char ch)
 {
        wait_for_xmitr(port);
        bcm_uart_writel(port, ch, UART_FIFO_REG);
index 95abc6faa3d5cf816ab0fe2b92574436a674c4a2..b9b66ad31a082b125cc5249637d56e85ac3ef422 100644 (file)
@@ -348,7 +348,7 @@ static const struct uart_ops uart_clps711x_ops = {
 };
 
 #ifdef CONFIG_SERIAL_CLPS711X_CONSOLE
-static void uart_clps711x_console_putchar(struct uart_port *port, int ch)
+static void uart_clps711x_console_putchar(struct uart_port *port, unsigned char ch)
 {
        struct clps711x_port *s = dev_get_drvdata(port->dev);
        u32 sysflg = 0;
index 13ac36e2da4f0f2ea36e48c7619f369dde3239bd..6d70fea76bb3e55a39a7838d10d63a29645beb05 100644 (file)
@@ -381,7 +381,7 @@ static const struct uart_ops digicolor_uart_ops = {
        .request_port   = digicolor_uart_request_port,
 };
 
-static void digicolor_uart_console_putchar(struct uart_port *port, int ch)
+static void digicolor_uart_console_putchar(struct uart_port *port, unsigned char ch)
 {
        while (digicolor_uart_tx_full(port))
                cpu_relax();
index e9edabc5a2114a1ce6b3bc1e5008bcafd56b0c1c..2e21acf397202494e2b8c241374810ba6509c544 100644 (file)
@@ -802,7 +802,7 @@ static void __init dz_init_ports(void)
  * restored.  Welcome to the world of PDP-11!
  * -------------------------------------------------------------------
  */
-static void dz_console_putchar(struct uart_port *uport, int ch)
+static void dz_console_putchar(struct uart_port *uport, unsigned char ch)
 {
        struct dz_port *dport = to_dport(uport);
        unsigned long flags;
index fa096c10b59195523a2028dc1bab69a25aa778c9..fcdec5f42376f8923b14ce7d93e42dbd04e02851 100644 (file)
@@ -21,7 +21,7 @@
 /*
  * Semihosting-based debug console
  */
-static void smh_putc(struct uart_port *port, int c)
+static void smh_putc(struct uart_port *port, unsigned char c)
 {
 #ifdef CONFIG_ARM64
        asm volatile("mov  x1, %0\n"
index ce81523c311314e9b5f0675e5d5c53231e965a4b..27afb0b74ea705bebbc3895b577ddc39b4eda6b6 100644 (file)
@@ -10,7 +10,7 @@
 #include <linux/serial_core.h>
 #include <asm/sbi.h>
 
-static void sbi_putc(struct uart_port *port, int c)
+static void sbi_putc(struct uart_port *port, unsigned char c)
 {
        sbi_console_putchar(c);
 }
index e72cba08574339f28efb9ef549683e4da641b25d..98bb0c315e133612c0dcc63564c12581576286f2 100644 (file)
@@ -553,7 +553,7 @@ static const struct uart_ops linflex_pops = {
 static struct uart_port *linflex_ports[UART_NR];
 
 #ifdef CONFIG_SERIAL_FSL_LINFLEXUART_CONSOLE
-static void linflex_console_putchar(struct uart_port *port, int ch)
+static void linflex_console_putchar(struct uart_port *port, unsigned char ch)
 {
        unsigned long cr;
 
@@ -578,7 +578,7 @@ static void linflex_console_putchar(struct uart_port *port, int ch)
        }
 }
 
-static void linflex_earlycon_putchar(struct uart_port *port, int ch)
+static void linflex_earlycon_putchar(struct uart_port *port, unsigned char ch)
 {
        unsigned long flags;
        char *ret;
index 7d90c5a530ee1a4c68c34b41b16e9b38f00fd897..87789872f400660cc917331703d787662e35a490 100644 (file)
@@ -2333,13 +2333,13 @@ static const struct uart_ops lpuart32_pops = {
 static struct lpuart_port *lpuart_ports[UART_NR];
 
 #ifdef CONFIG_SERIAL_FSL_LPUART_CONSOLE
-static void lpuart_console_putchar(struct uart_port *port, int ch)
+static void lpuart_console_putchar(struct uart_port *port, unsigned char ch)
 {
        lpuart_wait_bit_set(port, UARTSR1, UARTSR1_TDRE);
        writeb(ch, port->membase + UARTDR);
 }
 
-static void lpuart32_console_putchar(struct uart_port *port, int ch)
+static void lpuart32_console_putchar(struct uart_port *port, unsigned char ch)
 {
        lpuart32_wait_bit_set(port, UARTSTAT, UARTSTAT_TDRE);
        lpuart32_write(port, ch, UARTDATA);
index 0b467ce8d737afa52706005ca77ea46fe077bbf0..fd38e6ed4fdab7d99343c79e29d4d9b4d7e23a64 100644 (file)
@@ -1968,7 +1968,7 @@ static const struct uart_ops imx_uart_pops = {
 static struct imx_port *imx_uart_ports[UART_NR];
 
 #if IS_ENABLED(CONFIG_SERIAL_IMX_CONSOLE)
-static void imx_uart_console_putchar(struct uart_port *port, int ch)
+static void imx_uart_console_putchar(struct uart_port *port, unsigned char ch)
 {
        struct imx_port *sport = (struct imx_port *)port;
 
index 795606e1a22f963b954bf300147fbe04ea2af9b3..7aab38b2bd8cbd0793e829159b0625ee27bb3807 100644 (file)
@@ -16,7 +16,7 @@
 #define UTS_TXFULL (1<<4) /* TxFIFO full */
 #define IMX21_UTS 0xb4 /* UART Test Register on all other i.mx*/
 
-static void imx_uart_console_early_putchar(struct uart_port *port, int ch)
+static void imx_uart_console_early_putchar(struct uart_port *port, unsigned char ch)
 {
        while (readl_relaxed(port->membase + IMX21_UTS) & UTS_TXFULL)
                cpu_relax();
index f4dc5fe4ba92a99bb522d0f7ddcda7a18690470e..655e64b26852961eb38ab1e07254172ea9b51f4d 100644 (file)
@@ -990,7 +990,7 @@ static struct zilog_layout * __init get_zs(int chip)
 #define ZS_PUT_CHAR_MAX_DELAY  2000    /* 10 ms */
 
 #ifdef CONFIG_SERIAL_IP22_ZILOG_CONSOLE
-static void ip22zilog_put_char(struct uart_port *port, int ch)
+static void ip22zilog_put_char(struct uart_port *port, unsigned char ch)
 {
        struct zilog_channel *channel = ZILOG_CHANNEL_FROM_PORT(port);
        int loops = ZS_PUT_CHAR_MAX_DELAY;
index 3e324d3f0a6df340f02db7124921b56c7bbaf582..a3120c3347dd632438366772d9abb387215e6eee 100644 (file)
@@ -598,7 +598,7 @@ static const struct uart_ops lqasc_pops = {
 
 #ifdef CONFIG_SERIAL_LANTIQ_CONSOLE
 static void
-lqasc_console_putchar(struct uart_port *port, int ch)
+lqasc_console_putchar(struct uart_port *port, unsigned char ch)
 {
        int fifofree;
 
index 7f74bf7bdcff8475ca7310b42480f17770c2e9e9..328b50521f144c04336de3c43bdd31af828aace4 100644 (file)
@@ -93,7 +93,7 @@ static void liteuart_timer(struct timer_list *t)
        mod_timer(&uart->timer, jiffies + uart_poll_timeout(port));
 }
 
-static void liteuart_putchar(struct uart_port *port, int ch)
+static void liteuart_putchar(struct uart_port *port, unsigned char ch)
 {
        while (litex_read8(port->membase + OFF_TXFULL))
                cpu_relax();
index 54437a087aa02b04c64e048823778cac0a8e905c..93140cac1ca11115153798bc667c2654da740aa8 100644 (file)
@@ -122,7 +122,7 @@ static void wait_for_xmit_ready(struct uart_port *port)
        }
 }
 
-static void lpc32xx_hsuart_console_putchar(struct uart_port *port, int ch)
+static void lpc32xx_hsuart_console_putchar(struct uart_port *port, unsigned char ch)
 {
        wait_for_xmit_ready(port);
        writel((u32)ch, LPC32XX_HSUART_FIFO(port->membase));
index 45e00d928253e4c2cb69e27674e26ce6fc96a539..2bf1c57e0981eac868eb717ed5668817ec375a2f 100644 (file)
@@ -513,7 +513,7 @@ static void meson_uart_enable_tx_engine(struct uart_port *port)
        writel(val, port->membase + AML_UART_CONTROL);
 }
 
-static void meson_console_putchar(struct uart_port *port, int ch)
+static void meson_console_putchar(struct uart_port *port, unsigned char ch)
 {
        if (!port->membase)
                return;
index 8f2cab7f66ad309d37cfa23fa4285ce01fb70879..347088bb380e5d0f99ce364a0c1f06b8dfe6e924 100644 (file)
@@ -400,7 +400,7 @@ static const struct uart_ops mlb_usio_ops = {
 
 #ifdef CONFIG_SERIAL_MILBEAUT_USIO_CONSOLE
 
-static void mlb_usio_console_putchar(struct uart_port *port, int c)
+static void mlb_usio_console_putchar(struct uart_port *port, unsigned char c)
 {
        while (!(readb(port->membase + MLB_USIO_REG_SSR) & MLB_USIO_SSR_TDRE))
                cpu_relax();
index 587b42f754cb8d2ccbb2c38334c7373b23b04aa1..5e9429dcc51f308338772d4c101233c1a0c57a2c 100644 (file)
@@ -432,7 +432,7 @@ static const struct uart_ops mps2_uart_pops = {
 static DEFINE_IDR(ports_idr);
 
 #ifdef CONFIG_SERIAL_MPS2_UART_CONSOLE
-static void mps2_uart_console_putchar(struct uart_port *port, int ch)
+static void mps2_uart_console_putchar(struct uart_port *port, unsigned char ch)
 {
        while (mps2_uart_read8(port, UARTn_STATE) & UARTn_STATE_TX_FULL)
                cpu_relax();
@@ -484,7 +484,7 @@ static struct console mps2_uart_console = {
 
 #define MPS2_SERIAL_CONSOLE (&mps2_uart_console)
 
-static void mps2_early_putchar(struct uart_port *port, int ch)
+static void mps2_early_putchar(struct uart_port *port, unsigned char ch)
 {
        while (readb(port->membase + UARTn_STATE) & UARTn_STATE_TX_FULL)
                cpu_relax();
index 45976e2140d4fbce1c6b90820765fc2b23aecb1b..0429c2a5429024bc964703de1592a557460bd202 100644 (file)
@@ -676,7 +676,7 @@ static const struct uart_ops mvebu_uart_ops = {
 
 #ifdef CONFIG_SERIAL_MVEBU_CONSOLE
 /* Early Console */
-static void mvebu_uart_putc(struct uart_port *port, int c)
+static void mvebu_uart_putc(struct uart_port *port, unsigned char c)
 {
        unsigned int st;
 
@@ -737,7 +737,7 @@ static void wait_for_xmite(struct uart_port *port)
                                  (val & STAT_TX_EMP), 1, 10000);
 }
 
-static void mvebu_uart_console_putchar(struct uart_port *port, int ch)
+static void mvebu_uart_console_putchar(struct uart_port *port, unsigned char ch)
 {
        wait_for_xmitr(port);
        writel(ch, port->membase + UART_TSH(port));
index ac45f3386e97449f7bed08b7c4c770f6f63afafa..1944daf8593acdf34397d48b10dfd54e3f36d72b 100644 (file)
@@ -1305,7 +1305,7 @@ static const struct uart_ops mxs_auart_ops = {
 static struct mxs_auart_port *auart_port[MXS_AUART_PORTS];
 
 #ifdef CONFIG_SERIAL_MXS_AUART_CONSOLE
-static void mxs_auart_console_putchar(struct uart_port *port, int ch)
+static void mxs_auart_console_putchar(struct uart_port *port, unsigned char ch)
 {
        struct mxs_auart_port *s = to_auart_port(port);
        unsigned int to = 1000;
index b4e060205e618e2fe62b7cc3df644650431540e8..8d5ffa196097eb7ed95dc264654ac3d223c1f375 100644 (file)
@@ -1180,7 +1180,7 @@ static void omap_serial_early_out(struct uart_port *port, int offset,
        writew(value, port->membase + offset);
 }
 
-static void omap_serial_early_putc(struct uart_port *port, int c)
+static void omap_serial_early_putc(struct uart_port *port, unsigned char c)
 {
        unsigned int status;
 
@@ -1224,7 +1224,7 @@ static struct uart_omap_port *serial_omap_console_ports[OMAP_MAX_HSUART_PORTS];
 
 static struct uart_driver serial_omap_reg;
 
-static void serial_omap_console_putchar(struct uart_port *port, int ch)
+static void serial_omap_console_putchar(struct uart_port *port, unsigned char ch)
 {
        struct uart_omap_port *up = to_uart_omap_port(port);
 
index 91f1eb0058d7ec025f0f07fd5c50d05e91c915cd..5250bd7d390a4ad7d64f41a59d96201b5443d51a 100644 (file)
@@ -516,7 +516,7 @@ static const struct uart_ops owl_uart_ops = {
 
 #ifdef CONFIG_SERIAL_OWL_CONSOLE
 
-static void owl_console_putchar(struct uart_port *port, int ch)
+static void owl_console_putchar(struct uart_port *port, unsigned char ch)
 {
        if (!port->membase)
                return;
index f0351e6f0ef6d44ba6d6615ad5e99abcf7abd1ef..affe71f8b50c74fcc26266024080fa8419259d77 100644 (file)
@@ -1600,7 +1600,7 @@ static const struct uart_ops pch_uart_ops = {
 
 #ifdef CONFIG_SERIAL_PCH_UART_CONSOLE
 
-static void pch_console_putchar(struct uart_port *port, int ch)
+static void pch_console_putchar(struct uart_port *port, unsigned char ch)
 {
        struct eg20t_port *priv =
                container_of(port, struct eg20t_port, port);
index 0a12fb11e69803a1f42fbef8480b5f69ef2d94ca..b7a3a1b959b195d0ff78c7b9caacd0537cb8bea2 100644 (file)
@@ -691,7 +691,7 @@ static const struct uart_ops pic32_uart_ops = {
 
 #ifdef CONFIG_SERIAL_PIC32_CONSOLE
 /* output given char */
-static void pic32_console_putchar(struct uart_port *port, int ch)
+static void pic32_console_putchar(struct uart_port *port, unsigned char ch)
 {
        struct pic32_sport *sport = to_pic32_sport(port);
 
index 5359236b32d6b3ac707fa8eeb487f02f689b0617..5d97c201ad881ffbca89551852a8e4878e55cd65 100644 (file)
@@ -1944,7 +1944,7 @@ static void __exit exit_pmz(void)
 
 #ifdef CONFIG_SERIAL_PMACZILOG_CONSOLE
 
-static void pmz_console_putchar(struct uart_port *port, int ch)
+static void pmz_console_putchar(struct uart_port *port, unsigned char ch)
 {
        struct uart_pmac_port *uap =
                container_of(port, struct uart_pmac_port, port);
index b4987b417f199eade3dcb6be9db6ab4c8f36f79c..e80ba8e104072b77275432744efc4db3d031eeb7 100644 (file)
@@ -605,7 +605,7 @@ static void wait_for_xmitr(struct uart_pxa_port *up)
        }
 }
 
-static void serial_pxa_console_putchar(struct uart_port *port, int ch)
+static void serial_pxa_console_putchar(struct uart_port *port, unsigned char ch)
 {
        struct uart_pxa_port *up = (struct uart_pxa_port *)port;
 
index aedc38893e6cf472ad14ba05aece456a0445804c..1543a6028856278132754437ce055216a6b9fb6b 100644 (file)
@@ -397,7 +397,7 @@ static void qcom_geni_serial_poll_put_char(struct uart_port *uport,
 #endif
 
 #ifdef CONFIG_SERIAL_QCOM_GENI_CONSOLE
-static void qcom_geni_serial_wr_char(struct uart_port *uport, int ch)
+static void qcom_geni_serial_wr_char(struct uart_port *uport, unsigned char ch)
 {
        struct qcom_geni_private_data *private_data = uport->private_data;
 
index d550d8fa2fabf3289c90ebab28207b34ea5e67d1..e5f1fded423aa9a62228f403afe6918b7ee5d409 100644 (file)
@@ -573,7 +573,7 @@ static const struct uart_ops rda_uart_ops = {
 
 #ifdef CONFIG_SERIAL_RDA_CONSOLE
 
-static void rda_console_putchar(struct uart_port *port, int ch)
+static void rda_console_putchar(struct uart_port *port, unsigned char ch)
 {
        if (!port->membase)
                return;
index 697b6a002a16e6886f8fac902364c6c5f230c9bf..5fe6cccfc1aebc043a801ff5006b380916f18789 100644 (file)
@@ -695,7 +695,7 @@ void __init sa1100_register_uart(int idx, int port)
 
 
 #ifdef CONFIG_SERIAL_SA1100_CONSOLE
-static void sa1100_console_putchar(struct uart_port *port, int ch)
+static void sa1100_console_putchar(struct uart_port *port, unsigned char ch)
 {
        struct sa1100_port *sport =
                container_of(port, struct sa1100_port, port);
index d002a4e48ed9309ea6decf98863832f55efc72f4..2bde7bde71168871d31993699cf1c4b3232607a7 100644 (file)
@@ -2478,7 +2478,7 @@ static void s3c24xx_serial_put_poll_char(struct uart_port *port,
 #endif /* CONFIG_CONSOLE_POLL */
 
 static void
-s3c24xx_serial_console_putchar(struct uart_port *port, int ch)
+s3c24xx_serial_console_putchar(struct uart_port *port, unsigned char ch)
 {
        unsigned int ufcon = rd_regl(port, S3C2410_UFCON);
 
@@ -2965,7 +2965,7 @@ static void samsung_early_busyuart_fifo(struct uart_port *port)
                ;
 }
 
-static void samsung_early_putc(struct uart_port *port, int c)
+static void samsung_early_putc(struct uart_port *port, unsigned char c)
 {
        if (readl(port->membase + S3C2410_UFCON) & S3C2410_UFCON_FIFOMODE)
                samsung_early_busyuart_fifo(port);
index 738df6d9c0d95704c705256b09bc793dbdf194b4..2cf8533ef7609200a4250172c4f00e2000a725c4 100644 (file)
@@ -820,7 +820,7 @@ static void __init sbd_probe_duarts(void)
  * console output.  The console_lock is held by the caller, so we
  * shouldn't be interrupted for more console activity.
  */
-static void sbd_console_putchar(struct uart_port *uport, int ch)
+static void sbd_console_putchar(struct uart_port *uport, unsigned char ch)
 {
        struct sbd_port *sport = to_sport(uport);
 
index 10cc16a71f268f9cbcc6e75cd002ff7938be4975..c56de2e104d480fc55e7f37ddcb0d66caec2337c 100644 (file)
@@ -828,7 +828,7 @@ static const struct uart_ops sccnxp_ops = {
 };
 
 #ifdef CONFIG_SERIAL_SCCNXP_CONSOLE
-static void sccnxp_console_putchar(struct uart_port *port, int c)
+static void sccnxp_console_putchar(struct uart_port *port, unsigned char c)
 {
        int tryes = 100000;
 
index 846192a7b4bfc3b9abfe7ad6b810db3f81f0b406..a1688a3414112d79201496c812f8ea26ab139bd6 100644 (file)
@@ -1911,7 +1911,7 @@ static void uart_port_spin_lock_init(struct uart_port *port)
  */
 void uart_console_write(struct uart_port *port, const char *s,
                        unsigned int count,
-                       void (*putchar)(struct uart_port *, int))
+                       void (*putchar)(struct uart_port *, unsigned char))
 {
        unsigned int i;
 
index cd38cf1f03cbc5d3cfcdf82212d3f4790c18e372..a695e9c1a06aae4aa09a74de2cae6dc4df674f7a 100644 (file)
@@ -876,7 +876,7 @@ static void __init serial_txx9_register_ports(struct uart_driver *drv,
 
 #ifdef CONFIG_SERIAL_TXX9_CONSOLE
 
-static void serial_txx9_console_putchar(struct uart_port *port, int ch)
+static void serial_txx9_console_putchar(struct uart_port *port, unsigned char ch)
 {
        struct uart_txx9_port *up = to_uart_txx9_port(port);
 
index 77d76973858f7d7f39e171ad1cda7dd2259689c1..0f9b8bd235006f0e4b5996e72f0751b482e7b232 100644 (file)
@@ -2960,7 +2960,7 @@ static void sci_cleanup_single(struct sci_port *port)
 
 #if defined(CONFIG_SERIAL_SH_SCI_CONSOLE) || \
     defined(CONFIG_SERIAL_SH_SCI_EARLYCON)
-static void serial_console_putchar(struct uart_port *port, int ch)
+static void serial_console_putchar(struct uart_port *port, unsigned char ch)
 {
        sci_poll_put_char(port, ch);
 }
index b79900d0e91a624933c3ccfb2dbc7dc773187638..f5ac14c384c4da828421526b566451c1713c67e0 100644 (file)
@@ -756,7 +756,7 @@ static void sifive_serial_poll_put_char(struct uart_port *port,
  */
 
 #ifdef CONFIG_SERIAL_EARLYCON
-static void early_sifive_serial_putc(struct uart_port *port, int c)
+static void early_sifive_serial_putc(struct uart_port *port, unsigned char c)
 {
        while (__ssp_early_readl(port, SIFIVE_SERIAL_TXDATA_OFFS) &
               SIFIVE_SERIAL_TXDATA_FULL_MASK)
@@ -800,7 +800,7 @@ OF_EARLYCON_DECLARE(sifive, "sifive,fu540-c000-uart0",
 
 static struct sifive_serial_port *sifive_serial_console_ports[SIFIVE_SERIAL_MAX_PORTS];
 
-static void sifive_serial_console_putchar(struct uart_port *port, int ch)
+static void sifive_serial_console_putchar(struct uart_port *port, unsigned char ch)
 {
        struct sifive_serial_port *ssp = port_to_sifive_serial_port(port);
 
index 9a7ae6384edfa8546b899554975d4532932624b0..4329b9c9cbf0e7358d7ef5ff20ce4cc429cf8d0a 100644 (file)
@@ -984,7 +984,7 @@ static void wait_for_xmitr(struct uart_port *port)
        } while (status & SPRD_TX_FIFO_CNT_MASK);
 }
 
-static void sprd_console_putchar(struct uart_port *port, int ch)
+static void sprd_console_putchar(struct uart_port *port, unsigned char ch)
 {
        wait_for_xmitr(port);
        serial_out(port, SPRD_TXD, ch);
@@ -1058,7 +1058,7 @@ console_initcall(sprd_serial_console_init);
 #define SPRD_CONSOLE   (&sprd_console)
 
 /* Support for earlycon */
-static void sprd_putc(struct uart_port *port, int c)
+static void sprd_putc(struct uart_port *port, unsigned char c)
 {
        unsigned int timeout = SPRD_TIMEOUT;
 
index 87e480cc8206da2f2d8a7d01686ca3f8a8f3df27..d7fd692286cf6906266938bd2f3aedca3a640f74 100644 (file)
@@ -854,7 +854,7 @@ static int asc_serial_resume(struct device *dev)
 /*----------------------------------------------------------------------*/
 
 #ifdef CONFIG_SERIAL_ST_ASC_CONSOLE
-static void asc_console_putchar(struct uart_port *port, int ch)
+static void asc_console_putchar(struct uart_port *port, unsigned char ch)
 {
        unsigned int timeout = 1000000;
 
index 1b3a611ac39e1590eff386a0b71088ab8b8b0de6..87b5cd4c9743eabd0e96fc872f61c93cd4682b7e 100644 (file)
@@ -1641,7 +1641,7 @@ static int stm32_usart_serial_remove(struct platform_device *pdev)
 }
 
 #ifdef CONFIG_SERIAL_STM32_CONSOLE
-static void stm32_usart_console_putchar(struct uart_port *port, int ch)
+static void stm32_usart_console_putchar(struct uart_port *port, unsigned char ch)
 {
        struct stm32_port *stm32_port = to_stm32_port(port);
        const struct stm32_usart_offsets *ofs = &stm32_port->info->ofs;
index 1c7a30bf5f04a8f9f2256c5b72e8d4f3830198b8..9f15922e681bf5f5dcaa3856cff2948c85b3b803 100644 (file)
@@ -500,7 +500,8 @@ static const struct uart_ops sunplus_uart_ops = {
 #ifdef CONFIG_SERIAL_SUNPLUS_CONSOLE
 struct sunplus_uart_port *sunplus_console_ports[SUP_UART_NR];
 
-static void sunplus_uart_console_putchar(struct uart_port *port, int ch)
+static void sunplus_uart_console_putchar(struct uart_port *port,
+                                        unsigned char ch)
 {
        wait_for_xmitr(port);
        sp_uart_put_char(port, ch);
@@ -736,7 +737,7 @@ static void __exit sunplus_uart_exit(void)
 module_exit(sunplus_uart_exit);
 
 #ifdef CONFIG_SERIAL_EARLYCON
-static void sunplus_uart_putc(struct uart_port *port, int c)
+static void sunplus_uart_putc(struct uart_port *port, unsigned char c)
 {
        unsigned int val;
        int ret;
index 92e572634009044b4b1bc561416114c0320cf5cb..6ea52293d9f35821b9d0987b88be8128c5ead290 100644 (file)
@@ -846,7 +846,7 @@ static struct uart_sunsab_port *sunsab_ports;
 
 #ifdef CONFIG_SERIAL_SUNSAB_CONSOLE
 
-static void sunsab_console_putchar(struct uart_port *port, int c)
+static void sunsab_console_putchar(struct uart_port *port, unsigned char c)
 {
        struct uart_sunsab_port *up =
                container_of(port, struct uart_sunsab_port, port);
index 98b2f4fb9a99b8e84b3b6739860bfacf937cea0e..c31389114b86da406af6094d456eb42f69dbabfa 100644 (file)
@@ -1281,7 +1281,7 @@ static void wait_for_xmitr(struct uart_sunsu_port *up)
        }
 }
 
-static void sunsu_console_putchar(struct uart_port *port, int ch)
+static void sunsu_console_putchar(struct uart_port *port, unsigned char ch)
 {
        struct uart_sunsu_port *up =
                container_of(port, struct uart_sunsu_port, port);
index b714b00d2dadd44f85a9ceb94af32f01eb993d03..c14275d83b0b4ca8919c0bd2d2f8a2ee61926c3d 100644 (file)
@@ -100,7 +100,7 @@ struct uart_sunzilog_port {
 #endif
 };
 
-static void sunzilog_putchar(struct uart_port *port, int ch);
+static void sunzilog_putchar(struct uart_port *port, unsigned char ch);
 
 #define ZILOG_CHANNEL_FROM_PORT(PORT)  ((struct zilog_channel __iomem *)((PORT)->membase))
 #define UART_ZILOG(PORT)               ((struct uart_sunzilog_port *)(PORT))
@@ -1125,7 +1125,7 @@ static void sunzilog_free_tables(void)
 
 #define ZS_PUT_CHAR_MAX_DELAY  2000    /* 10 ms */
 
-static void __maybe_unused sunzilog_putchar(struct uart_port *port, int ch)
+static void __maybe_unused sunzilog_putchar(struct uart_port *port, unsigned char ch)
 {
        struct zilog_channel __iomem *channel = ZILOG_CHANNEL_FROM_PORT(port);
        int loops = ZS_PUT_CHAR_MAX_DELAY;
index e1fa52d31474f6e6d896a8c71f83eb31b971df93..007db67292a2d4eb46d144f28412a7bcb0e1037a 100644 (file)
@@ -482,7 +482,7 @@ static void ulite_console_wait_tx(struct uart_port *port)
                         "timeout waiting for TX buffer empty\n");
 }
 
-static void ulite_console_putchar(struct uart_port *port, int ch)
+static void ulite_console_putchar(struct uart_port *port, unsigned char ch)
 {
        ulite_console_wait_tx(port);
        uart_out32(ch, ULITE_TX, port);
@@ -558,7 +558,7 @@ static struct console ulite_console = {
        .data   = &ulite_uart_driver,
 };
 
-static void early_uartlite_putc(struct uart_port *port, int c)
+static void early_uartlite_putc(struct uart_port *port, unsigned char c)
 {
        /*
         * Limit how many times we'll spin waiting for TX FIFO status.
index 8586a56d4deb0d3b5d33fa23018059d9ad8a94a5..e0bf003ca3a1fe4592b7cf43f3610ee97b7a57ff 100644 (file)
@@ -730,7 +730,7 @@ static void wait_for_xmitr(struct uart_port *port)
        }
 }
 
-static void siu_console_putchar(struct uart_port *port, int ch)
+static void siu_console_putchar(struct uart_port *port, unsigned char ch)
 {
        wait_for_xmitr(port);
        siu_write(port, UART_TX, ch);
index 9adfe3dc970fc02ea02ef272ebe952c560dc1a8d..6f08136ce78a019e23324ae65758923c1c4d5c86 100644 (file)
@@ -484,7 +484,7 @@ static void wait_for_xmitr(struct uart_port *port)
        } while (status & 0x10);
 }
 
-static void vt8500_console_putchar(struct uart_port *port, int c)
+static void vt8500_console_putchar(struct uart_port *port, unsigned char c)
 {
        wait_for_xmitr(port);
        writeb(c, port->membase + VT8500_TXFIFO);
index d5e243908d9fdb81e3ecb0877af53b2256d0af83..250a1d888eeb3507df0300e117c7fb2f21a5f337 100644 (file)
@@ -1142,7 +1142,7 @@ static struct uart_driver cdns_uart_uart_driver;
  * @port: Handle to the uart port structure
  * @ch: Character to be written
  */
-static void cdns_uart_console_putchar(struct uart_port *port, int ch)
+static void cdns_uart_console_putchar(struct uart_port *port, unsigned char ch)
 {
        while (readl(port->membase + CDNS_UART_SR) & CDNS_UART_SR_TXFULL)
                cpu_relax();
index 4b4f604646a78c4286bce265efecaea600d2a9a8..70969bf9d82c91cf180e73e8042bb69b91b028f5 100644 (file)
@@ -1124,7 +1124,7 @@ static int __init zs_probe_sccs(void)
 
 
 #ifdef CONFIG_SERIAL_ZS_CONSOLE
-static void zs_console_putchar(struct uart_port *uport, int ch)
+static void zs_console_putchar(struct uart_port *uport, unsigned char ch)
 {
        struct zs_port *zport = to_zport(uport);
        struct zs_scc *scc = zport->scc;
index 31f7fe527395a216788a3ca720e223df92a26630..14ae35f68abbf30f9aee4b2e564fb69cd89fff7f 100644 (file)
@@ -399,7 +399,7 @@ int uart_set_options(struct uart_port *port, struct console *co, int baud,
 struct tty_driver *uart_console_device(struct console *co, int *index);
 void uart_console_write(struct uart_port *port, const char *s,
                        unsigned int count,
-                       void (*putchar)(struct uart_port *, int));
+                       void (*putchar)(struct uart_port *, unsigned char));
 
 /*
  * Port/driver registration/removal