From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Andy Shevchenko <andy@kernel.org>,
Linus Walleij <linus.walleij@linaro.org>
Subject: [PATCH v1 2/8] pinctrl: intel: Make use of struct pinfunction and PINCTRL_PINFUNCTION()
Date: Mon, 19 Dec 2022 14:42:34 +0200 [thread overview]
Message-ID: <20221219124240.62781-2-andriy.shevchenko@linux.intel.com> (raw)
In-Reply-To: <20221219124240.62781-1-andriy.shevchenko@linux.intel.com>
Since pin control provides a generic data type and a macro for
the pin function definition, use them in the Intel driver.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
I went with the embedding a generic structure into intel_function
instead of replacing the latter in order to keep symmetry with
intel_pingroup. In the case we will need the additional memeber
in the future there will be less churn, otherwise from the code
generation perspective it's the same.
drivers/pinctrl/intel/pinctrl-intel.c | 6 +++---
drivers/pinctrl/intel/pinctrl-intel.h | 13 ++++++++-----
2 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/drivers/pinctrl/intel/pinctrl-intel.c b/drivers/pinctrl/intel/pinctrl-intel.c
index 2f7931d9602c..682fd902009f 100644
--- a/drivers/pinctrl/intel/pinctrl-intel.c
+++ b/drivers/pinctrl/intel/pinctrl-intel.c
@@ -372,7 +372,7 @@ static const char *intel_get_function_name(struct pinctrl_dev *pctldev,
{
struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
- return pctrl->soc->functions[function].name;
+ return pctrl->soc->functions[function].func.name;
}
static int intel_get_function_groups(struct pinctrl_dev *pctldev,
@@ -382,8 +382,8 @@ static int intel_get_function_groups(struct pinctrl_dev *pctldev,
{
struct intel_pinctrl *pctrl = pinctrl_dev_get_drvdata(pctldev);
- *groups = pctrl->soc->functions[function].groups;
- *ngroups = pctrl->soc->functions[function].ngroups;
+ *groups = pctrl->soc->functions[function].func.groups;
+ *ngroups = pctrl->soc->functions[function].func.ngroups;
return 0;
}
diff --git a/drivers/pinctrl/intel/pinctrl-intel.h b/drivers/pinctrl/intel/pinctrl-intel.h
index 3b0e2d3f15d5..91e5bedba00b 100644
--- a/drivers/pinctrl/intel/pinctrl-intel.h
+++ b/drivers/pinctrl/intel/pinctrl-intel.h
@@ -36,11 +36,13 @@ struct intel_pingroup {
/**
* struct intel_function - Description about a function
+ * @func: Generic data of the pin function (name and groups of pins)
* @name: Name of the function
* @groups: An array of groups for this function
* @ngroups: Number of groups in @groups
*/
struct intel_function {
+ struct pinfunction func;
const char *name;
const char * const *groups;
size_t ngroups;
@@ -183,11 +185,12 @@ struct intel_community {
.modes = __builtin_choose_expr(__builtin_constant_p((m)), NULL, (m)), \
}
-#define FUNCTION(n, g) \
- { \
- .name = (n), \
- .groups = (g), \
- .ngroups = ARRAY_SIZE((g)), \
+#define FUNCTION(n, g) \
+ { \
+ .func = PINCTRL_PINFUNCTION((n), (g), ARRAY_SIZE(g)), \
+ .name = (n), \
+ .groups = (g), \
+ .ngroups = ARRAY_SIZE((g)), \
}
/**
--
2.35.1
next prev parent reply other threads:[~2022-12-19 12:44 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-19 12:42 [PATCH v1 1/8] pinctrl: Introduce struct pinfunction and PINCTRL_PINFUNCTION() macro Andy Shevchenko
2022-12-19 12:42 ` Andy Shevchenko [this message]
2022-12-19 12:42 ` [PATCH v1 3/8] pinctrl: baytrail: Convert to use new memeber in struct intel_function Andy Shevchenko
2022-12-19 12:42 ` [PATCH v1 4/8] pinctrl: cherryview: " Andy Shevchenko
2022-12-19 12:42 ` [PATCH v1 5/8] pinctrl: lynxpoint: " Andy Shevchenko
2022-12-19 12:42 ` [PATCH v1 6/8] pinctrl: merrifield: " Andy Shevchenko
2022-12-19 12:42 ` [PATCH v1 7/8] pinctrl: moorefield: " Andy Shevchenko
2022-12-19 12:42 ` [PATCH v1 8/8] pinctrl: intel: Get rid of unused members " Andy Shevchenko
2022-12-19 14:42 ` [PATCH v1 1/8] pinctrl: Introduce struct pinfunction and PINCTRL_PINFUNCTION() macro Andy Shevchenko
2022-12-20 6:20 ` Mika Westerberg
2022-12-27 21:46 ` Andy Shevchenko
2022-12-29 21:17 ` Linus Walleij
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=20221219124240.62781-2-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=andy@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
/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).