linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/1] pinctrl: nomadik: Use string_choices API instead of ternary operator
@ 2024-08-26  9:57 Andy Shevchenko
  2024-09-05 12:56 ` Andy Shevchenko
  0 siblings, 1 reply; 5+ messages in thread
From: Andy Shevchenko @ 2024-08-26  9:57 UTC (permalink / raw)
  To: Linus Walleij, Théo Lebrun, linux-arm-kernel, linux-gpio,
	linux-kernel
  Cc: Andy Shevchenko

Use modern string_choices API instead of manually determining the
output using ternary operator.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/pinctrl/nomadik/pinctrl-nomadik.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/pinctrl/nomadik/pinctrl-nomadik.c b/drivers/pinctrl/nomadik/pinctrl-nomadik.c
index fa78d5ecc685..9cc64547730a 100644
--- a/drivers/pinctrl/nomadik/pinctrl-nomadik.c
+++ b/drivers/pinctrl/nomadik/pinctrl-nomadik.c
@@ -28,6 +28,7 @@
 #include <linux/seq_file.h>
 #include <linux/slab.h>
 #include <linux/spinlock.h>
+#include <linux/string_choices.h>
 #include <linux/types.h>
 
 /* Since we request GPIOs from ourself */
@@ -1105,17 +1106,16 @@ static int nmk_pin_config_set(struct pinctrl_dev *pctldev, unsigned int pin,
 				"pin %d: sleep pull %s, dir %s, val %s\n",
 				pin,
 				slpm_pull ? pullnames[pull] : "same",
-				slpm_output ? (output ? "output" : "input")
-				: "same",
-				slpm_val ? (val ? "high" : "low") : "same");
+				slpm_output ? (output ? "output" : "input") : "same",
+				slpm_val ? str_high_low(val) : "same");
 		}
 
 		dev_dbg(nmk_chip->chip.parent,
 			"pin %d [%#lx]: pull %s, slpm %s (%s%s), lowemi %s\n",
 			pin, cfg, pullnames[pull], slpmnames[slpm],
 			output ? "output " : "input",
-			output ? (val ? "high" : "low") : "",
-			lowemi ? "on" : "off");
+			output ? str_high_low(val) : "",
+			str_on_off(lowemi));
 
 		clk_enable(nmk_chip->clk);
 		if (gpiomode)
-- 
2.43.0.rc1.1336.g36b5255a03ac


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v1 1/1] pinctrl: nomadik: Use string_choices API instead of ternary operator
  2024-08-26  9:57 [PATCH v1 1/1] pinctrl: nomadik: Use string_choices API instead of ternary operator Andy Shevchenko
@ 2024-09-05 12:56 ` Andy Shevchenko
  2024-09-23  9:11   ` Linus Walleij
  0 siblings, 1 reply; 5+ messages in thread
From: Andy Shevchenko @ 2024-09-05 12:56 UTC (permalink / raw)
  To: Linus Walleij, Théo Lebrun, linux-arm-kernel, linux-gpio,
	linux-kernel

On Mon, Aug 26, 2024 at 12:57:23PM +0300, Andy Shevchenko wrote:
> Use modern string_choices API instead of manually determining the
> output using ternary operator.

Linus, do you have any comment on this?

I had sent two patches of similar changes (different drivers, thoug),
one got applied and this is not. Anything should I do about it?

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1 1/1] pinctrl: nomadik: Use string_choices API instead of ternary operator
  2024-09-05 12:56 ` Andy Shevchenko
@ 2024-09-23  9:11   ` Linus Walleij
  2024-09-23 10:44     ` Andy Shevchenko
  0 siblings, 1 reply; 5+ messages in thread
From: Linus Walleij @ 2024-09-23  9:11 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Théo Lebrun, linux-arm-kernel, linux-gpio, linux-kernel

On Thu, Sep 5, 2024 at 2:56 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> On Mon, Aug 26, 2024 at 12:57:23PM +0300, Andy Shevchenko wrote:

> > Use modern string_choices API instead of manually determining the
> > output using ternary operator.
>
> Linus, do you have any comment on this?
>
> I had sent two patches of similar changes (different drivers, thoug),
> one got applied and this is not. Anything should I do about it?

Sorry for late reply :(

I thought it looks weird to replace just one string choice
in the middle of everything and it will be confusing for readers?
They will be "but what is this now, this looks weird".

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1 1/1] pinctrl: nomadik: Use string_choices API instead of ternary operator
  2024-09-23  9:11   ` Linus Walleij
@ 2024-09-23 10:44     ` Andy Shevchenko
  2024-10-01 14:28       ` Linus Walleij
  0 siblings, 1 reply; 5+ messages in thread
From: Andy Shevchenko @ 2024-09-23 10:44 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Théo Lebrun, linux-arm-kernel, linux-gpio, linux-kernel

On Mon, Sep 23, 2024 at 11:11:12AM +0200, Linus Walleij wrote:
> On Thu, Sep 5, 2024 at 2:56 PM Andy Shevchenko
> <andriy.shevchenko@linux.intel.com> wrote:
> > On Mon, Aug 26, 2024 at 12:57:23PM +0300, Andy Shevchenko wrote:
> 
> > > Use modern string_choices API instead of manually determining the
> > > output using ternary operator.
> >
> > Linus, do you have any comment on this?
> >
> > I had sent two patches of similar changes (different drivers, thoug),
> > one got applied and this is not. Anything should I do about it?
> 
> Sorry for late reply :(
> 
> I thought it looks weird to replace just one string choice
> in the middle of everything and it will be confusing for readers?
> They will be "but what is this now, this looks weird".

Do you mean it's incomplete? So, i.o.w., if we have str_output_input()
it will go?

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v1 1/1] pinctrl: nomadik: Use string_choices API instead of ternary operator
  2024-09-23 10:44     ` Andy Shevchenko
@ 2024-10-01 14:28       ` Linus Walleij
  0 siblings, 0 replies; 5+ messages in thread
From: Linus Walleij @ 2024-10-01 14:28 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Théo Lebrun, linux-arm-kernel, linux-gpio, linux-kernel

On Mon, Sep 23, 2024 at 12:44 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
> On Mon, Sep 23, 2024 at 11:11:12AM +0200, Linus Walleij wrote:
> > On Thu, Sep 5, 2024 at 2:56 PM Andy Shevchenko
> > <andriy.shevchenko@linux.intel.com> wrote:
> > > On Mon, Aug 26, 2024 at 12:57:23PM +0300, Andy Shevchenko wrote:
> >
> > > > Use modern string_choices API instead of manually determining the
> > > > output using ternary operator.
> > >
> > > Linus, do you have any comment on this?
> > >
> > > I had sent two patches of similar changes (different drivers, thoug),
> > > one got applied and this is not. Anything should I do about it?
> >
> > Sorry for late reply :(
> >
> > I thought it looks weird to replace just one string choice
> > in the middle of everything and it will be confusing for readers?
> > They will be "but what is this now, this looks weird".
>
> Do you mean it's incomplete? So, i.o.w., if we have str_output_input()
> it will go?

Yeps it looks half-way otherwise.

I wasn't a big fan of the choices but no strong feelings about it
either so as long as it's consistent I will be OK with it.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-10-01 14:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-26  9:57 [PATCH v1 1/1] pinctrl: nomadik: Use string_choices API instead of ternary operator Andy Shevchenko
2024-09-05 12:56 ` Andy Shevchenko
2024-09-23  9:11   ` Linus Walleij
2024-09-23 10:44     ` Andy Shevchenko
2024-10-01 14:28       ` 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).