mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] pwm: More efficient data output in pwm_dbg_show()
@ 2026-06-05 14:22 Markus Elfring
  2026-06-05 14:23 ` [PATCH 1/2] pwm: Simplify " Markus Elfring
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Markus Elfring @ 2026-06-05 14:22 UTC (permalink / raw)
  To: linux-pwm, Uwe Kleine-König; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 5 Jun 2026 16:18:19 +0200

A few update suggestions were taken into account
from static source code analysis.

Markus Elfring (2):
  Simplify data output
  Use seq_putc() calls

 drivers/pwm/core.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

-- 
2.54.0


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

* [PATCH 1/2] pwm: Simplify data output in pwm_dbg_show()
  2026-06-05 14:22 [PATCH 0/2] pwm: More efficient data output in pwm_dbg_show() Markus Elfring
@ 2026-06-05 14:23 ` Markus Elfring
  2026-06-05 14:25 ` [PATCH 2/2] pwm: Use seq_putc() calls " Markus Elfring
  2026-07-16  7:45 ` [PATCH 0/2] pwm: More efficient data output " Uwe Kleine-König
  2 siblings, 0 replies; 5+ messages in thread
From: Markus Elfring @ 2026-06-05 14:23 UTC (permalink / raw)
  To: linux-pwm, Uwe Kleine-König; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 5 Jun 2026 15:57:58 +0200

Move the specification for a line break from a seq_puts() call
to a seq_printf() call.

The source code was transformed by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/pwm/core.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
index be4885da85b6..1138b3ffbc12 100644
--- a/drivers/pwm/core.c
+++ b/drivers/pwm/core.c
@@ -2647,9 +2647,7 @@ static void pwm_dbg_show(struct pwm_chip *chip, struct seq_file *s)
 		if (test_bit(PWMF_REQUESTED, &pwm->flags))
 			seq_puts(s, " requested");
 
-		seq_puts(s, "\n");
-
-		seq_printf(s, "  requested configuration: %3sabled, %llu/%llu ns, %s polarity",
+		seq_printf(s, "\n  requested configuration: %3sabled, %llu/%llu ns, %s polarity",
 			   state.enabled ? "en" : "dis", state.duty_cycle, state.period,
 			   state.polarity ? "inverse" : "normal");
 		if (state.usage_power)
-- 
2.54.0


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

* [PATCH 2/2] pwm: Use seq_putc() calls in pwm_dbg_show()
  2026-06-05 14:22 [PATCH 0/2] pwm: More efficient data output in pwm_dbg_show() Markus Elfring
  2026-06-05 14:23 ` [PATCH 1/2] pwm: Simplify " Markus Elfring
@ 2026-06-05 14:25 ` Markus Elfring
  2026-07-16  7:45 ` [PATCH 0/2] pwm: More efficient data output " Uwe Kleine-König
  2 siblings, 0 replies; 5+ messages in thread
From: Markus Elfring @ 2026-06-05 14:25 UTC (permalink / raw)
  To: linux-pwm, Uwe Kleine-König; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 5 Jun 2026 16:12:53 +0200

Single characters should occasionally be put into a sequence.
Thus use the corresponding function “seq_putc”.

The source code was transformed by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/pwm/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
index 1138b3ffbc12..41b02a4a94f3 100644
--- a/drivers/pwm/core.c
+++ b/drivers/pwm/core.c
@@ -2652,7 +2652,7 @@ static void pwm_dbg_show(struct pwm_chip *chip, struct seq_file *s)
 			   state.polarity ? "inverse" : "normal");
 		if (state.usage_power)
 			seq_puts(s, ", usage_power");
-		seq_puts(s, "\n");
+		seq_putc(s, '\n');
 
 		if (pwmchip_supports_waveform(chip)) {
 			struct pwm_waveform wf;
@@ -2675,7 +2675,7 @@ static void pwm_dbg_show(struct pwm_chip *chip, struct seq_file *s)
 				seq_printf(s, "  actual configuration: read out error: %pe", ERR_PTR(err));
 		}
 
-		seq_puts(s, "\n");
+		seq_putc(s, '\n');
 	}
 }
 
-- 
2.54.0


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

* Re: [PATCH 0/2] pwm: More efficient data output in pwm_dbg_show()
  2026-06-05 14:22 [PATCH 0/2] pwm: More efficient data output in pwm_dbg_show() Markus Elfring
  2026-06-05 14:23 ` [PATCH 1/2] pwm: Simplify " Markus Elfring
  2026-06-05 14:25 ` [PATCH 2/2] pwm: Use seq_putc() calls " Markus Elfring
@ 2026-07-16  7:45 ` Uwe Kleine-König
  2026-07-17  9:40   ` [PATCH] pwm: Use another seq_putc() call " Markus Elfring
  2 siblings, 1 reply; 5+ messages in thread
From: Uwe Kleine-König @ 2026-07-16  7:45 UTC (permalink / raw)
  To: Markus Elfring; +Cc: linux-pwm, LKML, kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 542 bytes --]

Hello,

On Fri, Jun 05, 2026 at 04:22:39PM +0200, Markus Elfring wrote:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Fri, 5 Jun 2026 16:18:19 +0200
> 
> A few update suggestions were taken into account
> from static source code analysis.
> 
> Markus Elfring (2):
>   Simplify data output
>   Use seq_putc() calls

I applied the 2nd patch. I don't consider the first an improvement as
the output isn't on a fast path and having the end-of-line separated
from the next is logically sound.

Best regards
Uwe

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* [PATCH] pwm: Use another seq_putc() call in pwm_dbg_show()
  2026-07-16  7:45 ` [PATCH 0/2] pwm: More efficient data output " Uwe Kleine-König
@ 2026-07-17  9:40   ` Markus Elfring
  0 siblings, 0 replies; 5+ messages in thread
From: Markus Elfring @ 2026-07-17  9:40 UTC (permalink / raw)
  To: Uwe Kleine-König, linux-pwm; +Cc: LKML, kernel-janitors

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Fri, 17 Jul 2026 11:33:55 +0200

A single line break should be put into a sequence.
Thus use the corresponding function “seq_putc”.

The source code was transformed by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/pwm/core.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
index fa0f8f1f6ed0..c2d77082c549 100644
--- a/drivers/pwm/core.c
+++ b/drivers/pwm/core.c
@@ -2647,8 +2647,7 @@ static void pwm_dbg_show(struct pwm_chip *chip, struct seq_file *s)
 		if (test_bit(PWMF_REQUESTED, &pwm->flags))
 			seq_puts(s, " requested");
 
-		seq_puts(s, "\n");
-
+		seq_putc(s, '\n');
 		seq_printf(s, "  requested configuration: %3sabled, %llu/%llu ns, %s polarity",
 			   state.enabled ? "en" : "dis", state.duty_cycle, state.period,
 			   state.polarity ? "inverse" : "normal");
-- 
2.55.0


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

end of thread, other threads:[~2026-07-17  9:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-05 14:22 [PATCH 0/2] pwm: More efficient data output in pwm_dbg_show() Markus Elfring
2026-06-05 14:23 ` [PATCH 1/2] pwm: Simplify " Markus Elfring
2026-06-05 14:25 ` [PATCH 2/2] pwm: Use seq_putc() calls " Markus Elfring
2026-07-16  7:45 ` [PATCH 0/2] pwm: More efficient data output " Uwe Kleine-König
2026-07-17  9:40   ` [PATCH] pwm: Use another seq_putc() call " Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox