Re: [PATCH 4.19 54/86] Input: elan_i2c - only increment wakeup count on touch

Pavel Machek
2020-07-27T21:29:38Z

[-- Attachment #1: Type: text/plain, Size: 2356 bytes --]

Hi!

> From: Derek Basehore <dbasehore@chromium.org>
>
> [ Upstream commit 966334dfc472bdfa67bed864842943b19755d192 ]
>
> This moves the wakeup increment for elan devices to the touch report.
> This prevents the drivers from incorrectly reporting a wakeup when the
> resume callback resets then device, which causes an interrupt to
> occur.

Contrary to the changelog, this does not move anything... unlike
mainline, it simply adds two pm_wakeup_events.

It may still be correct, but maybe someone wants to double-check?

Best regards,
Pavel

> diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c
> index ae012639ae1d5..82afaca2e1a67 100644
> --- a/drivers/input/mouse/elan_i2c_core.c
> +++ b/drivers/input/mouse/elan_i2c_core.c
> @@ -917,6 +917,8 @@ static void elan_report_absolute(struct elan_tp_data *data, u8 *packet)
> u8 hover_info = packet[ETP_HOVER_INFO_OFFSET];
> bool contact_valid, hover_event;
>
> + pm_wakeup_event(&data->client->dev, 0);
> +
> hover_event = hover_info & 0x40;
> for (i = 0; i < ETP_MAX_FINGERS; i++) {
> contact_valid = tp_info & (1U << (3 + i));
> @@ -939,6 +941,8 @@ static void elan_report_trackpoint(struct elan_tp_data *data, u8 *report)
> u8 *packet = &report[ETP_REPORT_ID_OFFSET + 1];
> int x, y;
>
> + pm_wakeup_event(&data->client->dev, 0);
> +
> if (!data->tp_input) {
> dev_warn_once(&data->client->dev,
> "received a trackpoint report while no trackpoint device has been created. Please report upstream.\n");
> @@ -963,7 +967,6 @@ static void elan_report_trackpoint(struct elan_tp_data *data, u8 *report)
> static irqreturn_t elan_isr(int irq, void *dev_id)
> {
> struct elan_tp_data *data = dev_id;
> - struct device *dev = &data->client->dev;
> int error;
> u8 report[ETP_MAX_REPORT_LEN];
>
> @@ -989,7 +992,7 @@ static irqreturn_t elan_isr(int irq, void *dev_id)
> elan_report_trackpoint(data, report);
> break;
> default:
> - dev_err(dev, "invalid report id data (%x)\n",
> + dev_err(&data->client->dev, "invalid report id data (%x)\n",
> report[ETP_REPORT_ID_OFFSET]);
> }
>
> --
> 2.25.1
>
>

--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]