From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28EC6C433EF for ; Thu, 3 Mar 2022 08:12:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230149AbiCCINA (ORCPT ); Thu, 3 Mar 2022 03:13:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231218AbiCCIMz (ORCPT ); Thu, 3 Mar 2022 03:12:55 -0500 Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1267F170D4B for ; Thu, 3 Mar 2022 00:12:09 -0800 (PST) Received: by mail-wr1-x431.google.com with SMTP id d3so6515231wrf.1 for ; Thu, 03 Mar 2022 00:12:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :cc:references:from:organization:in-reply-to :content-transfer-encoding; bh=LJqUL43XcbGuz68y/4lEqQ5dRFIUxBQ8RyqcTDZsiaE=; b=2F5HIdxRy5kJPzBGqgI+tIttT04lYafSyVZoXlykcFs8CjKXvXaEOKOsL2u2O16rzh YhRsCrcK6hylj/OLa0A+0exW4kZBFCTJWQBQAmzgFwrNBN73NcnOyJMr8AU+t98Pgo9g HrRhzkjiUPGwQLOzBzFvdV6OJe0iJ3TaNIxjpHVmbOBqnlpVVqBicl/KHSxR71EFj+w4 o+r+nLAN1Us7A4cseX8KR5PwiKeSsSK1fgeGxJZX/JbsM9EXu6BQ43P0QZDhOjl6+ZYt XlRGaUyhUaVrp6VOt5uhoTguog925JmOpFRRYRj0MECAL+qXb/6BiW4r+erOA7eEWt9C N1SQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:organization:in-reply-to :content-transfer-encoding; bh=LJqUL43XcbGuz68y/4lEqQ5dRFIUxBQ8RyqcTDZsiaE=; b=NwRU0W0PLLRi+lLuZoZ/ua0+IaOlxgHYwvpgYGDcJRsi/a5hSIbN+XvYLpPWintLGK Mz8sEbveBa0/n5J2P4nWwyt6JKBIfKbzHpi95oRi9q+IRxpbvWkrk8Rx6pYBAPYtyIAn W1XcHWPhpGFX5ViVPo1St4jNin46USW5Hydhj8m6Pa4HPRmDfDmEF7gozcf6mG/a6/HH 5XDGvxvSWiefFn+n2pgrDsRMxvDza3g2XNwi1bfLEwsKixJXc/et+xOWcSxXVnIYPJjC W3PjHuDSq0ZCwl7ftvR/M3wX0udag858op55ZNKXklAFml6+OsiXWBwrj0uvUW1LUkLi TWIA== X-Gm-Message-State: AOAM5309JLF+AKJ46SHfPtgJdngIIEDJ95mKyrtm/p2OBk4ryeFQLbqo k4YvFu0uayubOKsRSIEu0+ylSg== X-Google-Smtp-Source: ABdhPJzKINeaPPH4W3c+lQwH+lbSqxtZ9RLhAndsAGTg0w8w9Jn5I+YFIyKdtv+guSsNnw80xokivA== X-Received: by 2002:a5d:44d2:0:b0:1f0:247d:8cf7 with SMTP id z18-20020a5d44d2000000b001f0247d8cf7mr5702562wrr.475.1646295127475; Thu, 03 Mar 2022 00:12:07 -0800 (PST) Received: from ?IPV6:2001:861:44c0:66c0:37d4:6d61:9015:27a5? ([2001:861:44c0:66c0:37d4:6d61:9015:27a5]) by smtp.gmail.com with ESMTPSA id l16-20020a05600c1d1000b003816edb5711sm8463782wms.26.2022.03.03.00.12.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Mar 2022 00:12:06 -0800 (PST) Message-ID: <07d15deb-ef49-54ec-4486-0b527df82fe2@baylibre.com> Date: Thu, 3 Mar 2022 09:12:05 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: [PATCH v4] serial: make uart_console_write->putchar()'s character an unsigned char Content-Language: en-US To: Jiri Slaby , gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Richard Genoud , =?UTF-8?Q?Uwe_Kleine-K=c3=b6nig?= , Paul Cercueil , Tobias Klauser , Russell King , Vineet Gupta , Nicolas Ferre , Alexandre Belloni , Ludovic Desroches , Florian Fainelli , bcm-kernel-feedback-list@broadcom.com, Alexander Shiyan , Baruch Siach , "Maciej W. Rozycki" , Paul Walmsley , Palmer Dabbelt , Albert Ou , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Karol Gugala , Mateusz Holenko , Vladimir Zapolskiy , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Taichi Sugaya , Takao Orito , Liviu Dudau , Sudeep Holla , Lorenzo Pieralisi , =?UTF-8?Q?Andreas_F=c3=a4rber?= , Manivannan Sadhasivam , Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Andy Gross , Bjorn Andersson , Krzysztof Kozlowski , Orson Zhai , Baolin Wang , Chunyan Zhang , Patrice Chotard , Maxime Coquelin , Alexandre Torgue , "David S. Miller" , Peter Korsgaard , Michal Simek References: <20220303080831.21783-1-jslaby@suse.cz> From: Neil Armstrong Organization: Baylibre In-Reply-To: <20220303080831.21783-1-jslaby@suse.cz> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > Acked-by: Richard Genoud [atmel_serial] > Acked-by: Uwe Kleine-König > Cc: Paul Cercueil > Cc: Tobias Klauser > Cc: Russell King > Cc: Vineet Gupta > Cc: Nicolas Ferre > Cc: Alexandre Belloni > Cc: Ludovic Desroches > Cc: Florian Fainelli > Cc: bcm-kernel-feedback-list@broadcom.com > Cc: Alexander Shiyan > Cc: Baruch Siach > Cc: "Maciej W. Rozycki" > Cc: Paul Walmsley > Cc: Palmer Dabbelt > Cc: Albert Ou > Cc: Shawn Guo > Cc: Sascha Hauer > Cc: Pengutronix Kernel Team > Cc: Fabio Estevam > Cc: NXP Linux Team > Cc: Karol Gugala > Cc: Mateusz Holenko > Cc: Vladimir Zapolskiy > Cc: Neil Armstrong > Cc: Kevin Hilman > Cc: Jerome Brunet > Cc: Martin Blumenstingl > Cc: Taichi Sugaya > Cc: Takao Orito > Cc: Liviu Dudau > Cc: Sudeep Holla > Cc: Lorenzo Pieralisi > Cc: "Andreas Färber" > Cc: Manivannan Sadhasivam > Cc: Michael Ellerman > Cc: Benjamin Herrenschmidt > Cc: Paul Mackerras > Cc: Andy Gross > Cc: Bjorn Andersson > Cc: Krzysztof Kozlowski > Cc: Orson Zhai > Cc: Baolin Wang > Cc: Chunyan Zhang > Cc: Patrice Chotard > Cc: Maxime Coquelin > Cc: Alexandre Torgue > Cc: "David S. Miller" > Cc: Peter Korsgaard > Cc: Michal Simek > --- > [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 # meson_serial