All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Arlott <simon@fire.lp0.eu>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Duncan Sands <duncan.sands@math.u-psud.fr>,
	Greg Kroah-Hartman <gregkh@suse.de>
Subject: Re: [PATCH (rev 2)] cxacru: Cleanup sysfs attribute code
Date: Sat, 28 Apr 2007 09:58:57 +0100	[thread overview]
Message-ID: <46330CD1.8040306@simon.arlott.org.uk> (raw)
In-Reply-To: <20070428005028.54f1b621.akpm@linux-foundation.org>

On 28/04/07 08:50, Andrew Morton wrote:
> On Wed, 25 Apr 2007 19:41:20 +0100 Simon Arlott <simon@fire.lp0.eu> wrote:
>> This changes the format of unknown status values to be less verbose and 
>> uses an array instead of several different snprintf calls. Since only 
>> enum values are assigned to it, poll_state is changed from int to enum. 
>> Use abs() for dB values instead of two almost identical return lines.
>> ...
>> +	static char *str[] = { "no", "yes" };
>> +	if (unlikely(value >= ARRAY_SIZE(str)))
>> +		return snprintf(buf, PAGE_SIZE, "%u\n", value);
>> +	return snprintf(buf, PAGE_SIZE, "%s\n", str[value]);
> 
> Should a bool be displayed as "true" or "false"?

The only attribute that uses this is line_startable... I suppose 
it could return true/false - I just happened to use yes/no.

>> +		return snprintf(buf, PAGE_SIZE, "%u\n", value);
> 
> To be completely pedantic: we shouldn't be printing u32's with %u.  Because
> %u assumes that u32 is implemented as unsigned int.  Only it's an opaque
> type and we don't know what actual C type the architecture chose to use.
> 
> It happens to work OK on all architectures and I expect it always will, so
> no change is needed, but there you have it.

Ok.

> u64's and %llu _are_ incompatible on some architectures and I get to fix
> that about 1000000 times.

-- 
Simon Arlott

      reply	other threads:[~2007-04-28  8:59 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
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 [this message]

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=46330CD1.8040306@simon.arlott.org.uk \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.