Skip to contentSkip to conversation

docs/pinctrl: fix pinctrl examples

PATCH In review Siarhei Volkau 2 participants 4 messages Nov 1, 2022 – Nov 8, 2022

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

cover docs/pinctrl: fix pinctrl examples

The document has some typos in the examples related to using pinctrl_select_state function and out-of-context variables. The patchset aims to fix that.

Siarhei Volkau (2):
docs/pinctrl: fix pinctrl_select_state examples
docs/pinctrl: fix runtime pinmuxing example

 Documentation/driver-api/pin-control.rst | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
Signature · 1 line
2.36.1
#1 lore raw

PATCH 1/2 docs/pinctrl: fix pinctrl_select_state examples

The function requires two arguments.

---
 Documentation/driver-api/pin-control.rst | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Documentation/driver-api/pin-control.rst +3 -3
index 71eefe5a0..19a41c68d 100644
@@ -1238,7 +1238,7 @@ default state like this::
 			return PTR_ERR(foo->s);
 		}
 
-		ret = pinctrl_select_state(foo->s);
+		ret = pinctrl_select_state(foo->p, foo->s);
 		if (ret < 0) {
 			/* FIXME: clean up "foo" here */
 			return ret;
@@ -1411,14 +1411,14 @@ on the pins defined by group B::
 	foo_switch()
 	{
 		/* Enable on position A */
-		ret = pinctrl_select_state(s1);
+		ret = pinctrl_select_state(p, s1);
 		if (ret < 0)
 		...
 
 		...
 
 		/* Enable on position B */
-		ret = pinctrl_select_state(s2);
+		ret = pinctrl_select_state(p, s2);
 		if (ret < 0)
 		...
 
Signature · 1 line
2.36.1
#2 lore raw

PATCH 2/2 docs/pinctrl: fix runtime pinmuxing example

In reply to Siarhei Volkau

The example declares "struct pinctrl *p" but refers to "foo->p" which isn't declared in the context of the example.

---
 Documentation/driver-api/pin-control.rst | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/driver-api/pin-control.rst +2 -2
index 19a41c68d..0022e930e 100644
@@ -1399,11 +1399,11 @@ on the pins defined by group B::
 		if (IS_ERR(p))
 			...
 
-		s1 = pinctrl_lookup_state(foo->p, "pos-A");
+		s1 = pinctrl_lookup_state(p, "pos-A");
 		if (IS_ERR(s1))
 			...
 
-		s2 = pinctrl_lookup_state(foo->p, "pos-B");
+		s2 = pinctrl_lookup_state(p, "pos-B");
 		if (IS_ERR(s2))
 			...
 	}
Signature · 1 line
2.36.1
#3 lore raw
In reply to Siarhei Volkau
Quoted 3 lines · Siarhei Volkau

The document has some typos in the examples related to using pinctrl_select_state function and out-of-context variables. The patchset aims to fix that.

Thanks so much for fixing this! My ages old mistakes...

Patches applied.

Yours,
Linus Walleij