Skip to contentSkip to conversation

Input: joydev - use clamp() macro

PATCH New Dmitry Torokhov 1 participant 1 message Jan 28, 2017

Subsystems (2)
lore
Share & tools
lore

Dmitry Torokhov

author maintainer
#0 lore raw

PATCH 1/1 Input: joydev - use clamp() macro

We have a nice macro ensuring that the value is within certain range, let's use it instead of open-coding.

---
 drivers/input/joydev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/joydev.c +1 -1
index db5e290e897e..065e67bf56dd 100644
@@ -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,
Signature · 5 lines
2.11.0.483.g087da7b7c-goog


-- 
Dmitry