diff mbox series

pwm: Simplify printf to emit chip->npwm in $debugfs/pwm

Message ID 20250926165702.321514-2-u.kleine-koenig@baylibre.com
State Accepted
Headers show
Series pwm: Simplify printf to emit chip->npwm in $debugfs/pwm | expand

Commit Message

Uwe Kleine-König Sept. 26, 2025, 4:57 p.m. UTC
Instead of caring to correctly pluralize "PWM device(s)" using

	(chip->npwm != 1) ? "s" : ""

or

	str_plural(chip->npwm)

just simplify the format to not need a plural-s.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
---
Hello,

this implements the patch I mused about in
https://lore.kernel.org/linux-pwm/fol4hemfnbh7km5dfdkbrfxx3txc4wtv7jvdn4h2xlzxlcoyht@ax7ml3rq53zs/

Best regards
Uwe

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


base-commit: 8f2689f194b8d1bff41150ae316abdfccf191309

Comments

Uwe Kleine-König Oct. 9, 2025, 4:36 p.m. UTC | #1
Hello,

On Fri, Sep 26, 2025 at 06:57:03PM +0200, Uwe Kleine-König wrote:
> Instead of caring to correctly pluralize "PWM device(s)" using
> 
> 	(chip->npwm != 1) ? "s" : ""
> 
> or
> 
> 	str_plural(chip->npwm)
> 
> just simplify the format to not need a plural-s.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
> ---
> Hello,
> 
> this implements the patch I mused about in
> https://lore.kernel.org/linux-pwm/fol4hemfnbh7km5dfdkbrfxx3txc4wtv7jvdn4h2xlzxlcoyht@ax7ml3rq53zs/

I applied this patch to

https://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux.git pwm/for-nexxt

as v6.19-rc1 material.

Best regards
Uwe
diff mbox series

Patch

diff --git a/drivers/pwm/core.c b/drivers/pwm/core.c
index ea2ccf42e814..5b75f4a08496 100644
--- a/drivers/pwm/core.c
+++ b/drivers/pwm/core.c
@@ -2696,11 +2696,10 @@  static int pwm_seq_show(struct seq_file *s, void *v)
 {
 	struct pwm_chip *chip = v;
 
-	seq_printf(s, "%s%d: %s/%s, %d PWM device%s\n",
+	seq_printf(s, "%s%d: %s/%s, npwm: %d\n",
 		   (char *)s->private, chip->id,
 		   pwmchip_parent(chip)->bus ? pwmchip_parent(chip)->bus->name : "no-bus",
-		   dev_name(pwmchip_parent(chip)), chip->npwm,
-		   (chip->npwm != 1) ? "s" : "");
+		   dev_name(pwmchip_parent(chip)), chip->npwm);
 
 	pwm_dbg_show(chip, s);