diff mbox

Input: joydev - use clamp() macro

Message ID 20170128191918.GA38093@dtor-ws (mailing list archive)
State New, archived
Headers show

Commit Message

Dmitry Torokhov Jan. 28, 2017, 7:19 p.m. UTC
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 mbox

Patch

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,