Skip to contentSkip to conversation

pinctrl: pinctrl-single: Fix the pins debug output

PATCH In review Benoit Cousson 2 participants 2 messages Nov 8, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pinctrl: pinctrl-single: Fix the pins debug output

The offset parameter is in fact the pin index. The printed value is then most of the time wrong.
Multiply that value by the width to get the proper offset.

---

Hi Tony,

I guess that should probably go for 3.7-rc.

Regards,
Benoit

 drivers/pinctrl/pinctrl-single.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/pinctrl/pinctrl-single.c +1 -1
index 726a729..aeca3bd 100644
@@ -251,7 +251,7 @@ static void pcs_pin_dbg_show(struct pinctrl_dev *pctldev,
 
 	pcs = pinctrl_dev_get_drvdata(pctldev);
 
-	val = pcs->read(pcs->base + offset);
+	val = pcs->read(pcs->base + offset * (pcs->width / BITS_PER_BYTE));
 	val &= pcs->fmask;
 
 	seq_printf(s, "%08x %s " , val, DRIVER_NAME);
Signature · 1 line
1.7.0.4
maintainer
#1 lore raw
Quoted 5 lines · Benoit Cousson

The offset parameter is in fact the pin index. The printed value is then most of the time wrong.
Multiply that value by the width to get the proper offset.

Quoted 8 lines

---

Hi Tony,

I guess that should probably go for 3.7-rc.

Regards,
Benoit

There is a similar patch already posted by Haojian at:

http://www.spinics.net/lists/arm-kernel/msg205682.html

Linus' take was that by definition a debug output fix is not a fix, so not for the -rc cycle.

Haojian is adding support for pinconf, so let's use his version as it also removes the fmask allowing it to show the whole register.

Regards,

Tony

Quoted 18 lines
 drivers/pinctrl/pinctrl-single.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/pinctrl/pinctrl-single.c +1 -1
index 726a729..aeca3bd 100644
@@ -251,7 +251,7 @@ static void pcs_pin_dbg_show(struct pinctrl_dev *pctldev,
 
 	pcs = pinctrl_dev_get_drvdata(pctldev);
 
-	val = pcs->read(pcs->base + offset);
+	val = pcs->read(pcs->base + offset * (pcs->width / BITS_PER_BYTE));
 	val &= pcs->fmask;
 
 	seq_printf(s, "%08x %s " , val, DRIVER_NAME);
Signature · 1 line
1.7.0.4