Skip to content

Commit ae42428

Browse files
LawstorantJiri Kosina
authored andcommitted
HID: pidff: clang-format pass
Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
1 parent 63cc21d commit ae42428

1 file changed

Lines changed: 26 additions & 29 deletions

File tree

drivers/hid/usbhid/hid-pidff.c

Lines changed: 26 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,11 @@
99
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
1010

1111
#include "hid-pidff.h"
12+
#include <linux/hid.h>
1213
#include <linux/input.h>
14+
#include <linux/minmax.h>
1315
#include <linux/slab.h>
1416
#include <linux/usb.h>
15-
#include <linux/hid.h>
16-
#include <linux/minmax.h>
17-
1817

1918
#define PID_EFFECTS_MAX 64
2019
#define PID_INFINITE U16_MAX
@@ -321,7 +320,7 @@ static s32 pidff_clamp(s32 i, struct hid_field *field)
321320
static int pidff_rescale(int i, int max, struct hid_field *field)
322321
{
323322
return i * (field->logical_maximum - field->logical_minimum) / max +
324-
field->logical_minimum;
323+
field->logical_minimum;
325324
}
326325

327326
/*
@@ -367,18 +366,18 @@ static void pidff_set_signed(struct pidff_usage *usage, s16 value)
367366
else {
368367
if (value < 0)
369368
usage->value[0] =
370-
pidff_rescale(-value, -S16_MIN, usage->field);
369+
pidff_rescale(-value, -S16_MIN, usage->field);
371370
else
372371
usage->value[0] =
373-
pidff_rescale(value, S16_MAX, usage->field);
372+
pidff_rescale(value, S16_MAX, usage->field);
374373
}
375374
pr_debug("calculated from %d to %d\n", value, usage->value[0]);
376375
}
377376

378377
static void pidff_set_time(struct pidff_usage *usage, u16 time)
379378
{
380-
usage->value[0] = pidff_clamp(
381-
pidff_rescale_time(time, usage->field), usage->field);
379+
usage->value[0] = pidff_clamp(pidff_rescale_time(time, usage->field),
380+
usage->field);
382381
}
383382

384383
static void pidff_set_duration(struct pidff_usage *usage, u16 duration)
@@ -516,11 +515,11 @@ static void pidff_set_effect_report(struct pidff_device *pidff,
516515
pidff->create_new_effect_type->value[0];
517516

518517
pidff_set_duration(&pidff->set_effect[PID_DURATION],
519-
effect->replay.length);
518+
effect->replay.length);
520519

521520
pidff->set_effect[PID_TRIGGER_BUTTON].value[0] = effect->trigger.button;
522521
pidff_set_time(&pidff->set_effect[PID_TRIGGER_REPEAT_INT],
523-
effect->trigger.interval);
522+
effect->trigger.interval);
524523
pidff->set_effect[PID_GAIN].value[0] =
525524
pidff->set_effect[PID_GAIN].field->logical_maximum;
526525

@@ -529,10 +528,10 @@ static void pidff_set_effect_report(struct pidff_device *pidff,
529528
/* Omit setting delay field if it's missing */
530529
if (!(pidff->quirks & HID_PIDFF_QUIRK_MISSING_DELAY))
531530
pidff_set_time(&pidff->set_effect[PID_START_DELAY],
532-
effect->replay.delay);
531+
effect->replay.delay);
533532

534533
hid_hw_request(pidff->hid, pidff->reports[PID_SET_EFFECT],
535-
HID_REQ_SET_REPORT);
534+
HID_REQ_SET_REPORT);
536535
}
537536

538537
/*
@@ -562,10 +561,10 @@ static void pidff_set_periodic_report(struct pidff_device *pidff,
562561
effect->u.periodic.offset);
563562
pidff_set(&pidff->set_periodic[PID_PHASE], effect->u.periodic.phase);
564563
pidff_set_time(&pidff->set_periodic[PID_PERIOD],
565-
effect->u.periodic.period);
564+
effect->u.periodic.period);
566565

567566
hid_hw_request(pidff->hid, pidff->reports[PID_SET_PERIODIC],
568-
HID_REQ_SET_REPORT);
567+
HID_REQ_SET_REPORT);
569568
}
570569

571570
/*
@@ -612,7 +611,7 @@ static void pidff_set_condition_report(struct pidff_device *pidff,
612611
pidff_set(&pidff->set_condition[PID_DEAD_BAND],
613612
effect->u.condition[i].deadband);
614613
hid_hw_request(pidff->hid, pidff->reports[PID_SET_CONDITION],
615-
HID_REQ_SET_REPORT);
614+
HID_REQ_SET_REPORT);
616615
}
617616
}
618617

@@ -675,7 +674,7 @@ static void pidff_set_gain_report(struct pidff_device *pidff, u16 gain)
675674

676675
pidff_set(&pidff->device_gain[PID_DEVICE_GAIN_FIELD], gain);
677676
hid_hw_request(pidff->hid, pidff->reports[PID_DEVICE_GAIN],
678-
HID_REQ_SET_REPORT);
677+
HID_REQ_SET_REPORT);
679678
}
680679

681680
/*
@@ -761,21 +760,19 @@ static void pidff_fetch_pool(struct pidff_device *pidff)
761760
*/
762761
static int pidff_request_effect_upload(struct pidff_device *pidff, int efnum)
763762
{
764-
int j;
765-
766763
pidff->create_new_effect_type->value[0] = efnum;
767764
hid_hw_request(pidff->hid, pidff->reports[PID_CREATE_NEW_EFFECT],
768-
HID_REQ_SET_REPORT);
765+
HID_REQ_SET_REPORT);
769766
hid_dbg(pidff->hid, "create_new_effect sent, type: %d\n", efnum);
770767

