diff mbox series

pinctrl: renesas: checker: Fix for drive reg field increase

Message ID e44426a99b20e5f5681ede894d08e36870bcb47f.1649865163.git.geert+renesas@glider.be
State New
Headers show
Series pinctrl: renesas: checker: Fix for drive reg field increase | expand

Commit Message

Geert Uytterhoeven April 13, 2022, 3:53 p.m. UTC
With CONFIG_DEBUG_PINCTRL=y:

    r8a774c0_pfc: pin GP_4_3: SH_PFC_PIN_CFG_DRIVE_STRENGTH flag set but not in drive_regs
    r8a774c0_pfc: pin GP_4_4: SH_PFC_PIN_CFG_DRIVE_STRENGTH flag set but not in drive_regs
    ...
    r8a77990_pfc: pin GP_4_3: SH_PFC_PIN_CFG_DRIVE_STRENGTH flag set but not in drive_regs
    r8a77990_pfc: pin GP_4_4: SH_PFC_PIN_CFG_DRIVE_STRENGTH flag set but not in drive_regs

This happens because the checker still uses the old number of fields.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
To be folded into commit d5c9688095d29a6c ("pinctrl: renesas: Allow up
to 10 fields for drive_regs") in renesas-pinctrl-for-v5.19.

Ideally, some iterator or index helper should be introduced.
---
 drivers/pinctrl/renesas/core.c | 32 ++++++++++++++++----------------
 1 file changed, 16 insertions(+), 16 deletions(-)

Comments

Wolfram Sang April 14, 2022, 5:44 a.m. UTC | #1
> This happens because the checker still uses the old number of fields.
> 
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> ---
> To be folded into commit d5c9688095d29a6c ("pinctrl: renesas: Allow up
> to 10 fields for drive_regs") in renesas-pinctrl-for-v5.19.
> 
> Ideally, some iterator or index helper should be introduced.

What about a #define instead of a hard-coded value until then?
Geert Uytterhoeven April 14, 2022, 1:57 p.m. UTC | #2
Hi Wolfram,

On Thu, Apr 14, 2022 at 7:44 AM Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
> > This happens because the checker still uses the old number of fields.
> >
> > Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> > ---
> > To be folded into commit d5c9688095d29a6c ("pinctrl: renesas: Allow up
> > to 10 fields for drive_regs") in renesas-pinctrl-for-v5.19.
> >
> > Ideally, some iterator or index helper should be introduced.
>
> What about a #define instead of a hard-coded value until then?

That would be an option. But I bit the bullet, and introduced a few
helpers in v2 instead.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
diff mbox series

Patch

diff --git a/drivers/pinctrl/renesas/core.c b/drivers/pinctrl/renesas/core.c
index d0d4714731c14cf5..dae2201a62dc8f8b 100644
--- a/drivers/pinctrl/renesas/core.c
+++ b/drivers/pinctrl/renesas/core.c
@@ -1076,17 +1076,17 @@  static void __init sh_pfc_check_info(const struct sh_pfc_soc_info *info)
 			if (!drive_regs) {
 				sh_pfc_err_once(drive, "SH_PFC_PIN_CFG_DRIVE_STRENGTH flag set but drive_regs missing\n");
 			} else {
-				for (j = 0; drive_regs[j / 8].reg; j++) {
-					if (!drive_regs[j / 8].fields[j % 8].pin &&
-					    !drive_regs[j / 8].fields[j % 8].offset &&
-					    !drive_regs[j / 8].fields[j % 8].size)
+				for (j = 0; drive_regs[j / 10].reg; j++) {
+					if (!drive_regs[j / 10].fields[j % 10].pin &&
+					    !drive_regs[j / 10].fields[j % 10].offset &&
+					    !drive_regs[j / 10].fields[j % 10].size)
 						continue;
 
-					if (drive_regs[j / 8].fields[j % 8].pin == pin->pin)
+					if (drive_regs[j / 10].fields[j % 10].pin == pin->pin)
 						break;
 				}
 
-				if (!drive_regs[j / 8].reg)
+				if (!drive_regs[j / 10].reg)
 					sh_pfc_err("pin %s: SH_PFC_PIN_CFG_DRIVE_STRENGTH flag set but not in drive_regs\n",
 						   pin->name);
 			}
@@ -1164,20 +1164,20 @@  static void __init sh_pfc_check_info(const struct sh_pfc_soc_info *info)
 	for (i = 0; drive_regs && drive_regs[i].reg; i++)
 		sh_pfc_check_drive_reg(info, &drive_regs[i]);
 
-	for (i = 0; drive_regs && drive_regs[i / 8].reg; i++) {
-		if (!drive_regs[i / 8].fields[i % 8].pin &&
-		    !drive_regs[i / 8].fields[i % 8].offset &&
-		    !drive_regs[i / 8].fields[i % 8].size)
+	for (i = 0; drive_regs && drive_regs[i / 10].reg; i++) {
+		if (!drive_regs[i / 10].fields[i % 10].pin &&
+		    !drive_regs[i / 10].fields[i % 10].offset &&
+		    !drive_regs[i / 10].fields[i % 10].size)
 			continue;
 
 		for (j = 0; j < i; j++) {
-			if (drive_regs[i / 8].fields[i % 8].pin ==
-			    drive_regs[j / 8].fields[j % 8].pin &&
-			    drive_regs[j / 8].fields[j % 8].offset &&
-			    drive_regs[j / 8].fields[j % 8].size) {
+			if (drive_regs[i / 10].fields[i % 10].pin ==
+			    drive_regs[j / 10].fields[j % 10].pin &&
+			    drive_regs[j / 10].fields[j % 10].offset &&
+			    drive_regs[j / 10].fields[j % 10].size) {
 				sh_pfc_err("drive_reg 0x%x:%u/0x%x:%u: pin conflict\n",
-					   drive_regs[i / 8].reg, i % 8,
-					   drive_regs[j / 8].reg, j % 8);
+					   drive_regs[i / 10].reg, i % 10,
+					   drive_regs[j / 10].reg, j % 10);
 			}
 		}
 	}