0be811cc97aabfc4ba80dee2fc49653d111bfe11
[openwrt/openwrt.git] / target / linux / at91 / patches-5.15 / 147-pinctrl-at91-pio4-fix-Prefer-unsigned-int-to-bare-us.patch
1 From 99629d1ad7e4e03ac3324d36b703220555b65566 Mon Sep 17 00:00:00 2001
2 From: Claudiu Beznea <claudiu.beznea@microchip.com>
3 Date: Wed, 27 Jan 2021 13:45:45 +0200
4 Subject: [PATCH 147/247] pinctrl: at91-pio4: fix "Prefer 'unsigned int' to
5 bare use of 'unsigned'"
6
7 Fix "Prefer 'unsigned int' to bare use of 'unsigned'" checkpatch.pl
8 warning.
9
10 Signed-off-by: Claudiu Beznea <claudiu.beznea@microchip.com>
11 Acked-by: Ludovic Desroches <ludovic.desroches@microchip.com>
12 Link: https://lore.kernel.org/r/1611747945-29960-4-git-send-email-claudiu.beznea@microchip.com
13 Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
14 ---
15 drivers/pinctrl/pinctrl-at91-pio4.c | 110 ++++++++++++++--------------
16 1 file changed, 57 insertions(+), 53 deletions(-)
17
18 --- a/drivers/pinctrl/pinctrl-at91-pio4.c
19 +++ b/drivers/pinctrl/pinctrl-at91-pio4.c
20 @@ -80,8 +80,8 @@
21 * @slew_rate_support: slew rate support
22 */
23 struct atmel_pioctrl_data {
24 - unsigned nbanks;
25 - unsigned last_bank_count;
26 + unsigned int nbanks;
27 + unsigned int last_bank_count;
28 unsigned int slew_rate_support;
29 };
30
31 @@ -91,11 +91,11 @@ struct atmel_group {
32 };
33
34 struct atmel_pin {
35 - unsigned pin_id;
36 - unsigned mux;
37 - unsigned ioset;
38 - unsigned bank;
39 - unsigned line;
40 + unsigned int pin_id;
41 + unsigned int mux;
42 + unsigned int ioset;
43 + unsigned int bank;
44 + unsigned int line;
45 const char *device;
46 };
47
48 @@ -125,16 +125,16 @@ struct atmel_pin {
49 struct atmel_pioctrl {
50 void __iomem *reg_base;
51 struct clk *clk;
52 - unsigned nbanks;
53 + unsigned int nbanks;
54 struct pinctrl_dev *pinctrl_dev;
55 struct atmel_group *groups;
56 const char * const *group_names;
57 struct atmel_pin **pins;
58 - unsigned npins;
59 + unsigned int npins;
60 struct gpio_chip *gpio_chip;
61 struct irq_domain *irq_domain;
62 int *irqs;
63 - unsigned *pm_wakeup_sources;
64 + unsigned int *pm_wakeup_sources;
65 struct {
66 u32 imr;
67 u32 odsr;
68 @@ -177,11 +177,11 @@ static void atmel_gpio_irq_ack(struct ir
69 */
70 }
71
72 -static int atmel_gpio_irq_set_type(struct irq_data *d, unsigned type)
73 +static int atmel_gpio_irq_set_type(struct irq_data *d, unsigned int type)
74 {
75 struct atmel_pioctrl *atmel_pioctrl = irq_data_get_irq_chip_data(d);
76 struct atmel_pin *pin = atmel_pioctrl->pins[d->hwirq];
77 - unsigned reg;
78 + unsigned int reg;
79
80 atmel_gpio_write(atmel_pioctrl, pin->bank, ATMEL_PIO_MSKR,
81 BIT(pin->line));
82 @@ -268,7 +268,7 @@ static struct irq_chip atmel_gpio_irq_ch
83 .irq_set_wake = atmel_gpio_irq_set_wake,
84 };
85
86 -static int atmel_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
87 +static int atmel_gpio_to_irq(struct gpio_chip *chip, unsigned int offset)
88 {
89 struct atmel_pioctrl *atmel_pioctrl = gpiochip_get_data(chip);
90
91 @@ -316,11 +316,12 @@ static void atmel_gpio_irq_handler(struc
92 chained_irq_exit(chip, desc);
93 }
94
95 -static int atmel_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
96 +static int atmel_gpio_direction_input(struct gpio_chip *chip,
97 + unsigned int offset)
98 {
99 struct atmel_pioctrl *atmel_pioctrl = gpiochip_get_data(chip);
100 struct atmel_pin *pin = atmel_pioctrl->pins[offset];
101 - unsigned reg;
102 + unsigned int reg;
103
104 atmel_gpio_write(atmel_pioctrl, pin->bank, ATMEL_PIO_MSKR,
105 BIT(pin->line));
106 @@ -331,11 +332,11 @@ static int atmel_gpio_direction_input(st
107 return 0;
108 }
109
110 -static int atmel_gpio_get(struct gpio_chip *chip, unsigned offset)
111 +static int atmel_gpio_get(struct gpio_chip *chip, unsigned int offset)
112 {
113 struct atmel_pioctrl *atmel_pioctrl = gpiochip_get_data(chip);
114 struct atmel_pin *pin = atmel_pioctrl->pins[offset];
115 - unsigned reg;
116 + unsigned int reg;
117
118 reg = atmel_gpio_read(atmel_pioctrl, pin->bank, ATMEL_PIO_PDSR);
119
120 @@ -369,12 +370,13 @@ static int atmel_gpio_get_multiple(struc
121 return 0;
122 }
123
124 -static int atmel_gpio_direction_output(struct gpio_chip *chip, unsigned offset,
125 +static int atmel_gpio_direction_output(struct gpio_chip *chip,
126 + unsigned int offset,
127 int value)
128 {
129 struct atmel_pioctrl *atmel_pioctrl = gpiochip_get_data(chip);
130 struct atmel_pin *pin = atmel_pioctrl->pins[offset];
131 - unsigned reg;
132 + unsigned int reg;
133
134 atmel_gpio_write(atmel_pioctrl, pin->bank,
135 value ? ATMEL_PIO_SODR : ATMEL_PIO_CODR,
136 @@ -389,7 +391,7 @@ static int atmel_gpio_direction_output(s
137 return 0;
138 }
139
140 -static void atmel_gpio_set(struct gpio_chip *chip, unsigned offset, int val)
141 +static void atmel_gpio_set(struct gpio_chip *chip, unsigned int offset, int val)
142 {
143 struct atmel_pioctrl *atmel_pioctrl = gpiochip_get_data(chip);
144 struct atmel_pin *pin = atmel_pioctrl->pins[offset];
145 @@ -445,11 +447,11 @@ static struct gpio_chip atmel_gpio_chip
146
147 /* --- PINCTRL --- */
148 static unsigned int atmel_pin_config_read(struct pinctrl_dev *pctldev,
149 - unsigned pin_id)
150 + unsigned int pin_id)
151 {
152 struct atmel_pioctrl *atmel_pioctrl = pinctrl_dev_get_drvdata(pctldev);
153 - unsigned bank = atmel_pioctrl->pins[pin_id]->bank;
154 - unsigned line = atmel_pioctrl->pins[pin_id]->line;
155 + unsigned int bank = atmel_pioctrl->pins[pin_id]->bank;
156 + unsigned int line = atmel_pioctrl->pins[pin_id]->line;
157 void __iomem *addr = atmel_pioctrl->reg_base
158 + bank * ATMEL_PIO_BANK_OFFSET;
159
160 @@ -461,11 +463,11 @@ static unsigned int atmel_pin_config_rea
161 }
162
163 static void atmel_pin_config_write(struct pinctrl_dev *pctldev,
164 - unsigned pin_id, u32 conf)
165 + unsigned int pin_id, u32 conf)
166 {
167 struct atmel_pioctrl *atmel_pioctrl = pinctrl_dev_get_drvdata(pctldev);
168 - unsigned bank = atmel_pioctrl->pins[pin_id]->bank;
169 - unsigned line = atmel_pioctrl->pins[pin_id]->line;
170 + unsigned int bank = atmel_pioctrl->pins[pin_id]->bank;
171 + unsigned int line = atmel_pioctrl->pins[pin_id]->line;
172 void __iomem *addr = atmel_pioctrl->reg_base
173 + bank * ATMEL_PIO_BANK_OFFSET;
174
175 @@ -483,7 +485,7 @@ static int atmel_pctl_get_groups_count(s
176 }
177
178 static const char *atmel_pctl_get_group_name(struct pinctrl_dev *pctldev,
179 - unsigned selector)
180 + unsigned int selector)
181 {
182 struct atmel_pioctrl *atmel_pioctrl = pinctrl_dev_get_drvdata(pctldev);
183
184 @@ -491,19 +493,20 @@ static const char *atmel_pctl_get_group_
185 }
186
187 static int atmel_pctl_get_group_pins(struct pinctrl_dev *pctldev,
188 - unsigned selector, const unsigned **pins,
189 - unsigned *num_pins)
190 + unsigned int selector,
191 + const unsigned int **pins,
192 + unsigned int *num_pins)
193 {
194 struct atmel_pioctrl *atmel_pioctrl = pinctrl_dev_get_drvdata(pctldev);
195
196 - *pins = (unsigned *)&atmel_pioctrl->groups[selector].pin;
197 + *pins = (unsigned int *)&atmel_pioctrl->groups[selector].pin;
198 *num_pins = 1;
199
200 return 0;
201 }
202
203 static struct atmel_group *
204 -atmel_pctl_find_group_by_pin(struct pinctrl_dev *pctldev, unsigned pin)
205 +atmel_pctl_find_group_by_pin(struct pinctrl_dev *pctldev, unsigned int pin)
206 {
207 struct atmel_pioctrl *atmel_pioctrl = pinctrl_dev_get_drvdata(pctldev);
208 int i;
209 @@ -524,7 +527,7 @@ static int atmel_pctl_xlate_pinfunc(stru
210 const char **func_name)
211 {
212 struct atmel_pioctrl *atmel_pioctrl = pinctrl_dev_get_drvdata(pctldev);
213 - unsigned pin_id, func_id;
214 + unsigned int pin_id, func_id;
215 struct atmel_group *grp;
216
217 pin_id = ATMEL_GET_PIN_NO(pinfunc);
218 @@ -554,10 +557,10 @@ static int atmel_pctl_xlate_pinfunc(stru
219 static int atmel_pctl_dt_subnode_to_map(struct pinctrl_dev *pctldev,
220 struct device_node *np,
221 struct pinctrl_map **map,
222 - unsigned *reserved_maps,
223 - unsigned *num_maps)
224 + unsigned int *reserved_maps,
225 + unsigned int *num_maps)
226 {
227 - unsigned num_pins, num_configs, reserve;
228 + unsigned int num_pins, num_configs, reserve;
229 unsigned long *configs;
230 struct property *pins;
231 u32 pinfunc;
232 @@ -628,10 +631,10 @@ exit:
233 static int atmel_pctl_dt_node_to_map(struct pinctrl_dev *pctldev,
234 struct device_node *np_config,
235 struct pinctrl_map **map,
236 - unsigned *num_maps)
237 + unsigned int *num_maps)
238 {
239 struct device_node *np;
240 - unsigned reserved_maps;
241 + unsigned int reserved_maps;
242 int ret;
243
244 *map = NULL;
245 @@ -679,13 +682,13 @@ static int atmel_pmx_get_functions_count
246 }
247
248 static const char *atmel_pmx_get_function_name(struct pinctrl_dev *pctldev,
249 - unsigned selector)
250 + unsigned int selector)
251 {
252 return atmel_functions[selector];
253 }
254
255 static int atmel_pmx_get_function_groups(struct pinctrl_dev *pctldev,
256 - unsigned selector,
257 + unsigned int selector,
258 const char * const **groups,
259 unsigned * const num_groups)
260 {
261 @@ -698,11 +701,11 @@ static int atmel_pmx_get_function_groups
262 }
263
264 static int atmel_pmx_set_mux(struct pinctrl_dev *pctldev,
265 - unsigned function,
266 - unsigned group)
267 + unsigned int function,
268 + unsigned int group)
269 {
270 struct atmel_pioctrl *atmel_pioctrl = pinctrl_dev_get_drvdata(pctldev);
271 - unsigned pin;
272 + unsigned int pin;
273 u32 conf;
274
275 dev_dbg(pctldev->dev, "enable function %s group %s\n",
276 @@ -726,13 +729,13 @@ static const struct pinmux_ops atmel_pmx
277 };
278
279 static int atmel_conf_pin_config_group_get(struct pinctrl_dev *pctldev,
280 - unsigned group,
281 + unsigned int group,
282 unsigned long *config)
283 {
284 struct atmel_pioctrl *atmel_pioctrl = pinctrl_dev_get_drvdata(pctldev);
285 - unsigned param = pinconf_to_config_param(*config), arg = 0;
286 + unsigned int param = pinconf_to_config_param(*config), arg = 0;
287 struct atmel_group *grp = atmel_pioctrl->groups + group;
288 - unsigned pin_id = grp->pin;
289 + unsigned int pin_id = grp->pin;
290 u32 res;
291
292 res = atmel_pin_config_read(pctldev, pin_id);
293 @@ -786,21 +789,21 @@ static int atmel_conf_pin_config_group_g
294 }
295
296 static int atmel_conf_pin_config_group_set(struct pinctrl_dev *pctldev,
297 - unsigned group,
298 + unsigned int group,
299 unsigned long *configs,
300 - unsigned num_configs)
301 + unsigned int num_configs)
302 {
303 struct atmel_pioctrl *atmel_pioctrl = pinctrl_dev_get_drvdata(pctldev);
304 struct atmel_group *grp = atmel_pioctrl->groups + group;
305 - unsigned bank, pin, pin_id = grp->pin;
306 + unsigned int bank, pin, pin_id = grp->pin;
307 u32 mask, conf = 0;
308 int i;
309
310 conf = atmel_pin_config_read(pctldev, pin_id);
311
312 for (i = 0; i < num_configs; i++) {
313 - unsigned param = pinconf_to_config_param(configs[i]);
314 - unsigned arg = pinconf_to_config_argument(configs[i]);
315 + unsigned int param = pinconf_to_config_param(configs[i]);
316 + unsigned int arg = pinconf_to_config_argument(configs[i]);
317
318 dev_dbg(pctldev->dev, "%s: pin=%u, config=0x%lx\n",
319 __func__, pin_id, configs[i]);
320 @@ -900,7 +903,8 @@ static int atmel_conf_pin_config_group_s
321 }
322
323 static void atmel_conf_pin_config_dbg_show(struct pinctrl_dev *pctldev,
324 - struct seq_file *s, unsigned pin_id)
325 + struct seq_file *s,
326 + unsigned int pin_id)
327 {
328 struct atmel_pioctrl *atmel_pioctrl = pinctrl_dev_get_drvdata(pctldev);
329 u32 conf;
330 @@ -1108,8 +1112,8 @@ static int atmel_pinctrl_probe(struct pl
331 return -ENOMEM;
332 for (i = 0 ; i < atmel_pioctrl->npins; i++) {
333 struct atmel_group *group = atmel_pioctrl->groups + i;
334 - unsigned bank = ATMEL_PIO_BANK(i);
335 - unsigned line = ATMEL_PIO_LINE(i);
336 + unsigned int bank = ATMEL_PIO_BANK(i);
337 + unsigned int line = ATMEL_PIO_LINE(i);
338
339 atmel_pioctrl->pins[i] = devm_kzalloc(dev,
340 sizeof(**atmel_pioctrl->pins), GFP_KERNEL);