2022-11-01 20:54:57

by Siarhei Volkau

[permalink] [raw]
Subject: [PATCH 0/2] 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(-)

--
2.36.1



2022-11-01 21:09:37

by Siarhei Volkau

[permalink] [raw]
Subject: [PATCH 2/2] docs/pinctrl: fix runtime pinmuxing example

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

Signed-off-by: Siarhei Volkau <[email protected]>
---
Documentation/driver-api/pin-control.rst | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Documentation/driver-api/pin-control.rst b/Documentation/driver-api/pin-control.rst
index 19a41c68d..0022e930e 100644
--- a/Documentation/driver-api/pin-control.rst
+++ b/Documentation/driver-api/pin-control.rst
@@ -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))
...
}
--
2.36.1


2022-11-01 21:13:08

by Siarhei Volkau

[permalink] [raw]
Subject: [PATCH 1/2] docs/pinctrl: fix pinctrl_select_state examples

The function requires two arguments.

Signed-off-by: Siarhei Volkau <[email protected]>
---
Documentation/driver-api/pin-control.rst | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/Documentation/driver-api/pin-control.rst b/Documentation/driver-api/pin-control.rst
index 71eefe5a0..19a41c68d 100644
--- a/Documentation/driver-api/pin-control.rst
+++ b/Documentation/driver-api/pin-control.rst
@@ -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)
...

--
2.36.1


2022-11-08 14:25:31

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH 0/2] docs/pinctrl: fix pinctrl examples

On Tue, Nov 1, 2022 at 9:52 PM Siarhei Volkau <[email protected]> wrote:

> 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