Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp794627pxm; Thu, 3 Mar 2022 04:57:55 -0800 (PST) X-Google-Smtp-Source: ABdhPJymub9VCRLmumOE91O2uDi5eclO80aWzrmkWPfnt7cwmJXYMBEi2sN/Wybb+Daijwas/gk5 X-Received: by 2002:a62:d141:0:b0:4f3:c07b:7bf5 with SMTP id t1-20020a62d141000000b004f3c07b7bf5mr27694523pfl.41.1646312275134; Thu, 03 Mar 2022 04:57:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646312275; cv=none; d=google.com; s=arc-20160816; b=oG9TtDsSPin06wK/ZcRwU/Tp/dejOHK9S37cead1lZqjDRNyVJu+K5gWPpbZOyW8oB 6nOPqlFuhmyHgqtOIRxhgoa/BRNOZKuFERvbvMotx0B3bMqsHFPXtz5DtuN96aSTkrOu AtN0QxfHDalfNpofNoZUqD5JivOtiKSq+QWmzjjFHSmXVd72C2zqGN0jNfCID+vUJwjq SihyEPPtlCPkoxMetP+cjAyVVxIZcpZbClKWVSrjS9C4Y9Psj/129rU58Wl6IDfklb2X /MF/yDLH+SZr3ZGvrX3/BTeIYBPdXtkdo2FME5mCxFcw+Uss4xC7Kc0fguH/1t4JK4nq eXPQ== 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 :mime-version:accept-language:in-reply-to:references:message-id:date :thread-index:thread-topic:subject:cc:to:from; bh=BlSKZSIqTb8CuTKpdhniaD217n4LQNgyxuxnEpMvInE=; b=WKwgvlssbah04hElLK/l/RkHDryppOJYdvNHIhexshtM7iqHoVNtvKStvt1MBm/Tsi jji7dez9GNpfYp+po6wRnOayldRMAL7tjfu9qHneQPYXdS13OCVzB1a8liizI+LAcOLf K/vmmrGHyUpzBxSWxJ6+OuhiXLK1R4XPfy6isT7T5BLnH2vt9LMtg03a2239UJmFWl3S qiJIWfDHRSU06iLI1FmzOnsHi75p8snn5hNQas2dMQcNNRm6oxjL8vnuTXLnOVs+wcT1 534QSXK8VgBqXDZWoqhzkeAuF80WyjmTZXoiqv6+qefN5LtqXC7I7rA3oje+0gIssGlo wUBA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g2-20020a63ad02000000b00373eca034b7si1948325pgf.567.2022.03.03.04.57.38; Thu, 03 Mar 2022 04:57:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=aculab.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232840AbiCCLpe convert rfc822-to-8bit (ORCPT + 99 others); Thu, 3 Mar 2022 06:45:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57086 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230480AbiCCLpd (ORCPT ); Thu, 3 Mar 2022 06:45:33 -0500 Received: from eu-smtp-delivery-151.mimecast.com (eu-smtp-delivery-151.mimecast.com [185.58.85.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 74B45340D9 for ; Thu, 3 Mar 2022 03:44:47 -0800 (PST) Received: from AcuMS.aculab.com (156.67.243.121 [156.67.243.121]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id uk-mta-4-XQRo4zE6MZqO9sHS00ouew-1; Thu, 03 Mar 2022 11:44:44 +0000 X-MC-Unique: XQRo4zE6MZqO9sHS00ouew-1 Received: from AcuMS.Aculab.com (fd9f:af1c:a25b:0:994c:f5c2:35d6:9b65) by AcuMS.aculab.com (fd9f:af1c:a25b:0:994c:f5c2:35d6:9b65) with Microsoft SMTP Server (TLS) id 15.0.1497.28; Thu, 3 Mar 2022 11:44:42 +0000 Received: from AcuMS.Aculab.com ([fe80::994c:f5c2:35d6:9b65]) by AcuMS.aculab.com ([fe80::994c:f5c2:35d6:9b65%12]) with mapi id 15.00.1497.028; Thu, 3 Mar 2022 11:44:42 +0000 From: David Laight To: "'Maciej W. Rozycki'" , Paul Cercueil CC: Jiri Slaby , =?iso-8859-1?Q?=27Uwe_Kleine-K=F6nig=27?= , "gregkh@linuxfoundation.org" , Alexandre Belloni , Mateusz Holenko , Neil Armstrong , Benjamin Herrenschmidt , Liviu Dudau , Baruch Siach , "linux-kernel@vger.kernel.org" , Paul Mackerras , "Michael Ellerman" , Michal Simek , "Karol Gugala" , Jerome Brunet , "Peter Korsgaard" , Florian Fainelli , Alexander Shiyan , Krzysztof Kozlowski , Alexandre Torgue , Fabio Estevam , "Russell King" , Ludovic Desroches , Andy Gross , "bcm-kernel-feedback-list@broadcom.com" , NXP Linux Team , "linux-serial@vger.kernel.org" , Vineet Gupta , Orson Zhai , Tobias Klauser , Patrice Chotard , "Albert Ou" , Maxime Coquelin , Manivannan Sadhasivam , Martin Blumenstingl , Sascha Hauer , Takao Orito , Vladimir Zapolskiy , Lorenzo Pieralisi , Paul Walmsley , Bjorn Andersson , Sudeep Holla , Richard Genoud , Chunyan Zhang , "Nicolas Ferre" , "David S. Miller" , Taichi Sugaya , Palmer Dabbelt , Pengutronix Kernel Team , "Kevin Hilman" , Baolin Wang , "Shawn Guo" , =?iso-8859-1?Q?Andreas_F=E4rber?= Subject: RE: [PATCH v3] serial: make uart_console_write->putchar()'s character an unsigned char Thread-Topic: [PATCH v3] serial: make uart_console_write->putchar()'s character an unsigned char Thread-Index: AQHYLl5tVpWrjMz0S0GPyaCV/1nc9aysw9yAgADDqR+AAACPoA== Date: Thu, 3 Mar 2022 11:44:42 +0000 Message-ID: <9fa84690ed244eba89f1efe4e6670f80@AcuMS.aculab.com> References: <20220302072732.1916-1-jslaby@suse.cz> <20220302175242.ejiaf36vszr4xvou@pengutronix.de> <5c7045c1910143e08ced432d938b5825@AcuMS.aculab.com> <84ad3854-28b9-e450-f0a2-f1448f32f137@suse.cz> In-Reply-To: Accept-Language: en-GB, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.202.205.107] MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=C51A453 smtp.mailfrom=david.laight@aculab.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: aculab.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham 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 From: Maciej W. Rozycki > Sent: 03 March 2022 11:31 .. > It does, but, oh dear, it's a "solution" to a problem we have created in > the first place. Why do we ever want to have signed characters in the TTY > layer, and then to vary between platforms? It's asking for portability > issues. C 'char' is signed because the pdp/11 byte load sign extended. I guess some ABI use unsigned char to avoid issues with all the functions that take/return an int parameter that is either a 'char' cast to 'unsigned char' or EOF. EOF is usually (-1) - but doesn't have to be. But it needs to be different from any value obtained by casting a 'char' to 'unsigned char'. (But that may only need to be all characters, not all values of 'char'.) Then you get the requirement that: sizeof (int) >= sizeof (short) >= sizeof (char) which means that it is perfectly valid for all 3 to be the same size [1]. In that case 'unsigned char' promotes to 'unsigned int' which probably breaks some code. It also makes defining EOF troublesome! [1] The C compiler for a DSP had this 'feature'. David - Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK Registration No: 1397386 (Wales)