projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
15b8e19
)
cxacru: Fix negative dB output
author
Simon Arlott
<
[email protected]
>
Mon, 27 Apr 2009 10:22:15 +0000
(
03:22
-0700)
committer
David S. Miller
<
[email protected]
>
Mon, 27 Apr 2009 10:22:15 +0000
(
03:22
-0700)
Values of dB between -0.99 and -0.01 will be output with the wrong
sign. This converts the negative value to positive and outputs it
with a "-" prefix.
Signed-off-by: Simon Arlott <
[email protected]
>
Signed-off-by: David S. Miller <
[email protected]
>
drivers/usb/atm/cxacru.c
patch
|
blob
|
history
diff --git
a/drivers/usb/atm/cxacru.c
b/drivers/usb/atm/cxacru.c
index 6789089e2461ec4e59f70240859eaa907fedbffc..56802d2e994ba24cd672e6671e56cc49e90ecde1 100644
(file)
--- a/
drivers/usb/atm/cxacru.c
+++ b/
drivers/usb/atm/cxacru.c
@@
-227,8
+227,14
@@
static ssize_t cxacru_sysfs_showattr_s8(s8 value, char *buf)
static ssize_t cxacru_sysfs_showattr_dB(s16 value, char *buf)
{
- return snprintf(buf, PAGE_SIZE, "%d.%02u\n",
- value / 100, abs(value) % 100);
+ if (likely(value >= 0)) {
+ return snprintf(buf, PAGE_SIZE, "%u.%02u\n",
+ value / 100, value % 100);
+ } else {
+ value = -value;
+ return snprintf(buf, PAGE_SIZE, "-%u.%02u\n",
+ value / 100, value % 100);
+ }
}
static ssize_t cxacru_sysfs_showattr_bool(u32 value, char *buf)