diff options
author | Simon Arlott <simon@fire.lp0.eu> | 2009-04-23 13:19:02 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-05-08 22:34:56 -0400 |
commit | 10107bd04fc88657204ca40af2ace33626496fd3 (patch) | |
tree | fd943175cef02caf821fb9e4d1316787f1c2fdfe /drivers/usb/atm | |
parent | 091bf7624d1c90cec9e578a18529f615213ff847 (diff) |
USB: cxacru: Fix negative dB output
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 <simon@fire.lp0.eu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/atm')
-rw-r--r-- | drivers/usb/atm/cxacru.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/usb/atm/cxacru.c b/drivers/usb/atm/cxacru.c index 6789089e2461..56802d2e994b 100644 --- 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) | |||
227 | 227 | ||
228 | static ssize_t cxacru_sysfs_showattr_dB(s16 value, char *buf) | 228 | static ssize_t cxacru_sysfs_showattr_dB(s16 value, char *buf) |
229 | { | 229 | { |
230 | return snprintf(buf, PAGE_SIZE, "%d.%02u\n", | 230 | if (likely(value >= 0)) { |
231 | value / 100, abs(value) % 100); | 231 | return snprintf(buf, PAGE_SIZE, "%u.%02u\n", |
232 | value / 100, value % 100); | ||
233 | } else { | ||
234 | value = -value; | ||
235 | return snprintf(buf, PAGE_SIZE, "-%u.%02u\n", | ||
236 | value / 100, value % 100); | ||
237 | } | ||
232 | } | 238 | } |
233 | 239 | ||
234 | static ssize_t cxacru_sysfs_showattr_bool(u32 value, char *buf) | 240 | static ssize_t cxacru_sysfs_showattr_bool(u32 value, char *buf) |