pinctrl: intel: Make use of struct pinfunction and PINCTRL_PINFUNCTION()
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Mon, 19 Dec 2022 12:42:34 +0000 (14:42 +0200)
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Fri, 30 Dec 2022 08:22:52 +0000 (10:22 +0200)
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>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
drivers/pinctrl/intel/pinctrl-intel.c
drivers/pinctrl/intel/pinctrl-intel.h

index 1e6d49b18d5c5cb6a30a1225f2647d64979b1bab..1bb2a0bb65dbb69be1865340646b4d4bda156364 100644 (file)
@@ -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;
 }
 
index 3b0e2d3f15d52a73d05f3771febd5006e89e9d5d..91e5bedba00bb439f578f689fb2ef1f0d5eb7981 100644 (file)
@@ -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)),                             \
        }
 
 /**