linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] arm: orion5x: use string choices helper
@ 2025-06-17  2:22 Kuninori Morimoto
  2025-06-17  6:14 ` Andy Shevchenko
  0 siblings, 1 reply; 3+ messages in thread
From: Kuninori Morimoto @ 2025-06-17  2:22 UTC (permalink / raw)
  To: Alexander Clouter, Andrew Lunn, Gregory Clement, Russell King,
	Sebastian Hesselbarth
  Cc: Andy Shevchenko, Kees Cook, linux-arm-kernel

It updates format to keep "online/offline".

-	sprintf(buf, "%s\n",     ...? "online" : "offline");
+	sprintf(buf, "%sline\n", ..., str_on_off(...));
	                ^^^^

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
---
v1 -> v2
	- add git-comment
	- add Reviewed-by

 arch/arm/mach-orion5x/ts78xx-setup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-orion5x/ts78xx-setup.c b/arch/arm/mach-orion5x/ts78xx-setup.c
index af810e7ccd79..c250703e696d 100644
--- a/arch/arm/mach-orion5x/ts78xx-setup.c
+++ b/arch/arm/mach-orion5x/ts78xx-setup.c
@@ -460,7 +460,7 @@ static ssize_t ts78xx_fpga_show(struct kobject *kobj,
 	if (ts78xx_fpga.state < 0)
 		return sprintf(buf, "borked\n");
 
-	return sprintf(buf, "%s\n", (ts78xx_fpga.state) ? "online" : "offline");
+	return sprintf(buf, "%sline\n", str_on_off(ts78xx_fpga.state));
 }
 
 static ssize_t ts78xx_fpga_store(struct kobject *kobj,
-- 
2.43.0



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

* Re: [PATCH v2] arm: orion5x: use string choices helper
  2025-06-17  2:22 [PATCH v2] arm: orion5x: use string choices helper Kuninori Morimoto
@ 2025-06-17  6:14 ` Andy Shevchenko
  2025-06-17 12:56   ` Andrew Lunn
  0 siblings, 1 reply; 3+ messages in thread
From: Andy Shevchenko @ 2025-06-17  6:14 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Alexander Clouter, Andrew Lunn, Gregory Clement, Russell King,
	Sebastian Hesselbarth, Andy Shevchenko, Kees Cook,
	linux-arm-kernel

On Tue, Jun 17, 2025 at 5:22 AM Kuninori Morimoto
<kuninori.morimoto.gx@renesas.com> wrote:
>
> It updates format to keep "online/offline".
>
> -       sprintf(buf, "%s\n",     ...? "online" : "offline");
> +       sprintf(buf, "%sline\n", ..., str_on_off(...));
>                         ^^^^

With all the respect to Andrew and his review, this is still NAK, but
now from me. Add the respective helper to the string_choices.h, the
proposed change is harder to read and it makes things confusing.

-- 
With Best Regards,
Andy Shevchenko


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

* Re: [PATCH v2] arm: orion5x: use string choices helper
  2025-06-17  6:14 ` Andy Shevchenko
@ 2025-06-17 12:56   ` Andrew Lunn
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2025-06-17 12:56 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Kuninori Morimoto, Alexander Clouter, Gregory Clement,
	Russell King, Sebastian Hesselbarth, Andy Shevchenko, Kees Cook,
	linux-arm-kernel

On Tue, Jun 17, 2025 at 09:14:10AM +0300, Andy Shevchenko wrote:
> On Tue, Jun 17, 2025 at 5:22 AM Kuninori Morimoto
> <kuninori.morimoto.gx@renesas.com> wrote:
> >
> > It updates format to keep "online/offline".
> >
> > -       sprintf(buf, "%s\n",     ...? "online" : "offline");
> > +       sprintf(buf, "%sline\n", ..., str_on_off(...));
> >                         ^^^^
> 
> With all the respect to Andrew and his review, this is still NAK, but
> now from me. Add the respective helper to the string_choices.h, the
> proposed change is harder to read and it makes things confusing.

Fine by me. It looks like it could be used in at least one other
place, handle_hotplug().

	Andrew


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

end of thread, other threads:[~2025-06-17 13:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-17  2:22 [PATCH v2] arm: orion5x: use string choices helper Kuninori Morimoto
2025-06-17  6:14 ` Andy Shevchenko
2025-06-17 12:56   ` Andrew Lunn

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).