Message ID | 20240221183442.4124354-3-andriy.shevchenko@linux.intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-75307-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp1254076dyc; Wed, 21 Feb 2024 11:35:41 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVE1bkokubKHKp9lameEtkNWH2bltZKR8ioNJl79hz6jcGCl90aKycI6c3rM6VAKGWJB+2Xc42682DfRA6SWTsG9y5I/A== X-Google-Smtp-Source: AGHT+IGx/E1WKo8QjhlEFyQ6S/5Ck21ojTZVPoBipTY2ucaDtF9pEJ4EGg4i1T6RH2DuecdYWFDb X-Received: by 2002:a17:902:8496:b0:1db:47bb:65d6 with SMTP id c22-20020a170902849600b001db47bb65d6mr15749485plo.58.1708544140906; Wed, 21 Feb 2024 11:35:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708544140; cv=pass; d=google.com; s=arc-20160816; b=G56zmwA1TaazLWI9RrGBLTBe1HDUWV27M0Cmd0mz2hZAt1q01RbvrRdm1bOWwcuR5D 0GdaUsbKONz5KNSnEUPB9NzyGrBzbHjhIUsuySsyEtkPdhEey1SgiToFpICtFvxy++3v GP0fQKg+ttgbxFAq+Wc+F1gXyGejz+okkshTWkf/8st1aM/xM+FVYb7v01zUMs8o+/+g LncrcILsDGMVXXZsc13vnV9Jbs9Jw/VW1w+Jsy0sX+pm6g+rb62H1V0iT+3oYRvXRQWK eZpITxaxP2e4j69hTB7rp/se7FtdyxBjoMMZ9Hf5Ou+uZ7wAaxdAjdNshTuU7h4KnIQO 9z0g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=SqkLmTGMsqXCC11DUmn1uKOjpQoLto3lrBv2qiacfuE=; fh=yrE9O525sLNdIXC06sJBIlRUjYfWNm6imQ0cf3A93gQ=; b=MCPmVeJ/Nj7OnuhsB96lHtiHopIfgw6FVyeCfB5VJnV9mwN1b34om3ZTWoyZhSiHAO L4S0HBEYrMW01lKDzSW5P10OIFTxSCdeLrUVlK9icHI3DCcyLSMCc5yNsysL3lZ8HY1W e5ez9HHWbTF7qTFbO93DcgdB1laJ0KEiH3WCQw4UerxF3/B9tiLFjXJWHt3QqbMbWiSY iaQGaN44ODfKpYOf60U173+TcoWIf7HiiA55uqht66PEtdVhOVNbgKPE9HTZOaDNeY3o TNEsW6wT8VvQ054l7z5ldg4k9JPjo37VVyJfusd/U001jLPrF7kR5Ks1aRuBXgEEVwBV R5mw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=jejBQQc+; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-75307-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75307-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id k10-20020a170902d58a00b001dc42bc9403si661009plh.330.2024.02.21.11.35.40 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 11:35:40 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75307-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=jejBQQc+; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-75307-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75307-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 686C22869CA for <ouuuleilei@gmail.com>; Wed, 21 Feb 2024 18:36:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5053585275; Wed, 21 Feb 2024 18:35:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="jejBQQc+" Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1226E85940; Wed, 21 Feb 2024 18:34:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708540500; cv=none; b=DliA4COkb/4qxSPjbjPy2U05F7Gy9zLIWZ27oNC5HKYFc3hf6i4wtyzI57ZFzwc/9s4R2nMFR4WmK3GDdZqcJgiAoaR/AJmfdF9P38W9ZneFE7THypvkJ4S3qIcwrZdiZZU9lxz7oEMlv0VmRro3uk6hIf/ncUt2uYRGyhsuX4Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708540500; c=relaxed/simple; bh=tmZdQU9N4IY5BcwLubSQEg1Rug6tt9UVDfRrfuekMhA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=M4BvvYpq4mkh34oOIzCvtHjXlZtVdKcc50juZfDl6paVDeX6NgUHVCSIFqQ1WFw1VuYsC2PXDOBp2QOM4m6L85IeEC80iPdTBOAuS/Bp5dLghq9si4SjQ0jh8p+XYeIox7zwtb9GiZaWkMx0pEWDF6mfxp13oP6li0SZBeHSNkA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=jejBQQc+; arc=none smtp.client-ip=192.198.163.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1708540499; x=1740076499; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=tmZdQU9N4IY5BcwLubSQEg1Rug6tt9UVDfRrfuekMhA=; b=jejBQQc+bdmjIFcC479yeWf2YNHhg3ycWun96tcRPFZHvxe/O8NS2CIW GjBKto4qcvqP33GwJH539Z9dKb0CNJqqPCSPTYtTbcV58LVzfKT0Uk089 g7rhTFfAcy84Lg2rjdvyBMCXUYCKXUeEvvxB8VTOkLAwOX8tSDai84NHz pt/qtI2tcTh42m6P2TOyxB1jPtk9O7+cTlxr3xfJCrMAP66KEnRC+6XvH z4GV36kHH39ow31JUem0bVAR9sq0B3/akB/KDP4+NYY84NA4z+s485xnf 5Ss8R8igWb25kMnNGlFNDYgjWdk1ToDuYypqIKFF6EXtdDizjgKToy2Bm Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10991"; a="28164731" X-IronPort-AV: E=Sophos;i="6.06,176,1705392000"; d="scan'208";a="28164731" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmvoesa101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Feb 2024 10:34:55 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10991"; a="936684742" X-IronPort-AV: E=Sophos;i="6.06,176,1705392000"; d="scan'208";a="936684742" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga001.fm.intel.com with ESMTP; 21 Feb 2024 10:34:48 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id CCD9C34C; Wed, 21 Feb 2024 20:34:46 +0200 (EET) From: Andy Shevchenko <andriy.shevchenko@linux.intel.com> To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Andy Shevchenko <andriy.shevchenko@linux.intel.com>, Thomas Gleixner <tglx@linutronix.de>, linux-kernel@vger.kernel.org, linux-serial@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-aspeed@lists.ozlabs.org, linux-rpi-kernel@lists.infradead.org, linux-mips@vger.kernel.org, linux-tegra@vger.kernel.org Cc: Jiri Slaby <jirislaby@kernel.org>, Joel Stanley <joel@jms.id.au>, Andrew Jeffery <andrew@codeconstruct.com.au>, Florian Fainelli <florian.fainelli@broadcom.com>, Ray Jui <rjui@broadcom.com>, Scott Branden <sbranden@broadcom.com>, Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>, Al Cooper <alcooperx@gmail.com>, =?utf-8?q?Ilpo_J=C3=A4rvinen?= <ilpo.jarvinen@linux.intel.com>, Paul Cercueil <paul@crapouillou.net>, Vladimir Zapolskiy <vz@mleia.com>, Thierry Reding <thierry.reding@gmail.com>, Jonathan Hunter <jonathanh@nvidia.com>, Kunihiko Hayashi <hayashi.kunihiko@socionext.com>, Masami Hiramatsu <mhiramat@kernel.org> Subject: [PATCH v1 02/14] serial: core: Add UPIO_UNSET constant for unset port type Date: Wed, 21 Feb 2024 20:31:18 +0200 Message-ID: <20240221183442.4124354-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20240221183442.4124354-1-andriy.shevchenko@linux.intel.com> References: <20240221183442.4124354-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791535997088642468 X-GMAIL-MSGID: 1791538381183237861 |
Series |
serial: Add a helper to parse device properties and more
|
|
Commit Message
Andy Shevchenko
Feb. 21, 2024, 6:31 p.m. UTC
In some APIs we would like to assign the special value to iotype
and compare against it in another places. Introduce UPIO_UNSET
for this purpose.
Note, we can't use 0, because it's a valid value for IO port access.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
include/linux/serial_core.h | 1 +
1 file changed, 1 insertion(+)
Comments
On 21. 02. 24, 19:31, Andy Shevchenko wrote: > In some APIs we would like to assign the special value to iotype > and compare against it in another places. Introduce UPIO_UNSET > for this purpose. > > Note, we can't use 0, because it's a valid value for IO port access. > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > --- > include/linux/serial_core.h | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h > index 2d2ec99eca93..2b0526ae1fac 100644 > --- a/include/linux/serial_core.h > +++ b/include/linux/serial_core.h > @@ -470,6 +470,7 @@ struct uart_port { > > unsigned char iotype; /* io access style */ > > +#define UPIO_UNSET ((unsigned char)~0U) /* UCHAR_MAX */ Perhaps making the var u8 and this U8_MAX then? It would make more sense to me. > #define UPIO_PORT (SERIAL_IO_PORT) /* 8b I/O port access */ > #define UPIO_HUB6 (SERIAL_IO_HUB6) /* Hub6 ISA card */ > #define UPIO_MEM (SERIAL_IO_MEM) /* driver-specific */ thanks,
On Thu, Feb 22, 2024 at 07:58:32AM +0100, Jiri Slaby wrote: > On 21. 02. 24, 19:31, Andy Shevchenko wrote: .. > > unsigned char iotype; /* io access style */ > > +#define UPIO_UNSET ((unsigned char)~0U) /* UCHAR_MAX */ > > Perhaps making the var u8 and this U8_MAX then? It would make more sense to > me. WFM, should it be a separate change? Btw, how can I justify it?
On 22. 02. 24, 14:21, Andy Shevchenko wrote: > On Thu, Feb 22, 2024 at 07:58:32AM +0100, Jiri Slaby wrote: >> On 21. 02. 24, 19:31, Andy Shevchenko wrote: > > ... > >>> unsigned char iotype; /* io access style */ >>> +#define UPIO_UNSET ((unsigned char)~0U) /* UCHAR_MAX */ >> >> Perhaps making the var u8 and this U8_MAX then? It would make more sense to >> me. > > WFM, should it be a separate change? Likely. > Btw, how can I justify it? Hmm, thinking about it, why is it not an enum? But it could be also an u8 because you want it be exactly 8 bits as you want to be sure values up to 255 fit. thanks,
On Fri, Feb 23, 2024 at 06:42:15AM +0100, Jiri Slaby wrote: > On 22. 02. 24, 14:21, Andy Shevchenko wrote: > > On Thu, Feb 22, 2024 at 07:58:32AM +0100, Jiri Slaby wrote: > > > On 21. 02. 24, 19:31, Andy Shevchenko wrote: .. > > > > unsigned char iotype; /* io access style */ > > > > +#define UPIO_UNSET ((unsigned char)~0U) /* UCHAR_MAX */ > > > > > > Perhaps making the var u8 and this U8_MAX then? It would make more sense to > > > me. > > > > WFM, should it be a separate change? > > Likely. Then I need a commit message, because I'm unable to justify this change myself. > > Btw, how can I justify it? > > Hmm, thinking about it, why is it not an enum? Maybe, but it is a replica of UAPI definitions, do we want to see it as a enum? To me it will be a bit ugly looking. > But it could be also an u8 because you want it be exactly 8 bits as you want > to be sure values up to 255 fit. Depends on what we assume UAPI does with those flags. It maybe even less than 8 bits, or great than, currently 8 bits is enough... TL;DR: I would rather take a patch from you and incorporate into the series than trying hard to invent a justification and proper type.
On Fri, Feb 23, 2024 at 04:59:25PM +0200, Andy Shevchenko wrote: > On Fri, Feb 23, 2024 at 06:42:15AM +0100, Jiri Slaby wrote: > > On 22. 02. 24, 14:21, Andy Shevchenko wrote: > > > On Thu, Feb 22, 2024 at 07:58:32AM +0100, Jiri Slaby wrote: > > > > On 21. 02. 24, 19:31, Andy Shevchenko wrote: .. > > > > > unsigned char iotype; /* io access style */ > > > > > +#define UPIO_UNSET ((unsigned char)~0U) /* UCHAR_MAX */ > > > > > > > > Perhaps making the var u8 and this U8_MAX then? It would make more sense to > > > > me. > > > > > > WFM, should it be a separate change? > > > > Likely. > > Then I need a commit message, because I'm unable to justify this change myself. > > > > Btw, how can I justify it? > > > > Hmm, thinking about it, why is it not an enum? > > Maybe, but it is a replica of UAPI definitions, do we want to see it as a enum? > To me it will be a bit ugly looking. > > > But it could be also an u8 because you want it be exactly 8 bits as you want > > to be sure values up to 255 fit. > > Depends on what we assume UAPI does with those flags. It maybe even less than > 8 bits, or great than, currently 8 bits is enough... > > TL;DR: I would rather take a patch from you and incorporate into the series > than trying hard to invent a justification and proper type. Okay, I want to send a new version, for now I leave the type change for the next time. It looks that quirks as well will benefit from type clarifying.
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h index 2d2ec99eca93..2b0526ae1fac 100644 --- a/include/linux/serial_core.h +++ b/include/linux/serial_core.h @@ -470,6 +470,7 @@ struct uart_port { unsigned char iotype; /* io access style */ +#define UPIO_UNSET ((unsigned char)~0U) /* UCHAR_MAX */ #define UPIO_PORT (SERIAL_IO_PORT) /* 8b I/O port access */ #define UPIO_HUB6 (SERIAL_IO_HUB6) /* Hub6 ISA card */ #define UPIO_MEM (SERIAL_IO_MEM) /* driver-specific */