771768
pidff->block_load[PID_EFFECT_BLOCK_INDEX].value[0] = 0;
772769
pidff->block_load_status->value[0] = 0;
773770
hid_hw_wait(pidff->hid);
774771

775-
for (j = 0; j < 60; j++) {
772+
for (int i = 0; i < 60; i++) {
776773
hid_dbg(pidff->hid, "pid_block_load requested\n");
777774
hid_hw_request(pidff->hid, pidff->reports[PID_BLOCK_LOAD],
778-
HID_REQ_GET_REPORT);
775+
HID_REQ_GET_REPORT);
779776
hid_hw_wait(pidff->hid);
780777
if (pidff->block_load_status->value[0] ==
781778
pidff->status_id[PID_BLOCK_LOAD_SUCCESS]) {
@@ -857,8 +854,8 @@ static int pidff_erase_effect(struct input_dev *dev, int effect_id)
857854
struct pidff_device *pidff = dev->ff->private;
858855
int pid_id = pidff->pid_id[effect_id];
859856

860-
hid_dbg(pidff->hid, "starting to erase %d/%d\n",
861-
effect_id, pidff->pid_id[effect_id]);
857+
hid_dbg(pidff->hid, "starting to erase %d/%d\n", effect_id,
858+
pidff->pid_id[effect_id]);
862859

863860
/*
864861
* Wait for the queue to clear. We do not want
@@ -978,7 +975,7 @@ static void pidff_autocenter(struct pidff_device *pidff, u16 magnitude)
978975
pidff->set_effect[PID_START_DELAY].value[0] = 0;
979976

980977
hid_hw_request(pidff->hid, pidff->reports[PID_SET_EFFECT],
981-
HID_REQ_SET_REPORT);
978+
HID_REQ_SET_REPORT);
982979
}
983980

984981
/*
@@ -1269,15 +1266,15 @@ static int pidff_find_special_fields(struct pidff_device *pidff)
12691266

12701267
if (PIDFF_FIND_SPECIAL_KEYS(status_id, block_load_status,
12711268
block_load_status) !=
1272-
ARRAY_SIZE(pidff_block_load_status)) {
1269+
ARRAY_SIZE(pidff_block_load_status)) {
12731270
hid_err(pidff->hid,
12741271
"block load status identifiers not found\n");
12751272
return -1;
12761273
}
12771274

12781275
if (PIDFF_FIND_SPECIAL_KEYS(operation_id, effect_operation_status,
12791276
effect_operation_status) !=
1280-
ARRAY_SIZE(pidff_effect_operation_status)) {
1277+
ARRAY_SIZE(pidff_effect_operation_status)) {
12811278
hid_err(pidff->hid, "effect operation identifiers not found\n");
12821279
return -1;
12831280
}
@@ -1482,8 +1479,8 @@ static int pidff_check_autocenter(struct pidff_device *pidff,
14821479
int hid_pidff_init_with_quirks(struct hid_device *hid, u32 initial_quirks)
14831480
{
14841481
struct pidff_device *pidff;
1485-
struct hid_input *hidinput = list_entry(hid->inputs.next,
1486-
struct hid_input, list);
1482+
struct hid_input *hidinput =
1483+
list_entry(hid->inputs.next, struct hid_input, list);
14871484
struct input_dev *dev = hidinput->input;
14881485
struct ff_device *ff;
14891486
int max_effects;
@@ -1570,7 +1567,7 @@ int hid_pidff_init_with_quirks(struct hid_device *hid, u32 initial_quirks)
15701567

15711568
return 0;
15721569

1573-
fail:
1570+
fail:
15741571
hid_device_io_stop(hid);
15751572

15761573
kfree(pidff);

0 commit comments

Comments
 (0)