Message ID | 20231128200155.438722-7-andriy.shevchenko@linux.intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp4192918vqx; Tue, 28 Nov 2023 12:04:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IEU0NXloiAPk52Jz7f5qbaHJR7imzeKGWVpkTAYrfEW/nqQacMTDTe8LK1+Q6IoqSa75Ciy X-Received: by 2002:a17:902:c40a:b0:1cf:aff5:8934 with SMTP id k10-20020a170902c40a00b001cfaff58934mr15183712plk.48.1701201887108; Tue, 28 Nov 2023 12:04:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701201887; cv=none; d=google.com; s=arc-20160816; b=hJWZ9bVwWMji5KrS9NFi2OVZ+bFdNj1BiZuVUW4rZoCQl4hsyR1emG35sqYoBu5ii2 nrk1N5NnN8VPjYvNAg3/p5tOUgD1lAKAM0vnPSli4IBYzyx/BkBHOWvnYKuzQrGiHAS0 95JduGDfnsDBKyim6yLp4Uamww1mVjQjF7YzWuzz0UCr8BmZdhgtzaHlNGF2WzEoGzGa eyDhzQKs+UZIbTbdKpSD5nbJkPH4T9ng9Ks/KtPl9Q3SQsXGr2ox/7wp5sCDiq694GP7 elzMcjrniNUbTVy6rwagdINFcZ0ParJAjeNj4P6OwWVal/g3HCz07XnHgLCwmiBbzkrv bXwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=L3xjyb4iAiIdZ6TSPrml4isCXpTYsj/Ts2N2sf7raSs=; fh=o6/j60XBkz0cs1N8PQkcSMZ4tgCM5mUF5G/ULMywbv8=; b=jZ7WAbK9EfQUm9LILUBSY5tPTmT7kOOLJJs3VAZ2akx4MLTT78Bf2k7VdXT1xshwho 1ZYA5Xu4TtxcEC41hgquELOrO/b5bzQivM6QODHWyzv3+ip6Lo5rIvs0lLEP18plUSUz qOntHt981T6ZSZfzpvZrJahcWAv40DnxtyGDJGWuJ+IYaWnZvpfXjImslu/iRN/CaQ2h /slQxoxFmpSbLty5P+C2+EGo1yBFIeSzayedHMNTviV1vn2Jc5Fw4xHT7e4P2G2QqcX2 9SlootZdiHcnHOn+NsQeoyA5IjwE6wOyqTy4GJmaUTOAAP+92G1NI0ILf80Z2YhVGfZP 5O8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=dKG3eci0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id bc3-20020a170902930300b001cfc4194cb7si6190106plb.634.2023.11.28.12.04.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Nov 2023 12:04:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=dKG3eci0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 2A16F80AE526; Tue, 28 Nov 2023 12:04:30 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344947AbjK1UER (ORCPT <rfc822;toshivichauhan@gmail.com> + 99 others); Tue, 28 Nov 2023 15:04:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44810 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344974AbjK1UEL (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 28 Nov 2023 15:04:11 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.8]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2CE11BC1; Tue, 28 Nov 2023 12:04:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1701201858; x=1732737858; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=JWDRh374Weqf1RM/wPs/cLPeGRfYhQLZdPEPrnsQ9gU=; b=dKG3eci0PdtkrudTqQLRCDTGLKeLV5tWEho1QLX0lO86cmWs8sQCQ4X5 qMm1253GjFeEfKa1YUreIEt3vl3nWF1wSPLTexl6QVQZvs8WZ1l1ppqKX 3UOnvGiJjIf4Xd1jT871OQ82yFtG5Zi3QmcXGCrK17j+HFJhl93Zos9+f zuLLByNkLe4yzwvZKGtH2e3LuX5l46tPI6BMTbnvIr3g3UCYLEU5ERteb Kau0V4Kuf6sqQRT5jdRvn/YaSJsPPiLsZ4wFmUt7SPTqkktitGnNk6HoX XS4kF8gYeYXRglY1pl6ua0H4EANOnLACGhf+1lFK+C7SwcKhv47QiNqID w==; X-IronPort-AV: E=McAfee;i="6600,9927,10908"; a="6217723" X-IronPort-AV: E=Sophos;i="6.04,234,1695711600"; d="scan'208";a="6217723" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmvoesa102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 28 Nov 2023 12:02:18 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10908"; a="797687941" X-IronPort-AV: E=Sophos;i="6.04,234,1695711600"; d="scan'208";a="797687941" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga008.jf.intel.com with ESMTP; 28 Nov 2023 12:02:08 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 2835BA5F; Tue, 28 Nov 2023 22:01:58 +0200 (EET) From: Andy Shevchenko <andriy.shevchenko@linux.intel.com> To: Linus Walleij <linus.walleij@linaro.org>, Bartosz Golaszewski <bartosz.golaszewski@linaro.org>, Andy Shevchenko <andriy.shevchenko@linux.intel.com>, Rasmus Villemoes <linux@rasmusvillemoes.dk>, =?utf-8?q?Jonathan_Neusch?= =?utf-8?q?=C3=A4fer?= <j.neuschaefer@gmx.net>, Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>, =?utf-8?q?Uwe_Kleine-?= =?utf-8?q?K=C3=B6nig?= <u.kleine-koenig@pengutronix.de>, Geert Uytterhoeven <geert+renesas@glider.be>, Biju Das <biju.das.jz@bp.renesas.com>, Claudiu Beznea <claudiu.beznea.uj@bp.renesas.com>, Jianlong Huang <jianlong.huang@starfivetech.com>, linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, openbmc@lists.ozlabs.org, linux-mips@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-renesas-soc@vger.kernel.org Cc: Ray Jui <rjui@broadcom.com>, Scott Branden <sbranden@broadcom.com>, Broadcom internal kernel review list <bcm-kernel-feedback-list@broadcom.com>, Dong Aisheng <aisheng.dong@nxp.com>, Fabio Estevam <festevam@gmail.com>, Shawn Guo <shawnguo@kernel.org>, Jacky Bai <ping.bai@nxp.com>, Pengutronix Kernel Team <kernel@pengutronix.de>, Sascha Hauer <s.hauer@pengutronix.de>, NXP Linux Team <linux-imx@nxp.com>, Sean Wang <sean.wang@kernel.org>, Paul Cercueil <paul@crapouillou.net>, Lakshmi Sowjanya D <lakshmi.sowjanya.d@intel.com>, Andy Gross <agross@kernel.org>, Bjorn Andersson <andersson@kernel.org>, Konrad Dybcio <konrad.dybcio@linaro.org>, Emil Renner Berthing <kernel@esmil.dk>, Hal Feng <hal.feng@starfivetech.com> Subject: [PATCH v3 06/22] pinctrl: core: Make pins const in struct group_desc Date: Tue, 28 Nov 2023 21:56:55 +0200 Message-ID: <20231128200155.438722-7-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20231128200155.438722-1-andriy.shevchenko@linux.intel.com> References: <20231128200155.438722-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Tue, 28 Nov 2023 12:04:30 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783839469973498821 X-GMAIL-MSGID: 1783839469973498821 |
Series |
pinctrl: Convert struct group_desc to use struct pingroup
|
|
Commit Message
Andy Shevchenko
Nov. 28, 2023, 7:56 p.m. UTC
It's unclear why it's not a const from day 1. Make the pins member
const in struct group_desc. Update necessary APIs.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/pinctrl/core.c | 2 +-
drivers/pinctrl/core.h | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
Comments
Hi Andy, On Tue, Nov 28, 2023 at 9:04 PM Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote: > It's unclear why it's not a const from day 1. Make the pins member > const in struct group_desc. Update necessary APIs. > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Thanks for your patch! > --- a/drivers/pinctrl/core.c > +++ b/drivers/pinctrl/core.c > @@ -642,7 +642,7 @@ static int pinctrl_generic_group_name_to_selector(struct pinctrl_dev *pctldev, > * Note that the caller must take care of locking. > */ > int pinctrl_generic_add_group(struct pinctrl_dev *pctldev, const char *name, > - int *pins, int num_pins, void *data) > + const int *pins, int num_pins, void *data) > { > struct group_desc *group; > int selector, error; > diff --git a/drivers/pinctrl/core.h b/drivers/pinctrl/core.h > index 530370443c19..01ea1ce99fe8 100644 > --- a/drivers/pinctrl/core.h > +++ b/drivers/pinctrl/core.h > @@ -203,7 +203,7 @@ struct pinctrl_maps { > */ > struct group_desc { > const char *name; > - int *pins; > + const int *pins; > int num_pins; > void *data; > }; > @@ -222,7 +222,7 @@ struct group_desc *pinctrl_generic_get_group(struct pinctrl_dev *pctldev, > unsigned int group_selector); > > int pinctrl_generic_add_group(struct pinctrl_dev *pctldev, const char *name, > - int *gpins, int ngpins, void *data); > + const int *pins, int num_pins, void *data); > > int pinctrl_generic_remove_group(struct pinctrl_dev *pctldev, > unsigned int group_selector); Probably this is also the right moment to change all of these to arrays of unsigned ints? Else you will have mixed int/unsigned int after "[PATCH v3 13/22] pinctrl: core: Embed struct pingroup into struct group_desc", and purely unsigned int after "[PATCH v3 22/22] pinctrl: core: Remove unused members from struct group_desc". The Renesas pinctrl drivers already pass arrays of unsigned ints. Some other drivers still use arrays of ints, though. Gr{oetje,eeting}s, Geert
On Wed, Nov 29, 2023 at 12:21:45PM +0100, Geert Uytterhoeven wrote: > On Tue, Nov 28, 2023 at 9:04 PM Andy Shevchenko > <andriy.shevchenko@linux.intel.com> wrote: > > It's unclear why it's not a const from day 1. Make the pins member > > const in struct group_desc. Update necessary APIs. ... > > int pinctrl_generic_add_group(struct pinctrl_dev *pctldev, const char *name, > > - int *gpins, int ngpins, void *data); > > + const int *pins, int num_pins, void *data); > > > > int pinctrl_generic_remove_group(struct pinctrl_dev *pctldev, > > unsigned int group_selector); > > Probably this is also the right moment to change all of these to arrays > of unsigned ints? Else you will have mixed int/unsigned int after > "[PATCH v3 13/22] pinctrl: core: Embed struct pingroup into struct > group_desc", and purely unsigned int after "[PATCH v3 22/22] pinctrl: > core: Remove unused members from struct group_desc". Hmm... Can it be done later? I can, of course try to change the parameter here to be unsigned, but it most likely fail the build for those drivers means need more patches, more delay to this series. Linus?
On Wed, Nov 29, 2023 at 03:41:55PM +0200, Andy Shevchenko wrote: > On Wed, Nov 29, 2023 at 12:21:45PM +0100, Geert Uytterhoeven wrote: > > On Tue, Nov 28, 2023 at 9:04 PM Andy Shevchenko > > <andriy.shevchenko@linux.intel.com> wrote: > > > It's unclear why it's not a const from day 1. Make the pins member > > > const in struct group_desc. Update necessary APIs. ... > > > int pinctrl_generic_add_group(struct pinctrl_dev *pctldev, const char *name, > > > - int *gpins, int ngpins, void *data); > > > + const int *pins, int num_pins, void *data); > > > > > > int pinctrl_generic_remove_group(struct pinctrl_dev *pctldev, > > > unsigned int group_selector); > > > > Probably this is also the right moment to change all of these to arrays > > of unsigned ints? Else you will have mixed int/unsigned int after > > "[PATCH v3 13/22] pinctrl: core: Embed struct pingroup into struct > > group_desc", and purely unsigned int after "[PATCH v3 22/22] pinctrl: > > core: Remove unused members from struct group_desc". > > Hmm... Can it be done later? > > I can, of course try to change the parameter here to be unsigned, but it most > likely fail the build for those drivers means need more patches, more delay to > this series. > > Linus? On the first glance updating API here does not fail the build. Lemme incorporate this into v4. Meanwhile the drivers I left untouched, it might be separate changes to convert from int to const unsigned int.
Hi Andy, On Wed, Nov 29, 2023 at 3:23 PM Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote: > On Wed, Nov 29, 2023 at 03:41:55PM +0200, Andy Shevchenko wrote: > > On Wed, Nov 29, 2023 at 12:21:45PM +0100, Geert Uytterhoeven wrote: > > > On Tue, Nov 28, 2023 at 9:04 PM Andy Shevchenko > > > <andriy.shevchenko@linux.intel.com> wrote: > > > > It's unclear why it's not a const from day 1. Make the pins member > > > > const in struct group_desc. Update necessary APIs. > > ... > > > > > int pinctrl_generic_add_group(struct pinctrl_dev *pctldev, const char *name, > > > > - int *gpins, int ngpins, void *data); > > > > + const int *pins, int num_pins, void *data); > > > > > > > > int pinctrl_generic_remove_group(struct pinctrl_dev *pctldev, > > > > unsigned int group_selector); > > > > > > Probably this is also the right moment to change all of these to arrays > > > of unsigned ints? Else you will have mixed int/unsigned int after > > > "[PATCH v3 13/22] pinctrl: core: Embed struct pingroup into struct > > > group_desc", and purely unsigned int after "[PATCH v3 22/22] pinctrl: > > > core: Remove unused members from struct group_desc". > > > > Hmm... Can it be done later? > > > > I can, of course try to change the parameter here to be unsigned, but it most > > likely fail the build for those drivers means need more patches, more delay to > > this series. > > > > Linus? > > On the first glance updating API here does not fail the build. That's what I had expected, as drivers already pass int or unsigned int arrays anyway. > Lemme incorporate this into v4. Thanks! > Meanwhile the drivers I left untouched, it might be separate changes > to convert from int to const unsigned int. Sounds fine to me. Gr{oetje,eeting}s, Geert
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c index f2977eb65522..d20e3aad923e 100644 --- a/drivers/pinctrl/core.c +++ b/drivers/pinctrl/core.c @@ -642,7 +642,7 @@ static int pinctrl_generic_group_name_to_selector(struct pinctrl_dev *pctldev, * Note that the caller must take care of locking. */ int pinctrl_generic_add_group(struct pinctrl_dev *pctldev, const char *name, - int *pins, int num_pins, void *data) + const int *pins, int num_pins, void *data) { struct group_desc *group; int selector, error; diff --git a/drivers/pinctrl/core.h b/drivers/pinctrl/core.h index 530370443c19..01ea1ce99fe8 100644 --- a/drivers/pinctrl/core.h +++ b/drivers/pinctrl/core.h @@ -203,7 +203,7 @@ struct pinctrl_maps { */ struct group_desc { const char *name; - int *pins; + const int *pins; int num_pins; void *data; }; @@ -222,7 +222,7 @@ struct group_desc *pinctrl_generic_get_group(struct pinctrl_dev *pctldev, unsigned int group_selector); int pinctrl_generic_add_group(struct pinctrl_dev *pctldev, const char *name, - int *gpins, int ngpins, void *data); + const int *pins, int num_pins, void *data); int pinctrl_generic_remove_group(struct pinctrl_dev *pctldev, unsigned int group_selector);