From: Duncan Sands <duncan.sands@math.u-psud.fr>
To: Simon Arlott <simon@fire.lp0.eu>
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 09:19:50 +0200 [thread overview]
Message-ID: <200704250919.50382.duncan.sands@math.u-psud.fr> (raw)
In-Reply-To: <462E730F.3090401@simon.arlott.org.uk>
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"?
> + 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!
Ciao,
Duncan.
next prev parent reply other threads:[~2007-04-25 7:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-24 21:13 Simon Arlott
2007-04-25 7:19 ` Duncan Sands [this message]
2007-04-25 11:18 ` Simon Arlott
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=200704250919.50382.duncan.sands@math.u-psud.fr \
--to=duncan.sands@math.u-psud.fr \
--cc=akpm@linux-foundation.org \
--cc=gregkh@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=simon@fire.lp0.eu \
/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®