git.openpandora.org
/
pandora-kernel.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a3e8a86
)
input: vsense: round multipliers up
author
Grazvydas Ignotas
<notasas@gmail.com>
Fri, 10 Jun 2011 10:31:10 +0000
(13:31 +0300)
committer
Grazvydas Ignotas
<notasas@gmail.com>
Fri, 27 Apr 2012 21:28:00 +0000
(
00:28
+0300)
This will make read values consistent.
drivers/input/misc/vsense.c
patch
|
blob
|
history
diff --git
a/drivers/input/misc/vsense.c
b/drivers/input/misc/vsense.c
index
5f781b8
..
737cf47
100644
(file)
--- a/
drivers/input/misc/vsense.c
+++ b/
drivers/input/misc/vsense.c
@@
-338,7
+338,7
@@
static int vsense_proc_mult_write(struct file *file, const char __user *buffer,
unsigned long count, void *data)
{
int *multiplier = data;
- int ret, val;
+ int ret, val
, adj
;
ret = vsense_proc_int_write(buffer, count, &val);
if (ret < 0)
@@
-346,7
+346,10
@@
static int vsense_proc_mult_write(struct file *file, const char __user *buffer,
if (val == 0)
return -EINVAL;
- *multiplier = val * 256 / 100;
+ /* round to higher absolute value */
+ adj = val < 0 ? -99 : 99;
+ *multiplier = (val * 256 + adj) / 100;
+
return ret;
}