From: Bartosz Golaszewski <brgl@bgdev.pl>
To: 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>,
Paul Cercueil <paul@crapouillou.net>,
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>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Danilo Krummrich <dakr@kernel.org>,
Neil Armstrong <neil.armstrong@linaro.org>,
Mark Brown <broonie@kernel.org>
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: [PATCH v6 08/15] pinctrl: keembay: use a dedicated structure for the pinfunction description
Date: Thu, 28 Aug 2025 18:00:16 +0200 [thread overview]
Message-ID: <20250828-pinctrl-gpio-pinfuncs-v6-8-c9abb6bdb689@linaro.org> (raw)
In-Reply-To: <20250828-pinctrl-gpio-pinfuncs-v6-0-c9abb6bdb689@linaro.org>
From: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
struct function_desc is a wrapper around struct pinfunction with an
additional void *data pointer. We're 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(). This driver uses the data pointer so in
order to stop using struct function_desc, we need to provide an
alternative that also wraps the mux mode which is passed to pinctrl core
as user data.
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
---
drivers/pinctrl/pinctrl-keembay.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-keembay.c b/drivers/pinctrl/pinctrl-keembay.c
index 6aefcbc31309995ec1e235416b40aab3e4a073a9..e78c8b3ec245aad56e3e74a26d27c41ba4a98281 100644
--- a/drivers/pinctrl/pinctrl-keembay.c
+++ b/drivers/pinctrl/pinctrl-keembay.c
@@ -135,6 +135,11 @@ struct keembay_pin_soc {
const struct pinctrl_pin_desc *pins;
};
+struct keembay_pinfunction {
+ struct pinfunction func;
+ u8 mux_mode;
+};
+
static const struct pinctrl_pin_desc keembay_pins[] = {
KEEMBAY_PIN_DESC(0, "GPIO0",
KEEMBAY_MUX(0x0, "I2S0_M0"),
@@ -1556,13 +1561,13 @@ static int keembay_pinctrl_reg(struct keembay_pinctrl *kpc, struct device *dev)
}
static int keembay_add_functions(struct keembay_pinctrl *kpc,
- struct function_desc *functions)
+ struct keembay_pinfunction *functions)
{
unsigned int i;
/* Assign the groups for each function */
for (i = 0; i < kpc->nfuncs; i++) {
- struct function_desc *func = &functions[i];
+ struct keembay_pinfunction *func = &functions[i];
const char **group_names;
unsigned int grp_idx = 0;
int j;
@@ -1588,14 +1593,14 @@ static int keembay_add_functions(struct keembay_pinctrl *kpc,
/* Add all functions */
for (i = 0; i < kpc->nfuncs; i++)
pinmux_generic_add_pinfunction(kpc->pctrl, &functions[i].func,
- functions[i].data);
+ &functions[i].mux_mode);
return 0;
}
static int keembay_build_functions(struct keembay_pinctrl *kpc)
{
- struct function_desc *keembay_funcs, *new_funcs;
+ struct keembay_pinfunction *keembay_funcs, *new_funcs;
int i;
/*
@@ -1614,7 +1619,7 @@ static int keembay_build_functions(struct keembay_pinctrl *kpc)
struct keembay_mux_desc *mux;
for (mux = pdesc->drv_data; mux->name; mux++) {
- struct function_desc *fdesc;
+ struct keembay_pinfunction *fdesc;
/* Check if we already have function for this mux */
for (fdesc = keembay_funcs; fdesc->func.name; fdesc++) {
@@ -1628,7 +1633,7 @@ static int keembay_build_functions(struct keembay_pinctrl *kpc)
if (!fdesc->func.name) {
fdesc->func.name = mux->name;
fdesc->func.ngroups = 1;
- fdesc->data = &mux->mode;
+ fdesc->mux_mode = mux->mode;
kpc->nfuncs++;
}
}
--
2.48.1
next prev parent reply other threads:[~2025-08-28 16:00 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-28 16:00 [PATCH v6 00/15] pinctrl: introduce the concept of a GPIO pin function category Bartosz Golaszewski
2025-08-28 16:00 ` [PATCH v6 01/15] devres: provide devm_kmemdup_const() Bartosz Golaszewski
2025-08-29 4:36 ` Greg Kroah-Hartman
2025-08-28 16:00 ` [PATCH v6 02/15] pinctrl: ingenic: use struct pinfunction instead of struct function_desc Bartosz Golaszewski
2025-08-28 16:00 ` [PATCH v6 03/15] pinctrl: airoha: replace struct function_desc with struct pinfunction Bartosz Golaszewski
2025-08-28 16:00 ` [PATCH v6 04/15] pinctrl: mediatek: mt7988: use PINCTRL_PIN_FUNCTION() Bartosz Golaszewski
2025-08-30 8:04 ` Andy Shevchenko
2025-08-28 16:00 ` [PATCH v6 05/15] pinctrl: mediatek: moore: replace struct function_desc with struct pinfunction Bartosz Golaszewski
2025-08-28 16:00 ` [PATCH v6 06/15] pinctrl: imx: don't access the pin function radix tree directly Bartosz Golaszewski
2025-09-01 12:06 ` Mark Brown
2025-09-01 13:20 ` Bartosz Golaszewski
2025-09-01 14:37 ` Mark Brown
2025-09-01 19:22 ` Bartosz Golaszewski
2025-09-02 10:10 ` Linus Walleij
2025-08-28 16:00 ` [PATCH v6 07/15] pinctrl: keembay: release allocated memory in detach path Bartosz Golaszewski
2025-08-28 16:00 ` Bartosz Golaszewski [this message]
2025-08-28 16:00 ` [PATCH v6 09/15] pinctrl: constify pinmux_generic_get_function() Bartosz Golaszewski
2025-08-28 16:00 ` [PATCH v6 10/15] pinctrl: make struct pinfunction a pointer in struct function_desc Bartosz Golaszewski
2025-08-28 16:00 ` [PATCH v6 11/15] pinctrl: qcom: use generic pin function helpers Bartosz Golaszewski
2025-08-28 16:00 ` [PATCH v6 12/15] pinctrl: allow to mark pin functions as requestable GPIOs Bartosz Golaszewski
2025-08-28 16:00 ` [PATCH v6 13/15] pinctrl: qcom: add infrastructure for marking pin functions as GPIOs Bartosz Golaszewski
2025-08-28 16:00 ` [PATCH v6 14/15] pinctrl: qcom: mark the `gpio` and `egpio` pins function as non-strict functions Bartosz Golaszewski
2025-08-28 16:00 ` [PATCH v6 15/15] pinctrl: qcom: make the pinmuxing strict Bartosz Golaszewski
2025-08-30 8:19 ` [PATCH v6 00/15] pinctrl: introduce the concept of a GPIO pin function category Andy Shevchenko
2025-09-01 8:20 ` Neil Armstrong
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=20250828-pinctrl-gpio-pinfuncs-v6-8-c9abb6bdb689@linaro.org \
--to=brgl@bgdev.pl \
--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=broonie@kernel.org \
--cc=dakr@kernel.org \
--cc=david@redhat.com \
--cc=festevam@gmail.com \
--cc=geert+renesas@glider.be \
--cc=gregkh@linuxfoundation.org \
--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=neil.armstrong@linaro.org \
--cc=paul@crapouillou.net \
--cc=ping.bai@nxp.com \
--cc=rafael@kernel.org \
--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).