lkml.org 
[lkml]   [2007]   [Apr]   [25]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
FromDuncan Sands <>
SubjectRe: [PATCH] cxacru: Cleanup sysfs attribute code
DateWed, 25 Apr 2007 09:19:50 +0200
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.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-04-25 07:23    [from the cache]
©2003-2008