Use += instead of multiply. Use correct indentation. Move logical tests continuations to the more commonly used end of previous line. Signed-off-by: Joe Perches <joe@xxxxxxxxxxx> --- drivers/hid/hid-core.c | 40 ++++++++++++++++++++++++---------------- 1 files changed, 24 insertions(+), 16 deletions(-) diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index d6dffcc..932266a 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -897,33 +897,41 @@ static void hid_input_field(struct hid_device *hid, struct hid_field *field, for (n = 0; n < count; n++) { value[n] = min < 0 ? - snto32(extract(hid, data, offset + n * size, size), - size) : - extract(hid, data, offset + n * size, size); + snto32(extract(hid, data, offset, size), size) : + extract(hid, data, offset, size); /* Ignore report if ErrorRollOver */ if (!(field->flags & HID_MAIN_ITEM_VARIABLE) && value[n] >= min && value[n] <= max && field->usage[value[n] - min].hid == HID_UP_KEYBOARD + 1) goto exit; + + offset += size; } for (n = 0; n < count; n++) { if (HID_MAIN_ITEM_VARIABLE & field->flags) { - hid_process_event(hid, field, &field->usage[n], value[n], interrupt); + hid_process_event(hid, field, &field->usage[n], + value[n], interrupt); continue; } - if (field->value[n] >= min && field->value[n] <= max - && field->usage[field->value[n] - min].hid - && search(value, field->value[n], count)) - hid_process_event(hid, field, &field->usage[field->value[n] - min], 0, interrupt); - - if (value[n] >= min && value[n] <= max - && field->usage[value[n] - min].hid - && search(field->value, value[n], count)) - hid_process_event(hid, field, &field->usage[value[n] - min], 1, interrupt); + if (field->value[n] >= min && + field->value[n] <= max && + field->usage[field->value[n] - min].hid && + search(value, field->value[n], count)) + hid_process_event(hid, field, + &field->usage[field->value[n] - min], + 0, interrupt); + + if (value[n] >= min && + value[n] <= max && + field->usage[value[n] - min].hid && + search(field->value, value[n], count)) + hid_process_event(hid, field, + &field->usage[value[n] - min], + 1, interrupt); } memcpy(field->value, value, count * sizeof(__s32)); @@ -945,11 +953,11 @@ static void hid_output_field(const struct hid_device *hid, for (n = 0; n < count; n++) { if (field->logical_minimum < 0) /* signed values */ - implement(hid, data, offset + n * size, size, + implement(hid, data, offset, size, s32ton(field->value[n], size)); else /* unsigned values */ - implement(hid, data, offset + n * size, size, - field->value[n]); + implement(hid, data, offset, size, field->value[n]); + offset += size; } } -- 1.7.3.3.464.gf80b6 -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html