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 A0C15C433EF for ; Thu, 3 Mar 2022 06:33:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229830AbiCCGdv (ORCPT ); Thu, 3 Mar 2022 01:33:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229715AbiCCGdr (ORCPT ); Thu, 3 Mar 2022 01:33:47 -0500 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9425050441; Wed, 2 Mar 2022 22:33:02 -0800 (PST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 038891F383; Thu, 3 Mar 2022 06:33:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1646289181; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7wrM5osNp1XinrH0hvsKMOFQq7yQKcbCY9ws+MpwasA=; b=xqBGfyIa/vtyHBAIrMhbI3nqYVibiM5V3Blc0aLWUYWy7o9Nuy2IGyr6OgYhMif05HZP5k RVm5/CjkyGXc3CUduKsK6BMSzi7s6AdHMRUFLlabMCTe+nfKY34bA/FiyhBASvJ86kU6Jg LAeXNDHos2sRuthUTlYKJn292hrRsHk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1646289181; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=7wrM5osNp1XinrH0hvsKMOFQq7yQKcbCY9ws+MpwasA=; b=XDoC2GwA3XLI0VgAZwDYUIKoNr0ulhnqvDty+UvHS1wIlshjvES6QaLsE8AH/OCZKRHgAZ mseBngwk3akmmoDA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id E98B5132C1; Thu, 3 Mar 2022 06:32:59 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id bKkoNxthIGKRJQAAMHmgww (envelope-from ); Thu, 03 Mar 2022 06:32:59 +0000 Message-ID: <1be133eb-bfe8-b644-6aad-00a0a606aa05@suse.cz> Date: Thu, 3 Mar 2022 07:32:59 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.6.0 Subject: Re: [PATCH v3] serial: make uart_console_write->putchar()'s character an unsigned char Content-Language: en-US To: 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 , Vladimir Zapolskiy , 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: Jiri Slaby In-Reply-To: <20220302072732.1916-1-jslaby@suse.cz> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 02. 03. 22, 8:27, 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. Kbuild seems to serve me this one by one. So this patch is still incomplete: > drivers/tty/serial/sunplus-uart.c:526:7: error: incompatible function pointer types passing 'void (struct uart_port *, int)' to parameter of type 'void (*)(struct uart_port *, unsigned char)' regards, -- js suse labs