From: Andrew Duggan <aduggan@synaptics.com>
To: <linux-input@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Cc: Andrew Duggan <aduggan@synaptics.com>,
Jiri Kosina <jkosina@suse.cz>,
Benjamin Tissoires <benjamin.tissoires@redhat.com>,
Mika Westerberg <mika.westerberg@linux.intel.com>
Subject: [PATCH] HID: i2c-hid: Only disable irq wake if it was successfully enabled during suspend
Date: Mon, 27 Jul 2015 17:08:06 -0700 [thread overview]
Message-ID: <1438042086-9827-1-git-send-email-aduggan@synaptics.com> (raw)
On at least one platform the kernel prints a warning on resume saying
"Unbalanced IRQ 37 wake disable". This is because enable_irq_wake in the
suspend function is failing. This patch checks to see if the call to
enable_irq_wake succeeded before calling disable_irq_wake.
Signed-off-by: Andrew Duggan <aduggan@synaptics.com>
---
This patch based on Jiri's for-4.3/i2c-hid and needs Gabriele Mazzotta's
patch which moves where the HID driver's suspend callback call to apply
cleanly.
drivers/hid/i2c-hid/i2c-hid.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c
index 9ed69b5..1605fbe 100644
--- a/drivers/hid/i2c-hid/i2c-hid.c
+++ b/drivers/hid/i2c-hid/i2c-hid.c
@@ -149,6 +149,8 @@ struct i2c_hid {
int irq;
struct i2c_hid_platform_data pdata;
+
+ bool irq_wake_enabled;
};
static int __i2c_hid_command(struct i2c_client *client,
@@ -1096,8 +1098,8 @@ static int i2c_hid_suspend(struct device *dev)
ret = hid->driver->suspend(hid, PMSG_SUSPEND);
disable_irq(ihid->irq);
- if (device_may_wakeup(&client->dev))
- enable_irq_wake(ihid->irq);
+ if (device_may_wakeup(&client->dev) && !enable_irq_wake(ihid->irq))
+ ihid->irq_wake_enabled = true;
/* Save some power */
i2c_hid_set_power(client, I2C_HID_PWR_SLEEP);
@@ -1117,8 +1119,10 @@ static int i2c_hid_resume(struct device *dev)
if (ret)
return ret;
- if (device_may_wakeup(&client->dev))
+ if (device_may_wakeup(&client->dev) && ihid->irq_wake_enabled) {
disable_irq_wake(ihid->irq);
+ ihid->irq_wake_enabled = false;
+ }
if (hid->driver && hid->driver->reset_resume) {
ret = hid->driver->reset_resume(hid);
--
2.1.4
next reply other threads:[~2015-07-28 0:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-28 0:08 Andrew Duggan [this message]
2015-07-28 11:33 ` Mika Westerberg
2015-07-28 19:55 ` Andrew Duggan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1438042086-9827-1-git-send-email-aduggan@synaptics.com \
--to=aduggan@synaptics.com \
--cc=benjamin.tissoires@redhat.com \
--cc=jkosina@suse.cz \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®