From: Neil Armstrong <narmstrong@baylibre.com>
To: Jiri Slaby <jslaby@suse.cz>, gregkh@linuxfoundation.org
Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org,
"Richard Genoud" <richard.genoud@gmail.com>,
"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
"Paul Cercueil" <paul@crapouillou.net>,
"Tobias Klauser" <tklauser@distanz.ch>,
"Russell King" <linux@armlinux.org.uk>,
"Vineet Gupta" <vgupta@kernel.org>,
"Nicolas Ferre" <nicolas.ferre@microchip.com>,
"Alexandre Belloni" <alexandre.belloni@bootlin.com>,
"Ludovic Desroches" <ludovic.desroches@microchip.com>,
"Florian Fainelli" <f.fainelli@gmail.com>,
bcm-kernel-feedback-list@broadcom.com,
"Alexander Shiyan" <shc_work@mail.ru>,
"Baruch Siach" <baruch@tkos.co.il>,
"Maciej W. Rozycki" <macro@orcam.me.uk>,
"Paul Walmsley" <paul.walmsley@sifive.com>,
"Palmer Dabbelt" <palmer@dabbelt.com>,
"Albert Ou" <aou@eecs.berkeley.edu>,
"Shawn Guo" <shawnguo@kernel.org>,
"Sascha Hauer" <s.hauer@pengutronix.de>,
"Pengutronix Kernel Team" <kernel@pengutronix.de>,
"Fabio Estevam" <festevam@gmail.com>,
"NXP Linux Team" <linux-imx@nxp.com>,
"Karol Gugala" <kgugala@antmicro.com>,
"Mateusz Holenko" <mholenko@antmicro.com>,
"Vladimir Zapolskiy" <vz@mleia.com>,
"Kevin Hilman" <khilman@baylibre.com>,
"Jerome Brunet" <jbrunet@baylibre.com>,
"Martin Blumenstingl" <martin.blumenstingl@googlemail.com>,
"Taichi Sugaya" <sugaya.taichi@socionext.com>,
"Takao Orito" <orito.takao@socionext.com>,
"Liviu Dudau" <liviu.dudau@arm.com>,
"Sudeep Holla" <sudeep.holla@arm.com>,
"Lorenzo Pieralisi" <lorenzo.pieralisi@arm.com>,
"Andreas Färber" <afaerber@suse.de>,
"Manivannan Sadhasivam" <mani@kernel.org>,
"Michael Ellerman" <mpe@ellerman.id.au>,
"Benjamin Herrenschmidt" <benh@kernel.crashing.org>,
"Paul Mackerras" <paulus@samba.org>,
"Andy Gross" <agross@kernel.org>,
"Bjorn Andersson" <bjorn.andersson@linaro.org>,
"Krzysztof Kozlowski" <krzysztof.kozlowski@canonical.com>,
"Orson Zhai" <orsonzhai@gmail.com>,
"Baolin Wang" <baolin.wang7@gmail.com>,
"Chunyan Zhang" <zhang.lyra@gmail.com>,
"Patrice Chotard" <patrice.chotard@foss.st.com>,
"Maxime Coquelin" <mcoquelin.stm32@gmail.com>,
"Alexandre Torgue" <alexandre.torgue@foss.st.com>,
"David S. Miller" <davem@davemloft.net>,
"Peter Korsgaard" <peter@korsgaard.com>,
"Michal Simek" <michal.simek@xilinx.com>
Subject: Re: [PATCH v4] serial: make uart_console_write->putchar()'s character an unsigned char
Date: Thu, 3 Mar 2022 09:12:05 +0100 [thread overview]
Message-ID: <07d15deb-ef49-54ec-4486-0b527df82fe2@baylibre.com> (raw)
In-Reply-To: <20220303080831.21783-1-jslaby@suse.cz>
On 03/03/2022 09:08, Jiri Slaby wrote:
> 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.
>
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> Acked-by: Richard Genoud <richard.genoud@gmail.com> [atmel_serial]
> Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> 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>
> ---
> [v2] make it unsigned
> [v3] fix also sunsab
> [v4] fix also sunplus (added quite recently)
>
> drivers/tty/goldfish.c | 2 +-
> drivers/tty/hvc/hvc_dcc.c | 2 +-
> drivers/tty/serial/21285.c | 2 +-
> drivers/tty/serial/8250/8250_early.c | 2 +-
> drivers/tty/serial/8250/8250_ingenic.c | 2 +-
> drivers/tty/serial/8250/8250_port.c | 2 +-
> drivers/tty/serial/altera_jtaguart.c | 4 ++--
> drivers/tty/serial/altera_uart.c | 2 +-
> drivers/tty/serial/amba-pl010.c | 2 +-
> drivers/tty/serial/amba-pl011.c | 6 +++---
> drivers/tty/serial/apbuart.c | 2 +-
> drivers/tty/serial/ar933x_uart.c | 2 +-
> drivers/tty/serial/arc_uart.c | 2 +-
> drivers/tty/serial/atmel_serial.c | 2 +-
> drivers/tty/serial/bcm63xx_uart.c | 2 +-
> drivers/tty/serial/clps711x.c | 2 +-
> drivers/tty/serial/digicolor-usart.c | 2 +-
> drivers/tty/serial/dz.c | 2 +-
> drivers/tty/serial/earlycon-arm-semihost.c | 2 +-
> drivers/tty/serial/earlycon-riscv-sbi.c | 2 +-
> drivers/tty/serial/fsl_linflexuart.c | 4 ++--
> drivers/tty/serial/fsl_lpuart.c | 4 ++--
> drivers/tty/serial/imx.c | 2 +-
> drivers/tty/serial/imx_earlycon.c | 2 +-
> drivers/tty/serial/ip22zilog.c | 2 +-
> drivers/tty/serial/lantiq.c | 2 +-
> drivers/tty/serial/liteuart.c | 2 +-
> drivers/tty/serial/lpc32xx_hs.c | 2 +-
> drivers/tty/serial/meson_uart.c | 2 +-
> drivers/tty/serial/milbeaut_usio.c | 2 +-
> drivers/tty/serial/mps2-uart.c | 4 ++--
> drivers/tty/serial/mvebu-uart.c | 4 ++--
> drivers/tty/serial/mxs-auart.c | 2 +-
> drivers/tty/serial/omap-serial.c | 4 ++--
> drivers/tty/serial/owl-uart.c | 2 +-
> drivers/tty/serial/pch_uart.c | 2 +-
> drivers/tty/serial/pic32_uart.c | 2 +-
> drivers/tty/serial/pmac_zilog.c | 2 +-
> drivers/tty/serial/pxa.c | 2 +-
> drivers/tty/serial/qcom_geni_serial.c | 2 +-
> drivers/tty/serial/rda-uart.c | 2 +-
> drivers/tty/serial/sa1100.c | 2 +-
> drivers/tty/serial/samsung_tty.c | 4 ++--
> drivers/tty/serial/sb1250-duart.c | 2 +-
> drivers/tty/serial/sccnxp.c | 2 +-
> drivers/tty/serial/serial_core.c | 2 +-
> drivers/tty/serial/serial_txx9.c | 2 +-
> drivers/tty/serial/sh-sci.c | 2 +-
> drivers/tty/serial/sifive.c | 4 ++--
> drivers/tty/serial/sprd_serial.c | 4 ++--
> drivers/tty/serial/st-asc.c | 2 +-
> drivers/tty/serial/stm32-usart.c | 2 +-
> drivers/tty/serial/sunplus-uart.c | 5 +++--
> drivers/tty/serial/sunsab.c | 2 +-
> drivers/tty/serial/sunsu.c | 2 +-
> drivers/tty/serial/sunzilog.c | 4 ++--
> drivers/tty/serial/uartlite.c | 4 ++--
> drivers/tty/serial/vr41xx_siu.c | 2 +-
> drivers/tty/serial/vt8500_serial.c | 2 +-
> drivers/tty/serial/xilinx_uartps.c | 2 +-
> drivers/tty/serial/zs.c | 2 +-
> include/linux/serial_core.h | 2 +-
> 62 files changed, 77 insertions(+), 76 deletions(-)
>
[...]
> --- a/drivers/tty/serial/meson_uart.c
> +++ b/drivers/tty/serial/meson_uart.c
> @@ -516,7 +516,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;
[...]
Acked-by: Neil Armstrong <narmstrong@baylibre.com> # meson_serial
next prev parent reply other threads:[~2022-03-03 8:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-03 8:08 [PATCH v4] serial: make uart_console_write->putchar()'s character an unsigned char Jiri Slaby
2022-03-03 8:12 ` Neil Armstrong [this message]
2022-03-03 10:24 ` Paul Cercueil
2022-03-04 12:06 ` Maciej W. Rozycki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=07d15deb-ef49-54ec-4486-0b527df82fe2@baylibre.com \
--to=narmstrong@baylibre.com \
--cc=afaerber@suse.de \
--cc=agross@kernel.org \
--cc=alexandre.belloni@bootlin.com \
--cc=alexandre.torgue@foss.st.com \
--cc=aou@eecs.berkeley.edu \
--cc=baolin.wang7@gmail.com \
--cc=baruch@tkos.co.il \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=benh@kernel.crashing.org \
--cc=bjorn.andersson@linaro.org \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=festevam@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=jbrunet@baylibre.com \
--cc=jslaby@suse.cz \
--cc=kernel@pengutronix.de \
--cc=kgugala@antmicro.com \
--cc=khilman@baylibre.com \
--cc=krzysztof.kozlowski@canonical.com \
--cc=linux-imx@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=liviu.dudau@arm.com \
--cc=lorenzo.pieralisi@arm.com \
--cc=ludovic.desroches@microchip.com \
--cc=macro@orcam.me.uk \
--cc=mani@kernel.org \
--cc=martin.blumenstingl@googlemail.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=mholenko@antmicro.com \
--cc=michal.simek@xilinx.com \
--cc=mpe@ellerman.id.au \
--cc=nicolas.ferre@microchip.com \
--cc=orito.takao@socionext.com \
--cc=orsonzhai@gmail.com \
--cc=palmer@dabbelt.com \
--cc=patrice.chotard@foss.st.com \
--cc=paul.walmsley@sifive.com \
--cc=paul@crapouillou.net \
--cc=paulus@samba.org \
--cc=peter@korsgaard.com \
--cc=richard.genoud@gmail.com \
--cc=s.hauer@pengutronix.de \
--cc=shawnguo@kernel.org \
--cc=shc_work@mail.ru \
--cc=sudeep.holla@arm.com \
--cc=sugaya.taichi@socionext.com \
--cc=tklauser@distanz.ch \
--cc=u.kleine-koenig@pengutronix.de \
--cc=vgupta@kernel.org \
--cc=vz@mleia.com \
--cc=zhang.lyra@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox