diff mbox series

[4/7] Input: cy8ctmg110_ts - let I2C core configure wake interrupt

Message ID 20210603043726.3793876-4-dmitry.torokhov@gmail.com (mailing list archive)
State Accepted
Commit 172b07a6ead345b625af7e5f147ec64fbd256f79
Headers show
Series [1/7] Input: cy8ctmg110_ts - rely on platform code to supply interrupt | expand

Commit Message

Dmitry Torokhov June 3, 2021, 4:37 a.m. UTC
I2C core already configures interrupt as wakeup source when device is
registered using I2C_CLIENT_WAKE flag, so let's rely on it instead of
configuring it ourselves.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/touchscreen/cy8ctmg110_ts.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

Comments

Linus Walleij June 4, 2021, 7:32 a.m. UTC | #1
On Thu, Jun 3, 2021 at 6:37 AM Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:

> I2C core already configures interrupt as wakeup source when device is
> registered using I2C_CLIENT_WAKE flag, so let's rely on it instead of
> configuring it ourselves.
>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

I wonder how many bugs of this deep semantic type we have in the kernel :/

Yours,
Linus Walleij
Dmitry Torokhov June 6, 2021, 4:10 a.m. UTC | #2
On Fri, Jun 04, 2021 at 09:32:53AM +0200, Linus Walleij wrote:
> On Thu, Jun 3, 2021 at 6:37 AM Dmitry Torokhov
> <dmitry.torokhov@gmail.com> wrote:
> 
> > I2C core already configures interrupt as wakeup source when device is
> > registered using I2C_CLIENT_WAKE flag, so let's rely on it instead of
> > configuring it ourselves.
> >
> > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> 
> Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
> 
> I wonder how many bugs of this deep semantic type we have in the kernel :/

I do not think this is necessarily a bug, it just shows age of the
driver that was written before I2C core was doing this set up for us.

Thanks.
diff mbox series

Patch

diff --git a/drivers/input/touchscreen/cy8ctmg110_ts.c b/drivers/input/touchscreen/cy8ctmg110_ts.c
index d83bf82f02d4..f8d7ab3b6c25 100644
--- a/drivers/input/touchscreen/cy8ctmg110_ts.c
+++ b/drivers/input/touchscreen/cy8ctmg110_ts.c
@@ -254,12 +254,11 @@  static int __maybe_unused cy8ctmg110_suspend(struct device *dev)
 	struct i2c_client *client = to_i2c_client(dev);
 	struct cy8ctmg110 *ts = i2c_get_clientdata(client);
 
-	if (device_may_wakeup(&client->dev))
-		enable_irq_wake(client->irq);
-	else {
+	if (!device_may_wakeup(&client->dev)) {
 		cy8ctmg110_set_sleepmode(ts, true);
 		cy8ctmg110_power(ts, false);
 	}
+
 	return 0;
 }
 
@@ -268,12 +267,11 @@  static int __maybe_unused cy8ctmg110_resume(struct device *dev)
 	struct i2c_client *client = to_i2c_client(dev);
 	struct cy8ctmg110 *ts = i2c_get_clientdata(client);
 
-	if (device_may_wakeup(&client->dev))
-		disable_irq_wake(client->irq);
-	else {
+	if (!device_may_wakeup(&client->dev)) {
 		cy8ctmg110_power(ts, true);
 		cy8ctmg110_set_sleepmode(ts, false);
 	}
+
 	return 0;
 }