LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH v2 0/2] pinctrl: single: Move test PCS_HAS_PINCONF in pcs_parse_bits_in_pinctrl_entry() to the beginning and fix its return value
@ 2021-07-22 3:39 Zhen Lei
2021-07-22 3:39 ` [PATCH v2 1/2] pinctrl: single: Fix error return code in pcs_parse_bits_in_pinctrl_entry() Zhen Lei
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Zhen Lei @ 2021-07-22 3:39 UTC (permalink / raw)
To: Tony Lindgren, Haojian Zhuang, Linus Walleij, linux-arm-kernel,
linux-omap, linux-gpio, linux-kernel
Cc: Zhen Lei
v1 --> v2:
Split bugfix and cleanup into two patches.
Zhen Lei (2):
pinctrl: single: Fix error return code in
pcs_parse_bits_in_pinctrl_entry()
pinctrl: single: Move test PCS_HAS_PINCONF in
pcs_parse_bits_in_pinctrl_entry() to the beginning
drivers/pinctrl/pinctrl-single.c | 21 ++++++++-------------
1 file changed, 8 insertions(+), 13 deletions(-)
--
2.25.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 1/2] pinctrl: single: Fix error return code in pcs_parse_bits_in_pinctrl_entry()
2021-07-22 3:39 [PATCH v2 0/2] pinctrl: single: Move test PCS_HAS_PINCONF in pcs_parse_bits_in_pinctrl_entry() to the beginning and fix its return value Zhen Lei
@ 2021-07-22 3:39 ` Zhen Lei
2021-07-22 3:39 ` [PATCH v2 2/2] pinctrl: single: Move test PCS_HAS_PINCONF in pcs_parse_bits_in_pinctrl_entry() to the beginning Zhen Lei
2021-08-10 12:43 ` [PATCH v2 0/2] pinctrl: single: Move test PCS_HAS_PINCONF in pcs_parse_bits_in_pinctrl_entry() to the beginning and fix its return value Linus Walleij
2 siblings, 0 replies; 5+ messages in thread
From: Zhen Lei @ 2021-07-22 3:39 UTC (permalink / raw)
To: Tony Lindgren, Haojian Zhuang, Linus Walleij, linux-arm-kernel,
linux-omap, linux-gpio, linux-kernel
Cc: Zhen Lei
Fix to return -ENOTSUPP instead of 0 when PCS_HAS_PINCONF is true, which
is the same as that returned in pcs_parse_pinconf().
Fixes: 4e7e8017a80e ("pinctrl: pinctrl-single: enhance to configure multiple pins of different modules")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
---
drivers/pinctrl/pinctrl-single.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
index e3aa64798f7d..4fcae8458359 100644
--- a/drivers/pinctrl/pinctrl-single.c
+++ b/drivers/pinctrl/pinctrl-single.c
@@ -1224,6 +1224,7 @@ static int pcs_parse_bits_in_pinctrl_entry(struct pcs_device *pcs,
if (PCS_HAS_PINCONF) {
dev_err(pcs->dev, "pinconf not supported\n");
+ res = -ENOTSUPP;
goto free_pingroups;
}
--
2.25.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 2/2] pinctrl: single: Move test PCS_HAS_PINCONF in pcs_parse_bits_in_pinctrl_entry() to the beginning
2021-07-22 3:39 [PATCH v2 0/2] pinctrl: single: Move test PCS_HAS_PINCONF in pcs_parse_bits_in_pinctrl_entry() to the beginning and fix its return value Zhen Lei
2021-07-22 3:39 ` [PATCH v2 1/2] pinctrl: single: Fix error return code in pcs_parse_bits_in_pinctrl_entry() Zhen Lei
@ 2021-07-22 3:39 ` Zhen Lei
2021-07-27 9:56 ` Tony Lindgren
2021-08-10 12:43 ` [PATCH v2 0/2] pinctrl: single: Move test PCS_HAS_PINCONF in pcs_parse_bits_in_pinctrl_entry() to the beginning and fix its return value Linus Walleij
2 siblings, 1 reply; 5+ messages in thread
From: Zhen Lei @ 2021-07-22 3:39 UTC (permalink / raw)
To: Tony Lindgren, Haojian Zhuang, Linus Walleij, linux-arm-kernel,
linux-omap, linux-gpio, linux-kernel
Cc: Zhen Lei
The value of pcs->flags is not overwritten in function
pcs_parse_bits_in_pinctrl_entry() and its subfunctions, so moving this
check to the beginning of the function eliminates unnecessary rollback
operations.
Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com>
---
drivers/pinctrl/pinctrl-single.c | 22 ++++++++--------------
1 file changed, 8 insertions(+), 14 deletions(-)
diff --git a/drivers/pinctrl/pinctrl-single.c b/drivers/pinctrl/pinctrl-single.c
index 4fcae8458359..d8b4dc40f3c6 100644
--- a/drivers/pinctrl/pinctrl-single.c
+++ b/drivers/pinctrl/pinctrl-single.c
@@ -1115,7 +1115,7 @@ static int pcs_parse_bits_in_pinctrl_entry(struct pcs_device *pcs,
{
const char *name = "pinctrl-single,bits";
struct pcs_func_vals *vals;
- int rows, *pins, found = 0, res = -ENOMEM, i, fsel, gsel;
+ int rows, *pins, found = 0, res = -ENOMEM, i, fsel;
int npins_in_row;
struct pcs_function *function = NULL;
@@ -1125,6 +1125,11 @@ static int pcs_parse_bits_in_pinctrl_entry(struct pcs_device *pcs,
return -EINVAL;
}
+ if (PCS_HAS_PINCONF) {
+ dev_err(pcs->dev, "pinconf not supported\n");
+ return -ENOTSUPP;
+ }
+
npins_in_row = pcs->width / pcs->bits_per_pin;
vals = devm_kzalloc(pcs->dev,
@@ -1212,30 +1217,19 @@ static int pcs_parse_bits_in_pinctrl_entry(struct pcs_device *pcs,
goto free_pins;
}
- gsel = pinctrl_generic_add_group(pcs->pctl, np->name, pins, found, pcs);
- if (gsel < 0) {
- res = gsel;
+ res = pinctrl_generic_add_group(pcs->pctl, np->name, pins, found, pcs);
+ if (res < 0)
goto free_function;
- }
(*map)->type = PIN_MAP_TYPE_MUX_GROUP;
(*map)->data.mux.group = np->name;
(*map)->data.mux.function = np->name;
- if (PCS_HAS_PINCONF) {
- dev_err(pcs->dev, "pinconf not supported\n");
- res = -ENOTSUPP;
- goto free_pingroups;
- }
-
*num_maps = 1;
mutex_unlock(&pcs->mutex);
return 0;
-free_pingroups:
- pinctrl_generic_remove_group(pcs->pctl, gsel);
- *num_maps = 1;
free_function:
pinmux_generic_remove_function(pcs->pctl, fsel);
free_pins:
--
2.25.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 2/2] pinctrl: single: Move test PCS_HAS_PINCONF in pcs_parse_bits_in_pinctrl_entry() to the beginning
2021-07-22 3:39 ` [PATCH v2 2/2] pinctrl: single: Move test PCS_HAS_PINCONF in pcs_parse_bits_in_pinctrl_entry() to the beginning Zhen Lei
@ 2021-07-27 9:56 ` Tony Lindgren
0 siblings, 0 replies; 5+ messages in thread
From: Tony Lindgren @ 2021-07-27 9:56 UTC (permalink / raw)
To: Zhen Lei
Cc: Haojian Zhuang, Linus Walleij, linux-arm-kernel, linux-omap,
linux-gpio, linux-kernel
* Zhen Lei <thunder.leizhen@huawei.com> [210722 03:40]:
> The value of pcs->flags is not overwritten in function
> pcs_parse_bits_in_pinctrl_entry() and its subfunctions, so moving this
> check to the beginning of the function eliminates unnecessary rollback
> operations.
Looks OK to me:
Reviewed-by: Tony Lindgren <tony@atomide.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2 0/2] pinctrl: single: Move test PCS_HAS_PINCONF in pcs_parse_bits_in_pinctrl_entry() to the beginning and fix its return value
2021-07-22 3:39 [PATCH v2 0/2] pinctrl: single: Move test PCS_HAS_PINCONF in pcs_parse_bits_in_pinctrl_entry() to the beginning and fix its return value Zhen Lei
2021-07-22 3:39 ` [PATCH v2 1/2] pinctrl: single: Fix error return code in pcs_parse_bits_in_pinctrl_entry() Zhen Lei
2021-07-22 3:39 ` [PATCH v2 2/2] pinctrl: single: Move test PCS_HAS_PINCONF in pcs_parse_bits_in_pinctrl_entry() to the beginning Zhen Lei
@ 2021-08-10 12:43 ` Linus Walleij
2 siblings, 0 replies; 5+ messages in thread
From: Linus Walleij @ 2021-08-10 12:43 UTC (permalink / raw)
To: Zhen Lei
Cc: Tony Lindgren, Haojian Zhuang, linux-arm-kernel, linux-omap,
linux-gpio, linux-kernel
On Thu, Jul 22, 2021 at 5:40 AM Zhen Lei <thunder.leizhen@huawei.com> wrote:
> v1 --> v2:
> Split bugfix and cleanup into two patches.
Patches applied! Thanks for fixing this Zhen, sorry for the delay.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2021-08-10 12:43 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-22 3:39 [PATCH v2 0/2] pinctrl: single: Move test PCS_HAS_PINCONF in pcs_parse_bits_in_pinctrl_entry() to the beginning and fix its return value Zhen Lei
2021-07-22 3:39 ` [PATCH v2 1/2] pinctrl: single: Fix error return code in pcs_parse_bits_in_pinctrl_entry() Zhen Lei
2021-07-22 3:39 ` [PATCH v2 2/2] pinctrl: single: Move test PCS_HAS_PINCONF in pcs_parse_bits_in_pinctrl_entry() to the beginning Zhen Lei
2021-07-27 9:56 ` Tony Lindgren
2021-08-10 12:43 ` [PATCH v2 0/2] pinctrl: single: Move test PCS_HAS_PINCONF in pcs_parse_bits_in_pinctrl_entry() to the beginning and fix its return value Linus Walleij
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).