projects
/
linux-block.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
03090cc
)
HID: thrustmaster use swap() to make code cleaner
author
chiminghao
<chi.minghao@zte.com.cn>
Tue, 9 Nov 2021 08:26:10 +0000
(08:26 +0000)
committer
Benjamin Tissoires
<benjamin.tissoires@redhat.com>
Tue, 14 Dec 2021 09:50:23 +0000
(10:50 +0100)
Fix the following coccicheck REVIEW:
Use swap() instead of reimplementing it.
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: chiminghao <chi.minghao@zte.com.cn>
[bentiss: rewrote commit title]
Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Link:
https://lore.kernel.org/r/20211109082610.131341-1-chi.minghao@zte.com.cn
drivers/hid/hid-tmff.c
patch
|
blob
|
blame
|
history
diff --git
a/drivers/hid/hid-tmff.c
b/drivers/hid/hid-tmff.c
index 90acef3045369e15f72abd7c72580952f080c518..4040cd98dafed6fc73ea7721d0672d8abea4d568 100644
(file)
--- a/
drivers/hid/hid-tmff.c
+++ b/
drivers/hid/hid-tmff.c
@@
-78,7
+78,6
@@
static int tmff_play(struct input_dev *dev, void *data,
struct hid_field *ff_field = tmff->ff_field;
int x, y;
int left, right; /* Rumbling */
- int motor_swap;
switch (effect->type) {
case FF_CONSTANT:
@@
-104,11
+103,8
@@
static int tmff_play(struct input_dev *dev, void *data,
ff_field->logical_maximum);
/* 2-in-1 strong motor is left */
- if (hid->product == THRUSTMASTER_DEVICE_ID_2_IN_1_DT) {
- motor_swap = left;
- left = right;
- right = motor_swap;
- }
+ if (hid->product == THRUSTMASTER_DEVICE_ID_2_IN_1_DT)
+ swap(left, right);
dbg_hid("(left,right)=(%08x, %08x)\n", left, right);
ff_field->value[0] = left;