HID: thrustmaster use swap() to make code cleaner

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
This commit is contained in:
chiminghao 2021-11-09 08:26:10 +00:00 committed by Benjamin Tissoires
parent 03090cc76e
commit 415e701cee

View File

@ -78,7 +78,6 @@ static int tmff_play(struct input_dev *dev, void *data,
struct hid_field *ff_field = tmff->ff_field; struct hid_field *ff_field = tmff->ff_field;
int x, y; int x, y;
int left, right; /* Rumbling */ int left, right; /* Rumbling */
int motor_swap;
switch (effect->type) { switch (effect->type) {
case FF_CONSTANT: case FF_CONSTANT:
@ -104,11 +103,8 @@ static int tmff_play(struct input_dev *dev, void *data,
ff_field->logical_maximum); ff_field->logical_maximum);
/* 2-in-1 strong motor is left */ /* 2-in-1 strong motor is left */
if (hid->product == THRUSTMASTER_DEVICE_ID_2_IN_1_DT) { if (hid->product == THRUSTMASTER_DEVICE_ID_2_IN_1_DT)
motor_swap = left; swap(left, right);
left = right;
right = motor_swap;
}
dbg_hid("(left,right)=(%08x, %08x)\n", left, right); dbg_hid("(left,right)=(%08x, %08x)\n", left, right);
ff_field->value[0] = left; ff_field->value[0] = left;