Skip to contentSkip to conversation

pinctrl: Iterate over u300_pmx_mask's in u300_pmx_endisable

PATCH Applied Rajendra Nayak 2 participants 2 messages Nov 15, 2011 – Nov 17, 2011 Pin control

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pinctrl: Iterate over u300_pmx_mask's in u300_pmx_endisable

Fix u300_pmx_endisable() to iterate over the list of 'bits' and 'mask' populated as part of u300_pmx_functions.mask[]

---
Linus W,
I am not sure if this is a right fix. I just stumbled upon this while looking at the u300 pinmux driver while I was writing one for OMAP. Maybe I am reading the code completely wrong, and I don't even have a way to test this, so its just compile tested with u300_defconfig.

 drivers/pinctrl/pinmux-u300.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
drivers/pinctrl/pinmux-u300.c +5 -2
index 4858a64..145a84d 100644
@@ -940,20 +940,23 @@ static void u300_pmx_endisable(struct u300_pmx *upmx, unsigned selector,
 {
 	u16 regval, val, mask;
 	int i;
+	const struct u300_pmx_mask *upmx_mask;
 
+	upmx_mask = u300_pmx_functions[selector].mask;
 	for (i = 0; i < ARRAY_SIZE(u300_pmx_registers); i++) {
 		if (enable)
-			val = u300_pmx_functions[selector].mask->bits;
+			val = upmx_mask->bits;
 		else
 			val = 0;
 
-		mask = u300_pmx_functions[selector].mask->mask;
+		mask = upmx_mask->mask;
 		if (mask != 0) {
 			regval = readw(upmx->virtbase + u300_pmx_registers[i]);
 			regval &= ~mask;
 			regval |= val;
 			writew(regval, upmx->virtbase + u300_pmx_registers[i]);
 		}
+		upmx_mask++;
 	}
 }
 
Signature · 1 line
1.7.1
#1 lore raw
Quoted 4 lines · Rajendra Nayak

Fix u300_pmx_endisable() to iterate over the list of 'bits' and 'mask' populated as part of u300_pmx_functions.mask[]

Quoted 8 lines

---
Linus W,
I am not sure if this is a right fix. I just stumbled upon this while looking at the u300 pinmux driver while I was writing one for OMAP. Maybe I am reading the code completely wrong, and I don't even have a way to test this, so its just compile tested with u300_defconfig.

Looks correct and works, I've just been saved by the fact that most mux settings are in a good default mode when powering on the system.

Thanks, applied!
Linus Walleij