From patchwork Mon Dec 4 15:56:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 750227 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="bkMbRs1U" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4FA783; Mon, 4 Dec 2023 08:02:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1701705747; x=1733241747; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=369hT2RdaeQdkkRIYwcHHDkywQmjX9HmaXJZaM+vdg4=; b=bkMbRs1UH2vRg8FNuswtjS7nggOZIIhSmU88yvQb1FJWVKqmdl6MbtWx 1wLgXNTELjyJFfouBmEybAmRfjYi3BbvyZkkLYdJx/NVSqbSB1HuNrVAl CI0QsCfr7zwhK9V1rwFlR3KQ3NwQHkxZfpfUAYuhYe2Xci5iEHVHpFiAQ Bk1YibZWI2zRvv3bvwtM3vvuncwyjDuUUgFtm5QAmgIAC+OTnhHPbR98s weWRjGeE7ETn3M4LPbCkcJLMhtKdszEzivYV9zdFCwXOwLvXeqGqzX3xL lYLpJbufsZL0F/C5wNVVv5sK9pPO8JyDnXMpzbtiO/1s8xrFCWXXtiiUW w==; X-IronPort-AV: E=McAfee;i="6600,9927,10914"; a="807859" X-IronPort-AV: E=Sophos;i="6.04,250,1695711600"; d="scan'208";a="807859" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Dec 2023 08:00:48 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10914"; a="774297197" X-IronPort-AV: E=Sophos;i="6.04,250,1695711600"; d="scan'208";a="774297197" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga007.fm.intel.com with ESMTP; 04 Dec 2023 08:00:44 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 02DB6315; Mon, 4 Dec 2023 18:00:42 +0200 (EET) From: Andy Shevchenko To: Linus Walleij , Andy Shevchenko , =?utf-8?q?Jonathan_Neu?= =?utf-8?q?sch=C3=A4fer?= , Geert Uytterhoeven , Claudiu Beznea , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, openbmc@lists.ozlabs.org, linux-renesas-soc@vger.kernel.org Cc: Lakshmi Sowjanya D Subject: [PATCH v1 1/5] pinctrl: renesas: Mark local variable with const in ->set_mux() Date: Mon, 4 Dec 2023 17:56:32 +0200 Message-ID: <20231204160033.1872569-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20231204160033.1872569-1-andriy.shevchenko@linux.intel.com> References: <20231204160033.1872569-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 We are not going to change pins in the ->set_mux() callback. Mark the local variable with a const qualifier. While at it, make it also unsigned. Signed-off-by: Andy Shevchenko Reviewed-by: Geert Uytterhoeven Acked-by: Geert Uytterhoeven --- drivers/pinctrl/renesas/pinctrl-rzg2l.c | 2 +- drivers/pinctrl/renesas/pinctrl-rzv2m.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pinctrl/renesas/pinctrl-rzg2l.c b/drivers/pinctrl/renesas/pinctrl-rzg2l.c index aed59c53207c..68fcc2a4efbc 100644 --- a/drivers/pinctrl/renesas/pinctrl-rzg2l.c +++ b/drivers/pinctrl/renesas/pinctrl-rzg2l.c @@ -273,7 +273,7 @@ static int rzg2l_pinctrl_set_mux(struct pinctrl_dev *pctldev, struct function_desc *func; unsigned int i, *psel_val; struct group_desc *group; - int *pins; + const unsigned int *pins; func = pinmux_generic_get_function(pctldev, func_selector); if (!func) diff --git a/drivers/pinctrl/renesas/pinctrl-rzv2m.c b/drivers/pinctrl/renesas/pinctrl-rzv2m.c index 21d7d5ac8c4a..eb304fab1796 100644 --- a/drivers/pinctrl/renesas/pinctrl-rzv2m.c +++ b/drivers/pinctrl/renesas/pinctrl-rzv2m.c @@ -165,7 +165,7 @@ static int rzv2m_pinctrl_set_mux(struct pinctrl_dev *pctldev, struct function_desc *func; unsigned int i, *psel_val; struct group_desc *group; - int *pins; + const unsigned int *pins; func = pinmux_generic_get_function(pctldev, func_selector); if (!func) From patchwork Mon Dec 4 15:56:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 750803 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="gJjqFwHl" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7DF72A9; Mon, 4 Dec 2023 08:02:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1701705748; x=1733241748; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=I3BxyR7sGYM/0yoNVJh1VwzK7MSxRwGnKpjvhvZzSkE=; b=gJjqFwHlqW1DPVy5a54rdpIWspG20IXzaRPjaJxLlfeUKcyMlsisig3a LNkl8KO5UWMVSL7LZghoKuyzNazzrzl6U6o4HYDGBieCj4oqo7WjW7e2v 5CQju1Z9xm5WvEyghdtjUhV5FmgyBkspk3FoGoGa7cSSUTvxBtRg4GtQR jLRcrpUF+Kcld69mBARMwDYZlX08lzPwE8mz6en9UhDHNV2gDZeqDJCpH hUErF65uwU5OrNn/brEYnuBIjP0kF+w1or3BCmTYes5TwsJWHWTUAV5WW H9eaXBsFmWADdR0N6JJ6m1Y++TR4E9NbUG+Nx78OdjteS/PPMG1VXaKsc Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10914"; a="807872" X-IronPort-AV: E=Sophos;i="6.04,250,1695711600"; d="scan'208";a="807872" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Dec 2023 08:00:48 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10914"; a="774297196" X-IronPort-AV: E=Sophos;i="6.04,250,1695711600"; d="scan'208";a="774297196" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga007.fm.intel.com with ESMTP; 04 Dec 2023 08:00:44 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 12746881; Mon, 4 Dec 2023 18:00:43 +0200 (EET) From: Andy Shevchenko To: Linus Walleij , Andy Shevchenko , =?utf-8?q?Jonathan_Neu?= =?utf-8?q?sch=C3=A4fer?= , Geert Uytterhoeven , Claudiu Beznea , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, openbmc@lists.ozlabs.org, linux-renesas-soc@vger.kernel.org Cc: Lakshmi Sowjanya D Subject: [PATCH v1 2/5] pinctrl: core: Make pins const unsigned int pointer in struct group_desc Date: Mon, 4 Dec 2023 17:56:33 +0200 Message-ID: <20231204160033.1872569-3-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20231204160033.1872569-1-andriy.shevchenko@linux.intel.com> References: <20231204160033.1872569-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 It's unclear why it's not a const unsigned int pointer from day 1. Make the pins member const unsigned int pointer in struct group_desc. Update necessary APIs. Reviewed-by: Geert Uytterhoeven Signed-off-by: Andy Shevchenko --- drivers/pinctrl/core.c | 2 +- drivers/pinctrl/core.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c index 12daf0bb091e..6380e1fa6509 100644 --- a/drivers/pinctrl/core.c +++ b/drivers/pinctrl/core.c @@ -640,7 +640,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 unsigned 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 8b59dd72e4ff..8ef4b536bca5 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 unsigned 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 unsigned int *pins, int num_pins, void *data); int pinctrl_generic_remove_group(struct pinctrl_dev *pctldev, unsigned int group_selector); From patchwork Mon Dec 4 15:56:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 750802 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="FX/2i/Ez" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0D028B0; Mon, 4 Dec 2023 08:02:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1701705748; x=1733241748; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=GcznTEzkYh7381dOAmLl/g2Ovk3HvI9vfBlGPtxsvN8=; b=FX/2i/Ez9IbgsV8Yf5CSEMiC7/34GX7vzuVhkCNJcdqPIK/in3QnCzh8 +JEjSsYh5Axz1NJovaBYo0IFzi9qEFZQiL+r+rS00fSBmH0sId1TFQ7xV 5vnLffRXvnt4Epki25rUGKOa6DN63xMYnyz4ShVZvLE/dmtlA+eZLjb75 gL0aJ0w+IPSPMreEKV/S968+YQQOb0QIbL+EUe55qiDHRRDRmiv8bBZxv KTqDFtEtB/oWgS4cZcn9Z18gQd1aNOrQTZ3W7pFlIj6m4OjKHnj7/m7Ol sn7ICVU2oCzVTrTY28kybGW6jt6PCAXs7/pJR5s9o0is3ZtT8ZDgU3WiQ Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10914"; a="807882" X-IronPort-AV: E=Sophos;i="6.04,250,1695711600"; d="scan'208";a="807882" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Dec 2023 08:00:48 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10914"; a="774297204" X-IronPort-AV: E=Sophos;i="6.04,250,1695711600"; d="scan'208";a="774297204" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga007.fm.intel.com with ESMTP; 04 Dec 2023 08:00:44 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 1DF2FA02; Mon, 4 Dec 2023 18:00:43 +0200 (EET) From: Andy Shevchenko To: Linus Walleij , Andy Shevchenko , =?utf-8?q?Jonathan_Neu?= =?utf-8?q?sch=C3=A4fer?= , Geert Uytterhoeven , Claudiu Beznea , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, openbmc@lists.ozlabs.org, linux-renesas-soc@vger.kernel.org Cc: Lakshmi Sowjanya D Subject: [PATCH v1 3/5] pinctrl: equilibrium: Convert to use struct pingroup Date: Mon, 4 Dec 2023 17:56:34 +0200 Message-ID: <20231204160033.1872569-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20231204160033.1872569-1-andriy.shevchenko@linux.intel.com> References: <20231204160033.1872569-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The pin control header provides struct pingroup. Utilize it instead of open coded variants in the driver. Signed-off-by: Andy Shevchenko --- drivers/pinctrl/pinctrl-equilibrium.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/drivers/pinctrl/pinctrl-equilibrium.c b/drivers/pinctrl/pinctrl-equilibrium.c index fd59cfdeefac..4ebae516d1b1 100644 --- a/drivers/pinctrl/pinctrl-equilibrium.c +++ b/drivers/pinctrl/pinctrl-equilibrium.c @@ -705,7 +705,7 @@ static int eqbr_build_groups(struct eqbr_pinctrl_drv_data *drvdata) struct device *dev = drvdata->dev; struct device_node *node = dev->of_node; unsigned int *pins, *pinmux, pin_id, pinmux_id; - struct group_desc group; + struct pingroup group, *grp = &group; struct device_node *np; struct property *prop; int j, err; @@ -721,49 +721,49 @@ static int eqbr_build_groups(struct eqbr_pinctrl_drv_data *drvdata) of_node_put(np); return err; } - group.num_pins = err; - group.name = prop->value; - pins = devm_kcalloc(dev, group.num_pins, sizeof(*pins), GFP_KERNEL); + grp->npins = err; + grp->name = prop->value; + pins = devm_kcalloc(dev, grp->npins, sizeof(*pins), GFP_KERNEL); if (!pins) { of_node_put(np); return -ENOMEM; } - group.pins = pins; + grp->pins = pins; - pinmux = devm_kcalloc(dev, group.num_pins, sizeof(*pinmux), GFP_KERNEL); + pinmux = devm_kcalloc(dev, grp->npins, sizeof(*pinmux), GFP_KERNEL); if (!pinmux) { of_node_put(np); return -ENOMEM; } - for (j = 0; j < group.num_pins; j++) { + for (j = 0; j < grp->npins; j++) { if (of_property_read_u32_index(np, "pins", j, &pin_id)) { dev_err(dev, "Group %s: Read intel pins id failed\n", - group.name); + grp->name); of_node_put(np); return -EINVAL; } if (pin_id >= drvdata->pctl_desc.npins) { dev_err(dev, "Group %s: Invalid pin ID, idx: %d, pin %u\n", - group.name, j, pin_id); + grp->name, j, pin_id); of_node_put(np); return -EINVAL; } pins[j] = pin_id; if (of_property_read_u32_index(np, "pinmux", j, &pinmux_id)) { dev_err(dev, "Group %s: Read intel pinmux id failed\n", - group.name); + grp->name); of_node_put(np); return -EINVAL; } pinmux[j] = pinmux_id; } - err = pinctrl_generic_add_group(drvdata->pctl_dev, group.name, - group.pins, group.num_pins, + err = pinctrl_generic_add_group(drvdata->pctl_dev, + grp->name, grp->pins, grp->npins, pinmux); if (err < 0) { - dev_err(dev, "Failed to register group %s\n", group.name); + dev_err(dev, "Failed to register group %s\n", grp->name); of_node_put(np); return err; } From patchwork Mon Dec 4 15:56:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 750226 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="i6g/bhyr" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0913E83; Mon, 4 Dec 2023 08:02:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1701705750; x=1733241750; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=mX8nkFa+pUFM3JtjtNpLHJ2j2h/kDkAZjOuxZ+/LWq0=; b=i6g/bhyr6pd+nzjHfyVPWB8XrkdeQRJousy5sE7zljg8cznKg8y9U+qO +ge8Ax7hTVyEGSNtqRB8kyPZHZUNBGcSJ3uUiHJbKreLHYaoGk0W3d4pC DdpPMjLWixp7CX085SVwJDa69VwmAtUek5I9HXkL7Vgjk4Ifq+jW8OSGY mNqRZlqInyhBIAI1VNU7UaRLrGEluwbtTWoAsDlXWZAE8tS+O+dU4V/tf 2R6CaCEjA5FjaBmS77jJxaK9408yWhIwfBWtW1H5LUpLnb2GjByD6TWhN TR6e3cR2FfLRgL2FICpSt+0vqAgFNda/uDDCkLKvt4lJMSOvwV4EjOHXa g==; X-IronPort-AV: E=McAfee;i="6600,9927,10914"; a="807884" X-IronPort-AV: E=Sophos;i="6.04,250,1695711600"; d="scan'208";a="807884" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orvoesa104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Dec 2023 08:00:49 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10914"; a="774297203" X-IronPort-AV: E=Sophos;i="6.04,250,1695711600"; d="scan'208";a="774297203" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga007.fm.intel.com with ESMTP; 04 Dec 2023 08:00:44 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 2D122A5F; Mon, 4 Dec 2023 18:00:43 +0200 (EET) From: Andy Shevchenko To: Linus Walleij , Andy Shevchenko , =?utf-8?q?Jonathan_Neu?= =?utf-8?q?sch=C3=A4fer?= , Geert Uytterhoeven , Claudiu Beznea , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, openbmc@lists.ozlabs.org, linux-renesas-soc@vger.kernel.org Cc: Lakshmi Sowjanya D Subject: [PATCH v1 4/5] pinctrl: keembay: Convert to use struct pingroup Date: Mon, 4 Dec 2023 17:56:35 +0200 Message-ID: <20231204160033.1872569-5-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20231204160033.1872569-1-andriy.shevchenko@linux.intel.com> References: <20231204160033.1872569-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The pin control header provides struct pingroup. Utilize it instead of open coded variants in the driver. Signed-off-by: Andy Shevchenko --- drivers/pinctrl/pinctrl-keembay.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pinctrl/pinctrl-keembay.c b/drivers/pinctrl/pinctrl-keembay.c index 152c35bce8ec..87d328853ae4 100644 --- a/drivers/pinctrl/pinctrl-keembay.c +++ b/drivers/pinctrl/pinctrl-keembay.c @@ -1517,7 +1517,7 @@ static int keembay_gpiochip_probe(struct keembay_pinctrl *kpc, static int keembay_build_groups(struct keembay_pinctrl *kpc) { - struct group_desc *grp; + struct pingroup *grp; unsigned int i; kpc->ngroups = kpc->npins; @@ -1528,7 +1528,7 @@ static int keembay_build_groups(struct keembay_pinctrl *kpc) /* Each pin is categorised as one group */ for (i = 0; i < kpc->ngroups; i++) { const struct pinctrl_pin_desc *pdesc = keembay_pins + i; - struct group_desc *kmb_grp = grp + i; + struct pingroup *kmb_grp = grp + i; kmb_grp->name = pdesc->name; kmb_grp->pins = (int *)&pdesc->number; From patchwork Mon Dec 4 15:56:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 750225 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="nJ/puh3Y" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2BA26A9; Mon, 4 Dec 2023 08:08:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1701706082; x=1733242082; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=CyMweha2ZvuLisSoPmNJvwBvM8UVF+24ES7V+e13w7A=; b=nJ/puh3YkMMr4ow4roTP8fCrGxx42pg87in85xDgYJvB1y7Fo6YvlfMY OcV83eHYNa08727X6W0hqakN8VMXMRtLmXdt2nI7LeCrUW6QAb8AUTgWY dUMxRDPuRiRtWvAK0sPRpEfT1lB8bTbeKjiAZCTzm+mXPjhgzcZsoFPEw acwteRsmb+IjskBk9M3z5VWGUb/x9BdNELRpdug3hCRR3sX+kvNuI+SQ5 p3cFXC/9gXbmKcKn+T7sNrO2TlCrBKmFYBdZ++VZorXumfPjcLe/3P5hW Sf0X/iMaMIUqE8K+ys4ZQwcTJ6ThA7DLG3r3XjtWseqVaK1KhswL2LkD3 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10914"; a="632533" X-IronPort-AV: E=Sophos;i="6.04,250,1695711600"; d="scan'208";a="632533" Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Dec 2023 08:08:01 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10914"; a="861422786" X-IronPort-AV: E=Sophos;i="6.04,250,1695711600"; d="scan'208";a="861422786" Received: from black.fi.intel.com ([10.237.72.28]) by FMSMGA003.fm.intel.com with ESMTP; 04 Dec 2023 08:07:57 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id 3C299A7D; Mon, 4 Dec 2023 18:00:43 +0200 (EET) From: Andy Shevchenko To: Linus Walleij , Andy Shevchenko , =?utf-8?q?Jonathan_Neu?= =?utf-8?q?sch=C3=A4fer?= , Geert Uytterhoeven , Claudiu Beznea , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, openbmc@lists.ozlabs.org, linux-renesas-soc@vger.kernel.org Cc: Lakshmi Sowjanya D Subject: [PATCH v1 5/5] pinctrl: nuvoton: Convert to use struct pingroup and PINCTRL_PINGROUP() Date: Mon, 4 Dec 2023 17:56:36 +0200 Message-ID: <20231204160033.1872569-6-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1.gbec44491f096 In-Reply-To: <20231204160033.1872569-1-andriy.shevchenko@linux.intel.com> References: <20231204160033.1872569-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-gpio@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The pin control header provides struct pingroup and PINCTRL_PINGROUP() macro. Utilize them instead of open coded variants in the driver. Reviewed-by: Jonathan Neuschäfer Signed-off-by: Andy Shevchenko --- drivers/pinctrl/nuvoton/pinctrl-wpcm450.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c b/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c index 0cff44b07b29..4589900244c7 100644 --- a/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c +++ b/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c @@ -474,9 +474,8 @@ enum { #undef WPCM450_GRP }; -static struct group_desc wpcm450_groups[] = { -#define WPCM450_GRP(x) { .name = #x, .pins = x ## _pins, \ - .num_pins = ARRAY_SIZE(x ## _pins) } +static struct pingroup wpcm450_groups[] = { +#define WPCM450_GRP(x) PINCTRL_PINGROUP(#x, x ## _pins, ARRAY_SIZE(x ## _pins)) WPCM450_GRPS #undef WPCM450_GRP }; @@ -852,7 +851,7 @@ static int wpcm450_get_group_pins(struct pinctrl_dev *pctldev, const unsigned int **pins, unsigned int *npins) { - *npins = wpcm450_groups[selector].num_pins; + *npins = wpcm450_groups[selector].npins; *pins = wpcm450_groups[selector].pins; return 0; @@ -901,7 +900,7 @@ static int wpcm450_pinmux_set_mux(struct pinctrl_dev *pctldev, struct wpcm450_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev); wpcm450_setfunc(pctrl->gcr_regmap, wpcm450_groups[group].pins, - wpcm450_groups[group].num_pins, function); + wpcm450_groups[group].npins, function); return 0; }