pwm: More efficient data output in pwm_dbg_show()
Subsystems (2)
cover pwm: More efficient data output in pwm_dbg_show()
From: Markus Elfring <[email protected]>
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(-)
Signature · 1 line
2.54.0
PATCH 1/2 pwm: Simplify data output in pwm_dbg_show()
From: Markus Elfring <[email protected]>
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.
--- drivers/pwm/core.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pwm/core.c +1 -3
@@ -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)
Signature · 1 line
2.54.0
PATCH 2/2 pwm: Use seq_putc() calls in pwm_dbg_show()
In reply to Markus ElfringFrom: Markus Elfring <[email protected]>
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.
--- drivers/pwm/core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pwm/core.c +2 -2
@@ -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' ); } }
Signature · 1 line
2.54.0
Uwe Kleine-König
maintainerHello,
Quoted 9 lines · Markus Elfring
From: Markus Elfring <[email protected]>
Date: Fri, 5 Jun 2026 16:18:19 +0200A few update suggestions were taken into account
from static source code analysis.Markus Elfring (2):
Simplify data output
Useseq_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
PATCH 1/1 pwm: Use another seq_putc() call in pwm_dbg_show()
From: Markus Elfring <[email protected]>
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.
--- drivers/pwm/core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/pwm/core.c +1 -2
@@ -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" );
Signature · 1 line
2.55.0
Uwe Kleine-König
maintainerRe: [PATCH] pwm: Use another seq_putc() call in pwm_dbg_show()
Quoted 9 lines · Markus Elfring
From: Markus Elfring <[email protected]>
Date: Fri, 17 Jul 2026 11:33:55 +0200A 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 <[email protected]>
I squashed this into the commit created from the original patch #2.
Thanks
Uwe