pwm: core: Use str_plural() in pwm_seq_show()
PATCH 1/1 pwm: core: Use str_plural() in pwm_seq_show()
Use existing str_plural() function rather than duplicating its implementation.
./drivers/pwm/core.c:1690:6-16: opportunity for str_plural(chip->npwm).
Reported-by Abaci Robot <[email protected]>
Signed-off-by Jiapeng Chong <[email protected]>
--- drivers/pwm/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pwm/core.c +1 -1
@@ -1687,7 +1687,7 @@ static int pwm_seq_show(struct seq_file *s, void *v) (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" : ""); + str_plural(chip->npwm));pwm_dbg_show (chip, s);
Signature · 1 line
2.20.1.7.g153144c
Quoted 17 lines · Jiapeng Chong
Use existing
str_plural()function rather than duplicating its implementation../drivers/pwm/core.c:1690:6-16: opportunity for
str_plural(chip->npwm).Reported-by Abaci Robot <[email protected]>Signed-off-by Jiapeng Chong <[email protected]>--- drivers/pwm/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/pwm/core.c +0
-0
drivers/pwm/core.c static int pwm_seq_show(struct seq_file *s, void *v) · line 1692
Quoted 7 lines
drivers/pwm/core.c +1
-1@@ -1687,7 +1687,7 @@ static int pwm_seq_show(struct seq_file *s, void *v) (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" : ""); + str_plural(chip->npwm));pwm_dbg_show (chip, s);
I'm not convinced this change to be beneficial. Given that emitting npwm doesn't add a valuable information[1], I tend to suggest instead:
drivers/pwm/core.c +2 -3
@@ -1683,11 +1683,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\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)))pwm_dbg_show (chip, s);
If you want to pick up on this, feel free to use this patch without attribution.
Best regards
Uwe
[1] pwm_dbg_show() emits npwm lines, so the value can be determined easily.