Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

HID: pidff: clang-format pass

Signed-off-by: Tomasz Pakuła <tomasz.pakula.oficjalny@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.com>

authored by

Tomasz Pakuła and committed by
Jiri Kosina
ae42428f 63cc21dd

+26 -29
+26 -29
drivers/hid/usbhid/hid-pidff.c
··· 9 9 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt 10 10 11 11 #include "hid-pidff.h" 12 + #include <linux/hid.h> 12 13 #include <linux/input.h> 14 + #include <linux/minmax.h> 13 15 #include <linux/slab.h> 14 16 #include <linux/usb.h> 15 - #include <linux/hid.h> 16 - #include <linux/minmax.h> 17 - 18 17 19 18 #define PID_EFFECTS_MAX 64 20 19 #define PID_INFINITE U16_MAX ··· 320 321 static int pidff_rescale(int i, int max, struct hid_field *field) 321 322 { 322 323 return i * (field->logical_maximum - field->logical_minimum) / max + 323 - field->logical_minimum; 324 + field->logical_minimum; 324 325 } 325 326 326 327 /* ··· 366 367 else { 367 368 if (value < 0) 368 369 usage->value[0] = 369 - pidff_rescale(-value, -S16_MIN, usage->field); 370 + pidff_rescale(-value, -S16_MIN, usage->field); 370 371 else 371 372 usage->value[0] = 372 - pidff_rescale(value, S16_MAX, usage->field); 373 + pidff_rescale(value, S16_MAX, usage->field); 373 374 } 374 375 pr_debug("calculated from %d to %d\n", value, usage->value[0]); 375 376 } 376 377 377 378 static void pidff_set_time(struct pidff_usage *usage, u16 time) 378 379 { 379 - usage->value[0] = pidff_clamp( 380 - pidff_rescale_time(time, usage->field), usage->field); 380 + usage->value[0] = pidff_clamp(pidff_rescale_time(time, usage->field), 381 + usage->field); 381 382 } 382 383 383 384 static void pidff_set_duration(struct pidff_usage *usage, u16 duration) ··· 515 516 pidff->create_new_effect_type->value[0]; 516 517 517 518 pidff_set_duration(&pidff->set_effect[PID_DURATION], 518 - effect->replay.length); 519 + effect->replay.length); 519 520 520 521 pidff->set_effect[PID_TRIGGER_BUTTON].value[0] = effect->trigger.button; 521 522 pidff_set_time(&pidff->set_effect[PID_TRIGGER_REPEAT_INT], 522 - effect->trigger.interval); 523 + effect->trigger.interval); 523 524 pidff->set_effect[PID_GAIN].value[0] = 524 525 pidff->set_effect[PID_GAIN].field->logical_maximum; 525 526 ··· 528 529 /* Omit setting delay field if it's missing */ 529 530 if (!(pidff->quirks & HID_PIDFF_QUIRK_MISSING_DELAY)) 530 531 pidff_set_time(&pidff->set_effect[PID_START_DELAY], 531 - effect->replay.delay); 532 + effect->replay.delay); 532 533 533 534 hid_hw_request(pidff->hid, pidff->reports[PID_SET_EFFECT], 534 - HID_REQ_SET_REPORT); 535 + HID_REQ_SET_REPORT); 535 536 } 536 537 537 538 /* ··· 561 562 effect->u.periodic.offset); 562 563 pidff_set(&pidff->set_periodic[PID_PHASE], effect->u.periodic.phase); 563 564 pidff_set_time(&pidff->set_periodic[PID_PERIOD], 564 - effect->u.periodic.period); 565 + effect->u.periodic.period); 565 566 566 567 hid_hw_request(pidff->hid, pidff->reports[PID_SET_PERIODIC], 567 - HID_REQ_SET_REPORT); 568 + HID_REQ_SET_REPORT); 568 569 } 569 570 570 571 /* ··· 611 612 pidff_set(&pidff->set_condition[PID_DEAD_BAND], 612 613 effect->u.condition[i].deadband); 613 614 hid_hw_request(pidff->hid, pidff->reports[PID_SET_CONDITION], 614 - HID_REQ_SET_REPORT); 615 + HID_REQ_SET_REPORT); 615 616 } 616 617 } 617 618 ··· 674 675 675 676 pidff_set(&pidff->device_gain[PID_DEVICE_GAIN_FIELD], gain); 676 677 hid_hw_request(pidff->hid, pidff->reports[PID_DEVICE_GAIN], 677 - HID_REQ_SET_REPORT); 678 + HID_REQ_SET_REPORT); 678 679 } 679 680 680 681 /* ··· 760 761 */ 761 762 static int pidff_request_effect_upload(struct pidff_device *pidff, int efnum) 762 763 { 763 - int j; 764 - 765 764 pidff->create_new_effect_type->value[0] = efnum; 766 765 hid_hw_request(pidff->hid, pidff->reports[PID_CREATE_NEW_EFFECT], 767 - HID_REQ_SET_REPORT); 766 + HID_REQ_SET_REPORT); 768 767 hid_dbg(pidff->hid, "create_new_effect sent, type: %d\n", efnum); 769 768 770 769 pidff->block_load[PID_EFFECT_BLOCK_INDEX].value[0] = 0; 771 770 pidff->block_load_status->value[0] = 0; 772 771 hid_hw_wait(pidff->hid); 773 772 774 - for (j = 0; j < 60; j++) { 773 + for (int i = 0; i < 60; i++) { 775 774 hid_dbg(pidff->hid, "pid_block_load requested\n"); 776 775 hid_hw_request(pidff->hid, pidff->reports[PID_BLOCK_LOAD], 777 - HID_REQ_GET_REPORT); 776 + HID_REQ_GET_REPORT); 778 777 hid_hw_wait(pidff->hid); 779 778 if (pidff->block_load_status->value[0] == 780 779 pidff->status_id[PID_BLOCK_LOAD_SUCCESS]) { ··· 854 857 struct pidff_device *pidff = dev->ff->private; 855 858 int pid_id = pidff->pid_id[effect_id]; 856 859 857 - hid_dbg(pidff->hid, "starting to erase %d/%d\n", 858 - effect_id, pidff->pid_id[effect_id]); 860 + hid_dbg(pidff->hid, "starting to erase %d/%d\n", effect_id, 861 + pidff->pid_id[effect_id]); 859 862 860 863 /* 861 864 * Wait for the queue to clear. We do not want ··· 975 978 pidff->set_effect[PID_START_DELAY].value[0] = 0; 976 979 977 980 hid_hw_request(pidff->hid, pidff->reports[PID_SET_EFFECT], 978 - HID_REQ_SET_REPORT); 981 + HID_REQ_SET_REPORT); 979 982 } 980 983 981 984 /* ··· 1266 1269 1267 1270 if (PIDFF_FIND_SPECIAL_KEYS(status_id, block_load_status, 1268 1271 block_load_status) != 1269 - ARRAY_SIZE(pidff_block_load_status)) { 1272 + ARRAY_SIZE(pidff_block_load_status)) { 1270 1273 hid_err(pidff->hid, 1271 1274 "block load status identifiers not found\n"); 1272 1275 return -1; ··· 1274 1277 1275 1278 if (PIDFF_FIND_SPECIAL_KEYS(operation_id, effect_operation_status, 1276 1279 effect_operation_status) != 1277 - ARRAY_SIZE(pidff_effect_operation_status)) { 1280 + ARRAY_SIZE(pidff_effect_operation_status)) { 1278 1281 hid_err(pidff->hid, "effect operation identifiers not found\n"); 1279 1282 return -1; 1280 1283 } ··· 1479 1482 int hid_pidff_init_with_quirks(struct hid_device *hid, u32 initial_quirks) 1480 1483 { 1481 1484 struct pidff_device *pidff; 1482 - struct hid_input *hidinput = list_entry(hid->inputs.next, 1483 - struct hid_input, list); 1485 + struct hid_input *hidinput = 1486 + list_entry(hid->inputs.next, struct hid_input, list); 1484 1487 struct input_dev *dev = hidinput->input; 1485 1488 struct ff_device *ff; 1486 1489 int max_effects; ··· 1567 1570 1568 1571 return 0; 1569 1572 1570 - fail: 1573 + fail: 1571 1574 hid_device_io_stop(hid); 1572 1575 1573 1576 kfree(pidff);