Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp259516pxm; Wed, 2 Mar 2022 14:49:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJxlBWNAucQvIxk1SZ5kyzPutmzTnOnDxqKmTM8x52cl1ZQ5Lkm46/Bs5kKLsDgQXNL6Wita X-Received: by 2002:a17:902:f689:b0:151:55a0:9b85 with SMTP id l9-20020a170902f68900b0015155a09b85mr21600055plg.112.1646261368916; Wed, 02 Mar 2022 14:49:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646261368; cv=none; d=google.com; s=arc-20160816; b=xebPecNMjj2LxsbjZB2V44Zu0AtR/Th4QJkM7RNgKvYqNqhXK3mgqB3fK8WU1RTdeR vE6KxMRE6ZwuNtBfPRGFMPI+yaHT2xbV7h1Md5Eks285N4hkYN/FOuUS8LuC7IXtav3l Y/bJuAOwr2IHMTzryXcgbu3Tp7VFE8BYN0WLbET33kl3lK5ubjHek50mwtLjJ+NwLCGT /ataobmRWW2I78sB50CYhHaB8cop+9KeJbxd3dJFDzR8pwg4+tLsABR8TAD7WEds0dYH T8s//7gaXhT90w5Fp0JfVIUGg9LUuVDpvJNSXGHSFl9A8eAXnLBrzBmRDnQFJl59SSR/ 6qSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature:dkim-signature; bh=un3C7hsY2FZNawW+qXkRsg1X+2wI4dMHIrBZ5c87Vys=; b=Cv1Fw6Jl+WcRl8aECTBm4r0pEsSOvbkQaQ//+vYxL408AEtcOwcZNlSeon+Sk8mlZB wrEcq6/wOFEmeUwb4acdgWtXZ3fJPc1dFudrDpe6KoMGMb2zVKOsKeG9ezc2d8KPFJVK QU3mMmVDXfmk3tpPpE6HsYWc6dah9pQptvXNq8v1PC4lTprWkEPFC3+QKmQjki5vYwjL 9UEEz8RpswjUymzESeGQC+zzP6GPrSv23HeIX7tox6KvqxNgQk/EipOemttWbkEswwuv mob/zSCfSgItABIcUBNvnh4/rZhpEdT3TcnRTaQnFY3SjqH1yKJZpeK63uRRnx8nlHkK lwYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mleia.com header.s=mail header.b=D2nwKwiY; dkim=pass header.i=@mleia.com header.s=mail header.b=D2nwKwiY; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id y26-20020a63b51a000000b0036c732829e4si320169pge.159.2022.03.02.14.49.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Mar 2022 14:49:28 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@mleia.com header.s=mail header.b=D2nwKwiY; dkim=pass header.i=@mleia.com header.s=mail header.b=D2nwKwiY; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C2EB2107DA4; Wed, 2 Mar 2022 14:40:47 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240525AbiCBSsH (ORCPT + 99 others); Wed, 2 Mar 2022 13:48:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58262 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244726AbiCBSsE (ORCPT ); Wed, 2 Mar 2022 13:48:04 -0500 X-Greylist: delayed 899 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Wed, 02 Mar 2022 10:47:20 PST Received: from mail.mleia.com (mleia.com [178.79.152.223]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 565ADD5571; Wed, 2 Mar 2022 10:47:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mleia.com; s=mail; t=1646245282; bh=r/KWBCXbgbUsx0MROHM9/eZLCf5PfDdjQ920as27D3k=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=D2nwKwiYcjfQ8oI3lQewTctuUi8U4oh8bNo2fgLFtdJlnEEKPqbSl/4HCVSEanMn4 3RTuUSTz/1dEi3fgmH0m2GCM16EQNrmAUzX6Vla+Dpc0F7l792PeVNRR/UvsyTUsso fojz0nHmJamBDGby1t7rqGhtVFt8K4DBvXpB8oJKcBu2PlmqUMFBoXUApvB4dNrzaR Y5v4yFqHW07zhDlJnzE1XFZX0IElyreDBbxTF6tncpceXn6DUlqp+Bp5e8TuBukRkS OMABrntTimVnol9CcvJIurAztzqKq5d6vXpigNoE7OfhCX0stZ2hPYVlzZwTKivbp3 AWQCNqKfDfS+g== Received: from mail.mleia.com (localhost [127.0.0.1]) by mail.mleia.com (Postfix) with ESMTP id 293C039B89A; Wed, 2 Mar 2022 18:21:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=mleia.com; s=mail; t=1646245282; bh=r/KWBCXbgbUsx0MROHM9/eZLCf5PfDdjQ920as27D3k=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=D2nwKwiYcjfQ8oI3lQewTctuUi8U4oh8bNo2fgLFtdJlnEEKPqbSl/4HCVSEanMn4 3RTuUSTz/1dEi3fgmH0m2GCM16EQNrmAUzX6Vla+Dpc0F7l792PeVNRR/UvsyTUsso fojz0nHmJamBDGby1t7rqGhtVFt8K4DBvXpB8oJKcBu2PlmqUMFBoXUApvB4dNrzaR Y5v4yFqHW07zhDlJnzE1XFZX0IElyreDBbxTF6tncpceXn6DUlqp+Bp5e8TuBukRkS OMABrntTimVnol9CcvJIurAztzqKq5d6vXpigNoE7OfhCX0stZ2hPYVlzZwTKivbp3 AWQCNqKfDfS+g== Received: from [192.168.1.102] (88-113-46-102.elisa-laajakaista.fi [88.113.46.102]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.mleia.com (Postfix) with ESMTPSA id 16A0B39B811; Wed, 2 Mar 2022 18:21:19 +0000 (UTC) Subject: Re: [PATCH v3] serial: make uart_console_write->putchar()'s character an unsigned char To: Jiri Slaby , gregkh@linuxfoundation.org Cc: linux-serial@vger.kernel.org, linux-kernel@vger.kernel.org, Richard Genoud , Florian Fainelli , Tobias Klauser , Paul Cercueil , Russell King , Vineet Gupta , Nicolas Ferre , Alexandre Belloni , Ludovic Desroches , 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 , Neil Armstrong , 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: <20220302072732.1916-1-jslaby@suse.cz> From: Vladimir Zapolskiy Message-ID: <9f1f4434-56cb-e8e7-b947-6630752a74c3@mleia.com> Date: Wed, 2 Mar 2022 20:21:15 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: <20220302072732.1916-1-jslaby@suse.cz> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-49551924 X-CRM114-CacheID: sfid-20220302_182122_201121_FC62FFD6 X-CRM114-Status: GOOD ( 26.46 ) X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/2/22 9:27 AM, 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: Florian Fainelli [bcm63xx_uart] > Acked-by: Tobias Klauser [altera_*] > Cc: Paul Cercueil > Cc: Russell King > Cc: Vineet Gupta > Cc: Nicolas Ferre > Cc: Alexandre Belloni > Cc: Ludovic Desroches > 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 > --- [snip] > diff --git a/drivers/tty/serial/lpc32xx_hs.c b/drivers/tty/serial/lpc32xx_hs.c > index 54437a087aa0..93140cac1ca1 100644 > --- a/drivers/tty/serial/lpc32xx_hs.c > +++ b/drivers/tty/serial/lpc32xx_hs.c > @@ -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)); for NXP LPC32xx HS UART: Acked-by: Vladimir Zapolskiy -- Best wishes, Vladimir