mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Sebastian Reichel <sre@kernel.org>
Cc: Xiongfeng Wang <wangxiongfeng2@huawei.com>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] test_power: add missing newlines when printing parameters by sysfs
Date: Sat, 03 Oct 2020 14:55:41 -0700	[thread overview]
Message-ID: <9822843f764520e1076a92fd9120294aa393a085.camel@perches.com> (raw)
In-Reply-To: <20201003215029.jsugcgpgrmcmydr3@earth.universe>

On Sat, 2020-10-03 at 23:50 +0200, Sebastian Reichel wrote:
> Hi,
> 
> On Sat, Oct 03, 2020 at 02:43:09PM -0700, Joe Perches wrote:
> > On Sat, 2020-10-03 at 23:23 +0200, Sebastian Reichel wrote:
> > > On Fri, Sep 04, 2020 at 02:09:58PM +0800, Xiongfeng Wang wrote:
> > > > When I cat some module parameters by sysfs, it displays as follows.
> > > > It's better to add a newline for easy reading.
> > []
> > > > root@syzkaller:~# cd /sys/module/test_power/parameters/
> > > > root@syzkaller:/sys/module/test_power/parameters# cat ac_online
> > > > onroot@syzkaller:/sys/module/test_power/parameters# cat battery_present
> > > > trueroot@syzkaller:/sys/module/test_power/parameters# cat battery_health
> > > > goodroot@syzkaller:/sys/module/test_power/parameters# cat battery_status
> > > > dischargingroot@syzkaller:/sys/module/test_power/parameters# cat battery_technology
> > > > LIONroot@syzkaller:/sys/module/test_power/parameters# cat usb_online
> > > > onroot@syzkaller:/sys/module/test_power/parameters#
> > > > 
> > > > Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
> > > > ---
> > > 
> > > Thanks, queued.
> > []
> > > > diff --git a/drivers/power/supply/test_power.c b/drivers/power/supply/test_power.c
> > []
> > > > @@ -353,6 +353,7 @@ static int param_set_ac_online(const char *key, const struct kernel_param *kp)
> > > >  static int param_get_ac_online(char *buffer, const struct kernel_param *kp)
> > > >  {
> > > >  	strcpy(buffer, map_get_key(map_ac_online, ac_online, "unknown"));
> > > > +	strcat(buffer, "\n");
> > > >  	return strlen(buffer);
> > > >  }
> > 
> > All of these would be better as sprintf(buffer, "%s\n", <whatever>)
> > so the output is scanned just once instead of scanned three times.
> 
> Agreed. Anybody willing to send a patch? :)

Well, you _are_ the maintainer. Why not you?



  reply	other threads:[~2020-10-03 21:55 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-04  6:09 Xiongfeng Wang
2020-10-03 21:23 ` Sebastian Reichel
2020-10-03 21:43   ` Joe Perches
2020-10-03 21:50     ` Sebastian Reichel
2020-10-03 21:55       ` Joe Perches [this message]
2020-10-04 22:16         ` Sebastian Reichel
2020-10-05  1:30           ` Harley A.W. Lorenzo
2020-10-05  4:19             ` Joe Perches
2020-10-05  4:44               ` Harley A.W. Lorenzo
2020-10-08 23:07                 ` Sebastian Reichel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9822843f764520e1076a92fd9120294aa393a085.camel@perches.com \
    --to=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=sre@kernel.org \
    --cc=wangxiongfeng2@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®