New pin controllers such as ACPI-based may also have custom properties to parse, and should be able to use generic pin config. Let's make the code compile on !OF systems and rename members a bit to underscore it is custom parameters and not necessarily DT parameters. This fixes a build regression for x86_64 on the zeroday kernel builds.
Unified · Split
| @@ -113,10 +113,11 @@ void pinconf_generic_dump_pins(struct pinctrl_dev *pctldev, struct seq_file *s, · 112 unmodified lines | ||
| 113 | 113 | pinconf_generic_dump_one(pctldev, s, gname, pin, conf_items, |
| 114 | 114 | ARRAY_SIZE(conf_items)); |
| 115 | 115 | /* driver-specific parameters */ |
| 116 | − if (pctldev->desc->num_dt_params && pctldev->desc->conf_items) | |
| 116 | + if (pctldev->desc->num_custom_params && | |
| 117 | + pctldev->desc->custom_conf_items) | |
| 117 | 118 | pinconf_generic_dump_one(pctldev, s, gname, pin, |
| 118 | − pctldev->desc->conf_items, | |
| 119 | − pctldev->desc->num_dt_params); | |
| 119 | + pctldev->desc->custom_conf_items, | |
| 120 | + pctldev->desc->num_custom_params); | |
| 120 | 121 | } |
| 121 | 122 | |
| 122 | 123 | void pinconf_generic_dump_config(struct pinctrl_dev *pctldev, |
| @@ -131,21 +132,24 @@ void pinconf_generic_dump_config(struct pinctrl_dev *pctldev, · 8 unmodified lines | ||
| 131 | 132 | pinconf_to_config_argument(config)); |
| 132 | 133 | } |
| 133 | 134 | |
| 134 | − if (!pctldev->desc->num_dt_params || !pctldev->desc->conf_items) | |
| 135 | + if (!pctldev->desc->num_custom_params || | |
| 136 | + !pctldev->desc->custom_conf_items) | |
| 135 | 137 | return; |
| 136 | 138 | |
| 137 | − for (i = 0; i < pctldev->desc->num_dt_params; i++) { | |
| 138 | − if (pinconf_to_config_param(config) != pctldev->desc->conf_items[i].param) | |
| 139 | + for (i = 0; i < pctldev->desc->num_custom_params; i++) { | |
| 140 | + if (pinconf_to_config_param(config) != | |
| 141 | + pctldev->desc->custom_conf_items[i].param) | |
| 139 | 142 | continue; |
| 140 | − seq_printf(s, "%s: 0x%x", pctldev->desc->conf_items[i].display, | |
| 141 | − pinconf_to_config_argument(config)); | |
| 143 | + seq_printf(s, "%s: 0x%x", | |
| 144 | + pctldev->desc->custom_conf_items[i].display, | |
| 145 | + pinconf_to_config_argument(config)); | |
| 142 | 146 | } |
| 143 | 147 | } |
| 144 | 148 | EXPORT_SYMBOL_GPL(pinconf_generic_dump_config); |
| 145 | 149 | #endif |
| 146 | 150 | |
| 147 | 151 | #ifdef CONFIG_OF |
| 148 | −static const struct pinconf_generic_dt_params dt_params[] = { | |
| 152 | +static const struct pinconf_generic_params dt_params[] = { | |
| 149 | 153 | { "bias-disable", PIN_CONFIG_BIAS_DISABLE, 0 }, |
| 150 | 154 | { "bias-high-impedance", PIN_CONFIG_BIAS_HIGH_IMPEDANCE, 0 }, |
| 151 | 155 | { "bias-bus-hold", PIN_CONFIG_BIAS_BUS_HOLD, 0 }, |
| @@ -170,9 +174,9 @@ static const struct pinconf_generic_dt_params dt_params[] = { · 18 unmodified lines | ||
| 170 | 174 | }; |
| 171 | 175 | |
| 172 | 176 | /** |
| 173 | − * parse_dt_cfg - Parse DT pinconf parameters | |
| 177 | + * parse_dt_cfg() - Parse DT pinconf parameters | |
| 174 | 178 | * @np: DT node |
| 175 | − * @params: Array of describing DT parameters | |
| 179 | + * @params: Array of describing generic parameters | |
| 176 | 180 | * @count: Number of entries in @params |
| 177 | 181 | * @cfg: Array of parsed config options |
| 178 | 182 | * @ncfg: Number of entries in @cfg |
| @@ -183,7 +187,7 @@ static const struct pinconf_generic_dt_params dt_params[] = { · 4 unmodified lines | ||
| 183 | 187 | * needs to have enough memory allocated to hold all possible entries. |
| 184 | 188 | */ |
| 185 | 189 | static void parse_dt_cfg(struct device_node *np, |
| 186 | − const struct pinconf_generic_dt_params *params, | |
| 190 | + const struct pinconf_generic_params *params, | |
| 187 | 191 | unsigned int count, unsigned long *cfg, |
| 188 | 192 | unsigned int *ncfg) |
| 189 | 193 | { |
| @@ -192,7 +196,7 @@ static void parse_dt_cfg(struct device_node *np, · 2 unmodified lines | ||
| 192 | 196 | for (i = 0; i < count; i++) { |
| 193 | 197 | u32 val; |
| 194 | 198 | int ret; |
| 195 | − const struct pinconf_generic_dt_params *par = ¶ms[i]; | |
| 199 | + const struct pinconf_generic_params *par = ¶ms[i]; | |
| 196 | 200 | |
| 197 | 201 | ret = of_property_read_u32(np, par->property, &val); |
| 198 | 202 | |
| @@ -232,15 +236,16 @@ int pinconf_generic_parse_dt_config(struct device_node *np, · 33 unmodified lines | ||
| 232 | 236 | /* allocate a temporary array big enough to hold one of each option */ |
| 233 | 237 | max_cfg = ARRAY_SIZE(dt_params); |
| 234 | 238 | if (pctldev) |
| 235 | − max_cfg += pctldev->desc->num_dt_params; | |
| 239 | + max_cfg += pctldev->desc->num_custom_params; | |
| 236 | 240 | cfg = kcalloc(max_cfg, sizeof(*cfg), GFP_KERNEL); |
| 237 | 241 | if (!cfg) |
| 238 | 242 | return -ENOMEM; |
| 239 | 243 | |
| 240 | 244 | parse_dt_cfg(np, dt_params, ARRAY_SIZE(dt_params), cfg, &ncfg); |
| 241 | − if (pctldev && pctldev->desc->num_dt_params && pctldev->desc->params) | |
| 242 | − parse_dt_cfg(np, pctldev->desc->params, | |
| 243 | − pctldev->desc->num_dt_params, cfg, &ncfg); | |
| 245 | + if (pctldev && pctldev->desc->num_custom_params && | |
| 246 | + pctldev->desc->custom_params) | |
| 247 | + parse_dt_cfg(np, pctldev->desc->custom_params, | |
| 248 | + pctldev->desc->num_custom_params, cfg, &ncfg); | |
| 244 | 249 | |
| 245 | 250 | ret = 0; |
| 246 | 251 | |
| @@ -920,7 +920,7 @@ enum zynq_pin_config_param { · 919 unmodified lines | ||
| 920 | 920 | PIN_CONFIG_IOSTANDARD = PIN_CONFIG_END + 1, |
| 921 | 921 | }; |
| 922 | 922 | |
| 923 | −static const struct pinconf_generic_dt_params zynq_dt_params[] = { | |
| 923 | +static const struct pinconf_generic_params zynq_dt_params[] = { | |
| 924 | 924 | {"io-standard", PIN_CONFIG_IOSTANDARD, zynq_iostd_lvcmos18}, |
| 925 | 925 | }; |
| 926 | 926 | |
| @@ -1099,9 +1099,9 @@ static struct pinctrl_desc zynq_desc = { · 172 unmodified lines | ||
| 1099 | 1099 | .pctlops = &zynq_pctrl_ops, |
| 1100 | 1100 | .pmxops = &zynq_pinmux_ops, |
| 1101 | 1101 | .confops = &zynq_pinconf_ops, |
| 1102 | − .num_dt_params = ARRAY_SIZE(zynq_dt_params), | |
| 1103 | − .params = zynq_dt_params, | |
| 1104 | − .conf_items = zynq_conf_items, | |
| 1102 | + .num_custom_params = ARRAY_SIZE(zynq_dt_params), | |
| 1103 | + .custom_params = zynq_dt_params, | |
| 1104 | + .custom_conf_items = zynq_conf_items, | |
| 1105 | 1105 | .owner = THIS_MODULE, |
| 1106 | 1106 | }; |
| 1107 | 1107 | |
| @@ -131,7 +131,7 @@ struct pmic_gpio_state { · 130 unmodified lines | ||
| 131 | 131 | struct gpio_chip chip; |
| 132 | 132 | }; |
| 133 | 133 | |
| 134 | −static const struct pinconf_generic_dt_params pmic_gpio_bindings[] = { | |
| 134 | +static const struct pinconf_generic_params pmic_gpio_bindings[] = { | |
| 135 | 135 | {"qcom,pull-up-strength", PMIC_GPIO_CONF_PULL_UP, 0}, |
| 136 | 136 | {"qcom,drive-strength", PMIC_GPIO_CONF_STRENGTH, 0}, |
| 137 | 137 | }; |
| @@ -742,9 +742,9 @@ static int pmic_gpio_probe(struct platform_device *pdev) · 604 unmodified lines | ||
| 742 | 742 | pctrldesc->name = dev_name(dev); |
| 743 | 743 | pctrldesc->pins = pindesc; |
| 744 | 744 | pctrldesc->npins = npins; |
| 745 | − pctrldesc->num_dt_params = ARRAY_SIZE(pmic_gpio_bindings); | |
| 746 | − pctrldesc->params = pmic_gpio_bindings; | |
| 747 | − pctrldesc->conf_items = pmic_conf_items; | |
| 745 | + pctrldesc->num_custom_params = ARRAY_SIZE(pmic_gpio_bindings); | |
| 746 | + pctrldesc->custom_params = pmic_gpio_bindings; | |
| 747 | + pctrldesc->custom_conf_items = pmic_conf_items; | |
| 748 | 748 | |
| 749 | 749 | for (i = 0; i < npins; i++, pindesc++) { |
| 750 | 750 | pad = &pads[i]; |
| @@ -162,7 +162,7 @@ static inline unsigned long pinconf_to_config_packed(enum pin_config_param param · 161 unmodified lines | ||
| 162 | 162 | struct pinctrl_dev; |
| 163 | 163 | struct pinctrl_map; |
| 164 | 164 | |
| 165 | −struct pinconf_generic_dt_params { | |
| 165 | +struct pinconf_generic_params { | |
| 166 | 166 | const char * const property; |
| 167 | 167 | enum pin_config_param param; |
| 168 | 168 | u32 default_value; |
| @@ -118,9 +118,12 @@ struct pinctrl_ops { · 117 unmodified lines | ||
| 118 | 118 | * @confops: pin config operations vtable, if you support pin configuration in |
| 119 | 119 | * your driver |
| 120 | 120 | * @owner: module providing the pin controller, used for refcounting |
| 121 | − * @num_dt_params: Number of driver-specific DT parameters | |
| 122 | − * @params: List of DT parameters | |
| 123 | − * @conf_items: Information how to print @params in debugfs | |
| 121 | + * @num_custom_params: Number of driver-specific custom parameters to be parsed | |
| 122 | + * from the hardware description | |
| 123 | + * @custom_params: List of driver_specific custom parameters to be parsed from | |
| 124 | + * the hardware description | |
| 125 | + * @custom_conf_items: Information how to print @params in debugfs, must be | |
| 126 | + * the same size as the @custom_params, i.e. @num_custom_params | |
| 124 | 127 | */ |
| 125 | 128 | struct pinctrl_desc { |
| 126 | 129 | const char *name; |
| @@ -130,10 +133,10 @@ struct pinctrl_desc { · 3 unmodified lines | ||
| 130 | 133 | const struct pinmux_ops *pmxops; |
| 131 | 134 | const struct pinconf_ops *confops; |
| 132 | 135 | struct module *owner; |
| 133 | −#if defined(CONFIG_GENERIC_PINCONF) && defined(CONFIG_OF) | |
| 134 | − unsigned int num_dt_params; | |
| 135 | − const struct pinconf_generic_dt_params *params; | |
| 136 | − const struct pin_config_item *conf_items; | |
| 136 | +#ifdef CONFIG_GENERIC_PINCONF | |
| 137 | + unsigned int num_custom_params; | |
| 138 | + const struct pinconf_generic_params *custom_params; | |
| 139 | + const struct pin_config_item *custom_conf_items; | |
| 137 | 140 | #endif |
| 138 | 141 | }; |
| 139 | 142 | |