* [PATCH] Input: joydev - use clamp() macro
@ 2017-01-28 19:19 Dmitry Torokhov
0 siblings, 0 replies; only message in thread
From: Dmitry Torokhov @ 2017-01-28 19:19 UTC (permalink / raw)
To: linux-input; +Cc: Raphael Assenat, linux-kernel
We have a nice macro ensuring that the value is within certain range, let's
use it instead of open-coding.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/input/joydev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c
index db5e290e897e..065e67bf56dd 100644
--- a/drivers/input/joydev.c
+++ b/drivers/input/joydev.c
@@ -87,7 +87,7 @@ static int joydev_correct(int value, struct js_corr *corr)
return 0;
}
- return value < -32767 ? -32767 : (value > 32767 ? 32767 : value);
+ return clamp(value, -32767, 32767);
}
static void joydev_pass_event(struct joydev_client *client,
--
2.11.0.483.g087da7b7c-goog
--
Dmitry
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2017-01-28 19:27 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-28 19:19 [PATCH] Input: joydev - use clamp() macro Dmitry Torokhov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox