From: Paul Cercueil <paul@crapouillou.net>
To: Bartosz Golaszewski <brgl@bgdev.pl>,
Linus Walleij <linus.walleij@linaro.org>,
Bjorn Andersson <andersson@kernel.org>,
Konrad Dybcio <konradybcio@kernel.org>,
Alexey Klimov <alexey.klimov@linaro.org>,
Lorenzo Bianconi <lorenzo@kernel.org>,
Sean Wang <sean.wang@kernel.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
Kees Cook <kees@kernel.org>, Andy Shevchenko <andy@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
David Hildenbrand <david@redhat.com>,
Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
"Liam R. Howlett" <Liam.Howlett@oracle.com>,
Vlastimil Babka <vbabka@suse.cz>, Mike Rapoport <rppt@kernel.org>,
Suren Baghdasaryan <surenb@google.com>,
Michal Hocko <mhocko@suse.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>,
NXP S32 Linux Team <s32@nxp.com>,
Sascha Hauer <s.hauer@pengutronix.de>,
Tony Lindgren <tony@atomide.com>,
Haojian Zhuang <haojian.zhuang@linaro.org>,
Geert Uytterhoeven <geert+renesas@glider.be>
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-msm@vger.kernel.org,
linux-mediatek@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
linux-mips@vger.kernel.org, linux-hardening@vger.kernel.org,
linux-mm@kvack.org, imx@lists.linux.dev,
linux-omap@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Subject: Re: [PATCH v3 02/15] pinctrl: ingenic: use struct pinfunction instead of struct function_desc
Date: Wed, 30 Jul 2025 17:35:00 +0200 [thread overview]
Message-ID: <b254e3868cfca4785d9dfbd13d3cc8ad1f33b6db.camel@crapouillou.net> (raw)
In-Reply-To: <20250724-pinctrl-gpio-pinfuncs-v3-2-af4db9302de4@linaro.org>
Hi Bartosz,
Le jeudi 24 juillet 2025 à 11:24 +0200, Bartosz Golaszewski a écrit :
> From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
>
> struct function_desc is a wrapper around struct pinfunction with an
> additional void *data pointer. This driver doesn't use the data
> pointer.
> We're also working towards reducing the usage of struct function_desc
> in
> pinctrl drivers - they should only be created by pinmux core and
> accessed by drivers using pinmux_generic_get_function(). Replace the
> struct function_desc objects in this driver with smaller struct
> pinfunction instances.
>
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Acked-by: Paul Cercueil <paul@crapouillou.net>
Cheers,
-Paul
> ---
> drivers/pinctrl/pinctrl-ingenic.c | 45 +++++++++++++++++------------
> ----------
> 1 file changed, 20 insertions(+), 25 deletions(-)
>
> diff --git a/drivers/pinctrl/pinctrl-ingenic.c
> b/drivers/pinctrl/pinctrl-ingenic.c
> index
> 79119cf20efcf8cc701647d9ff979c2b71bf7589..0ee8554c5446c4167c9b0e6b939
> 7a2507ca57419 100644
> --- a/drivers/pinctrl/pinctrl-ingenic.c
> +++ b/drivers/pinctrl/pinctrl-ingenic.c
> @@ -96,11 +96,8 @@
> .data = (void
> *)func, \
> }
>
> -#define INGENIC_PIN_FUNCTION(_name_,
> id) \
> -
> { \
> - .func = PINCTRL_PINFUNCTION(_name_, id##_groups,
> ARRAY_SIZE(id##_groups)), \
> - .data =
> NULL, \
> - }
> +#define INGENIC_PIN_FUNCTION(_name_,
> id) \
> + PINCTRL_PINFUNCTION(_name_, id##_groups,
> ARRAY_SIZE(id##_groups))
>
> enum jz_version {
> ID_JZ4730,
> @@ -128,7 +125,7 @@ struct ingenic_chip_info {
> const struct group_desc *groups;
> unsigned int num_groups;
>
> - const struct function_desc *functions;
> + const struct pinfunction *functions;
> unsigned int num_functions;
>
> const u32 *pull_ups, *pull_downs;
> @@ -263,7 +260,7 @@ static const char *jz4730_pwm1_groups[] = {
> "pwm1", };
> static const char *jz4730_mii_groups[] = { "mii", };
> static const char *jz4730_i2s_groups[] = { "i2s-data", "i2s-master",
> "i2s-slave", };
>
> -static const struct function_desc jz4730_functions[] = {
> +static const struct pinfunction jz4730_functions[] = {
> INGENIC_PIN_FUNCTION("mmc", jz4730_mmc),
> INGENIC_PIN_FUNCTION("uart0", jz4730_uart0),
> INGENIC_PIN_FUNCTION("uart1", jz4730_uart1),
> @@ -370,7 +367,7 @@ static const char *jz4740_pwm5_groups[] = {
> "pwm5", };
> static const char *jz4740_pwm6_groups[] = { "pwm6", };
> static const char *jz4740_pwm7_groups[] = { "pwm7", };
>
> -static const struct function_desc jz4740_functions[] = {
> +static const struct pinfunction jz4740_functions[] = {
> INGENIC_PIN_FUNCTION("mmc", jz4740_mmc),
> INGENIC_PIN_FUNCTION("uart0", jz4740_uart0),
> INGENIC_PIN_FUNCTION("uart1", jz4740_uart1),
> @@ -474,7 +471,7 @@ static const char *jz4725b_pwm3_groups[] = {
> "pwm3", };
> static const char *jz4725b_pwm4_groups[] = { "pwm4", };
> static const char *jz4725b_pwm5_groups[] = { "pwm5", };
>
> -static const struct function_desc jz4725b_functions[] = {
> +static const struct pinfunction jz4725b_functions[] = {
> INGENIC_PIN_FUNCTION("mmc0", jz4725b_mmc0),
> INGENIC_PIN_FUNCTION("mmc1", jz4725b_mmc1),
> INGENIC_PIN_FUNCTION("uart", jz4725b_uart),
> @@ -606,7 +603,7 @@ static const char *jz4750_pwm3_groups[] = {
> "pwm3", };
> static const char *jz4750_pwm4_groups[] = { "pwm4", };
> static const char *jz4750_pwm5_groups[] = { "pwm5", };
>
> -static const struct function_desc jz4750_functions[] = {
> +static const struct pinfunction jz4750_functions[] = {
> INGENIC_PIN_FUNCTION("uart0", jz4750_uart0),
> INGENIC_PIN_FUNCTION("uart1", jz4750_uart1),
> INGENIC_PIN_FUNCTION("uart2", jz4750_uart2),
> @@ -771,7 +768,7 @@ static const char *jz4755_pwm3_groups[] = {
> "pwm3", };
> static const char *jz4755_pwm4_groups[] = { "pwm4", };
> static const char *jz4755_pwm5_groups[] = { "pwm5", };
>
> -static const struct function_desc jz4755_functions[] = {
> +static const struct pinfunction jz4755_functions[] = {
> INGENIC_PIN_FUNCTION("uart0", jz4755_uart0),
> INGENIC_PIN_FUNCTION("uart1", jz4755_uart1),
> INGENIC_PIN_FUNCTION("uart2", jz4755_uart2),
> @@ -1106,7 +1103,7 @@ static const char *jz4760_pwm6_groups[] = {
> "pwm6", };
> static const char *jz4760_pwm7_groups[] = { "pwm7", };
> static const char *jz4760_otg_groups[] = { "otg-vbus", };
>
> -static const struct function_desc jz4760_functions[] = {
> +static const struct pinfunction jz4760_functions[] = {
> INGENIC_PIN_FUNCTION("uart0", jz4760_uart0),
> INGENIC_PIN_FUNCTION("uart1", jz4760_uart1),
> INGENIC_PIN_FUNCTION("uart2", jz4760_uart2),
> @@ -1444,7 +1441,7 @@ static const char *jz4770_pwm6_groups[] = {
> "pwm6", };
> static const char *jz4770_pwm7_groups[] = { "pwm7", };
> static const char *jz4770_mac_groups[] = { "mac-rmii", "mac-mii", };
>
> -static const struct function_desc jz4770_functions[] = {
> +static const struct pinfunction jz4770_functions[] = {
> INGENIC_PIN_FUNCTION("uart0", jz4770_uart0),
> INGENIC_PIN_FUNCTION("uart1", jz4770_uart1),
> INGENIC_PIN_FUNCTION("uart2", jz4770_uart2),
> @@ -1723,7 +1720,7 @@ static const char *jz4775_mac_groups[] = {
> };
> static const char *jz4775_otg_groups[] = { "otg-vbus", };
>
> -static const struct function_desc jz4775_functions[] = {
> +static const struct pinfunction jz4775_functions[] = {
> INGENIC_PIN_FUNCTION("uart0", jz4775_uart0),
> INGENIC_PIN_FUNCTION("uart1", jz4775_uart1),
> INGENIC_PIN_FUNCTION("uart2", jz4775_uart2),
> @@ -1976,7 +1973,7 @@ static const char *jz4780_dmic_groups[] = {
> "dmic", };
> static const char *jz4780_cim_groups[] = { "cim-data", };
> static const char *jz4780_hdmi_ddc_groups[] = { "hdmi-ddc", };
>
> -static const struct function_desc jz4780_functions[] = {
> +static const struct pinfunction jz4780_functions[] = {
> INGENIC_PIN_FUNCTION("uart0", jz4770_uart0),
> INGENIC_PIN_FUNCTION("uart1", jz4770_uart1),
> INGENIC_PIN_FUNCTION("uart2", jz4780_uart2),
> @@ -2211,7 +2208,7 @@ static const char *x1000_pwm3_groups[] = {
> "pwm3", };
> static const char *x1000_pwm4_groups[] = { "pwm4", };
> static const char *x1000_mac_groups[] = { "mac", };
>
> -static const struct function_desc x1000_functions[] = {
> +static const struct pinfunction x1000_functions[] = {
> INGENIC_PIN_FUNCTION("uart0", x1000_uart0),
> INGENIC_PIN_FUNCTION("uart1", x1000_uart1),
> INGENIC_PIN_FUNCTION("uart2", x1000_uart2),
> @@ -2341,7 +2338,7 @@ static const char *x1500_pwm2_groups[] = {
> "pwm2", };
> static const char *x1500_pwm3_groups[] = { "pwm3", };
> static const char *x1500_pwm4_groups[] = { "pwm4", };
>
> -static const struct function_desc x1500_functions[] = {
> +static const struct pinfunction x1500_functions[] = {
> INGENIC_PIN_FUNCTION("uart0", x1500_uart0),
> INGENIC_PIN_FUNCTION("uart1", x1500_uart1),
> INGENIC_PIN_FUNCTION("uart2", x1500_uart2),
> @@ -2562,7 +2559,7 @@ static const char * const x1600_pwm7_groups[] =
> { "pwm7-b10", "pwm7-b21", };
>
> static const char * const x1600_mac_groups[] = { "mac", };
>
> -static const struct function_desc x1600_functions[] = {
> +static const struct pinfunction x1600_functions[] = {
> INGENIC_PIN_FUNCTION("uart0", x1600_uart0),
> INGENIC_PIN_FUNCTION("uart1", x1600_uart1),
> INGENIC_PIN_FUNCTION("uart2", x1600_uart2),
> @@ -2779,7 +2776,7 @@ static const char *x1830_pwm6_groups[] = {
> "pwm6-c-17", "pwm6-c-27", };
> static const char *x1830_pwm7_groups[] = { "pwm7-c-18", "pwm7-c-28",
> };
> static const char *x1830_mac_groups[] = { "mac", };
>
> -static const struct function_desc x1830_functions[] = {
> +static const struct pinfunction x1830_functions[] = {
> INGENIC_PIN_FUNCTION("uart0", x1830_uart0),
> INGENIC_PIN_FUNCTION("uart1", x1830_uart1),
> INGENIC_PIN_FUNCTION("sfc", x1830_sfc),
> @@ -3225,7 +3222,7 @@ static const char *x2000_mac0_groups[] = {
> "mac0-rmii", "mac0-rgmii", };
> static const char *x2000_mac1_groups[] = { "mac1-rmii", "mac1-
> rgmii", };
> static const char *x2000_otg_groups[] = { "otg-vbus", };
>
> -static const struct function_desc x2000_functions[] = {
> +static const struct pinfunction x2000_functions[] = {
> INGENIC_PIN_FUNCTION("uart0", x2000_uart0),
> INGENIC_PIN_FUNCTION("uart1", x2000_uart1),
> INGENIC_PIN_FUNCTION("uart2", x2000_uart2),
> @@ -3449,7 +3446,7 @@ static const struct group_desc x2100_groups[] =
> {
>
> static const char *x2100_mac_groups[] = { "mac", };
>
> -static const struct function_desc x2100_functions[] = {
> +static const struct pinfunction x2100_functions[] = {
> INGENIC_PIN_FUNCTION("uart0", x2000_uart0),
> INGENIC_PIN_FUNCTION("uart1", x2000_uart1),
> INGENIC_PIN_FUNCTION("uart2", x2000_uart2),
> @@ -4571,11 +4568,9 @@ static int __init ingenic_pinctrl_probe(struct
> platform_device *pdev)
> }
>
> for (i = 0; i < chip_info->num_functions; i++) {
> - const struct function_desc *function = &chip_info-
> >functions[i];
> - const struct pinfunction *func = &function->func;
> + const struct pinfunction *func = &chip_info-
> >functions[i];
>
> - err = pinmux_generic_add_pinfunction(jzpc->pctl,
> func,
> - function-
> >data);
> + err = pinmux_generic_add_pinfunction(jzpc->pctl,
> func, NULL);
> if (err < 0) {
> dev_err(dev, "Failed to register function
> %s\n", func->name);
> return err;
next prev parent reply other threads:[~2025-07-30 15:42 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-24 9:24 [PATCH v3 00/15] pinctrl: introduce the concept of a GPIO pin function category Bartosz Golaszewski
2025-07-24 9:24 ` [PATCH v3 01/15] lib: provide kmemdup_const() Bartosz Golaszewski
2025-07-24 11:04 ` Andy Shevchenko
2025-07-24 11:09 ` Lorenzo Stoakes
2025-07-24 11:12 ` Andy Shevchenko
2025-07-24 11:15 ` Lorenzo Stoakes
2025-07-24 11:52 ` Andy Shevchenko
2025-07-24 11:57 ` David Hildenbrand
2025-07-24 9:24 ` [PATCH v3 02/15] pinctrl: ingenic: use struct pinfunction instead of struct function_desc Bartosz Golaszewski
2025-07-30 15:35 ` Paul Cercueil [this message]
2025-07-24 9:24 ` [PATCH v3 03/15] pinctrl: airoha: replace struct function_desc with struct pinfunction Bartosz Golaszewski
2025-07-24 9:24 ` [PATCH v3 04/15] pinctrl: mediatek: mt7988: use PINCTRL_PIN_FUNCTION() Bartosz Golaszewski
2025-07-24 9:24 ` [PATCH v3 05/15] pinctrl: mediatek: moore: replace struct function_desc with struct pinfunction Bartosz Golaszewski
2025-07-24 9:24 ` [PATCH v3 06/15] pinctrl: imx: don't access the pin function radix tree directly Bartosz Golaszewski
2025-07-24 9:24 ` [PATCH v3 07/15] pinctrl: keembay: release allocated memory in detach path Bartosz Golaszewski
2025-07-24 11:06 ` Andy Shevchenko
2025-07-24 9:24 ` [PATCH v3 08/15] pinctrl: keembay: use a dedicated structure for the pinfunction description Bartosz Golaszewski
2025-07-24 11:11 ` Andy Shevchenko
2025-07-29 9:23 ` Bartosz Golaszewski
2025-07-24 9:24 ` [PATCH v3 09/15] pinctrl: constify pinmux_generic_get_function() Bartosz Golaszewski
2025-07-24 11:14 ` Andy Shevchenko
2025-07-30 14:53 ` Geert Uytterhoeven
2025-07-24 9:24 ` [PATCH v3 10/15] pinctrl: make struct pinfunction a pointer in struct function_desc Bartosz Golaszewski
2025-07-24 9:24 ` [PATCH v3 11/15] pinctrl: qcom: use generic pin function helpers Bartosz Golaszewski
2025-07-24 10:57 ` Konrad Dybcio
2025-07-24 9:24 ` [PATCH v3 12/15] pinctrl: allow to mark pin functions as requestable GPIOs Bartosz Golaszewski
2025-07-24 12:21 ` Andy Shevchenko
2025-07-30 9:54 ` Bartosz Golaszewski
2025-07-30 12:49 ` Andy Shevchenko
2025-07-30 12:52 ` Andy Shevchenko
2025-07-30 12:53 ` Bartosz Golaszewski
2025-07-30 13:30 ` Andy Shevchenko
2025-07-30 14:45 ` Bartosz Golaszewski
2025-07-24 9:24 ` [PATCH v3 13/15] pinctrl: qcom: add infrastructure for marking pin functions as GPIOs Bartosz Golaszewski
2025-07-24 9:24 ` [PATCH v3 14/15] pinctrl: qcom: mark the `gpio` and `egpio` pins function as non-strict functions Bartosz Golaszewski
2025-07-24 9:24 ` [PATCH v3 15/15] pinctrl: qcom: make the pinmuxing strict Bartosz Golaszewski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b254e3868cfca4785d9dfbd13d3cc8ad1f33b6db.camel@crapouillou.net \
--to=paul@crapouillou.net \
--cc=Liam.Howlett@oracle.com \
--cc=aisheng.dong@nxp.com \
--cc=akpm@linux-foundation.org \
--cc=alexey.klimov@linaro.org \
--cc=andersson@kernel.org \
--cc=andy@kernel.org \
--cc=angelogioacchino.delregno@collabora.com \
--cc=bartosz.golaszewski@linaro.org \
--cc=brgl@bgdev.pl \
--cc=david@redhat.com \
--cc=festevam@gmail.com \
--cc=geert+renesas@glider.be \
--cc=haojian.zhuang@linaro.org \
--cc=imx@lists.linux.dev \
--cc=kees@kernel.org \
--cc=kernel@pengutronix.de \
--cc=konradybcio@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-mips@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=lorenzo@kernel.org \
--cc=matthias.bgg@gmail.com \
--cc=mhocko@suse.com \
--cc=ping.bai@nxp.com \
--cc=rppt@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=s32@nxp.com \
--cc=sean.wang@kernel.org \
--cc=shawnguo@kernel.org \
--cc=surenb@google.com \
--cc=tony@atomide.com \
--cc=vbabka@suse.cz \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).