From: "Simon Arlott" <simon@fire.lp0.eu>
To: "Duncan Sands" <duncan.sands@math.u-psud.fr>
Cc: "Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
"Greg Kroah-Hartman" <gregkh@suse.de>,
"Andrew Morton" <akpm@linux-foundation.org>
Subject: Re: [PATCH] cxacru: Cleanup sysfs attribute code
Date: Wed, 25 Apr 2007 12:18:03 +0100 [thread overview]
Message-ID: <11882.simon.1177499883@5ec7c279.invalid> (raw)
In-Reply-To: <200704250919.50382.duncan.sands@math.u-psud.fr>
On Wed, April 25, 2007 08:19, Duncan Sands wrote:
> Hi Simon,
>
>> static ssize_t cxacru_sysfs_showattr_dB(s16 value, char *buf)
>> {
>> - if (unlikely(value < 0)) {
>> - return snprintf(buf, PAGE_SIZE, "%d.%02u\n",
>> - value / 100, -value % 100);
>> - } else {
>> - return snprintf(buf, PAGE_SIZE, "%d.%02u\n",
>> - value / 100, value % 100);
>> - }
>> + return snprintf(buf, PAGE_SIZE, "%u.%02u\n",
>> + value / 100, abs(value) % 100);
>
> shouldn't this be "%d.%02u\n"?
Yes, I'll send an updated patch this evening, unless Andrew adds the change himself by then.
>> + static char *str[] = { "no", "yes" };
> ...
>> + return snprintf(buf, PAGE_SIZE, "%s\n", str[value]);
>
> This could be
> static char *str[] = { "no\n", "yes\n" };
> ...
> return snprintf(buf, PAGE_SIZE, str[value]);
> I'm not saying that it's better, just a remark!
The \ns in the larger arrays were making them less readable.
--
Simon Arlott
next prev parent reply other threads:[~2007-04-25 11:18 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-24 21:13 [PATCH] cxacru: Cleanup sysfs attribute code Simon Arlott
2007-04-25 7:19 ` Duncan Sands
2007-04-25 11:18 ` Simon Arlott [this message]
2007-04-25 18:41 ` [PATCH (rev 2)] " Simon Arlott
2007-04-25 19:33 ` Duncan Sands
2007-04-28 7:50 ` Andrew Morton
2007-04-28 8:58 ` Simon Arlott
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=11882.simon.1177499883@5ec7c279.invalid \
--to=simon@fire.lp0.eu \
--cc=akpm@linux-foundation.org \
--cc=duncan.sands@math.u-psud.fr \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
/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