Re: [PATCH 4.19 146/191] HID: wacom: Avoid entering wacom_wac_pen_report for pad / battery

From: Pavel Machek
Date: Wed Nov 04 2020 - 02:52:28 EST


Hi!

> To correct this, we restore a version of the `WACOM_PAD_FIELD` check
> in `wacom_wac_collection()` and return early. This effectively prevents
> pad / battery collections from being reported until the very end of the
> report as originally intended.

Okay... but code is either wrong or very confusing:

> +++ b/drivers/hid/wacom_wac.c
> @@ -2729,7 +2729,9 @@ static int wacom_wac_collection(struct h
> if (report->type != HID_INPUT_REPORT)
> return -1;
>
> - if (WACOM_PEN_FIELD(field) && wacom->wacom_wac.pen_input)
> + if (WACOM_PAD_FIELD(field))
> + return 0;
> + else if (WACOM_PEN_FIELD(field) && wacom->wacom_wac.pen_input)
> wacom_wac_pen_report(hdev, report);

wacom_wac_pen_report() can never be called, because WACOM_PEN_FIELD()
can not be true here; if it was we'd return in the line above.

Best regards,
Pavel
--
http://www.livejournal.com/~pavelmachek

Attachment: signature.asc
Description: Digital signature