All of lore.kernel.org
 help / color / mirror / Atom feed
From: Benson Leung <bleung@chromium.org>
To: jkosina@suse.cz, linux-usb@vger.kernel.org,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: bleung@chromium.org
Subject: [PATCH] HID: usbhid: fix suspend timeout due to RUNNING bits
Date: Fri,  2 Sep 2011 17:07:27 -0700	[thread overview]
Message-ID: <1315008447-11012-1-git-send-email-bleung@chromium.org> (raw)

hid_submit_ctrl and hid_submit_out should return error
codes when HID_REPORTED_IDLE is set by hid_suspend.
This will allow the output and control completion
handlers to clear HID_OUT_RUNNING and HID_CTRL_RUNNING
so hid_suspend succeeds.

Previously, if there were outstanding out messages
or control messages while hid_suspend was called,
hid_suspend would fail because usbhid_wait_io would time
out.

This condition happens with USB keyboards with both capslock and
numlock leds enabled at suspend time. Control requests
will come down to the hid-core to disable both leds, with
hid_suspend being called between the two being submitted.

Signed-off-by: Benson Leung <bleung@chromium.org>
---
 drivers/hid/usbhid/hid-core.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index a9fa294..cf5c106 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -326,6 +326,8 @@ static int hid_submit_out(struct hid_device *hid)
 			return -1;
 		}
 		usbhid->last_out = jiffies;
+	} else {
+		return -1;
 	}
 
 	return 0;
@@ -385,6 +387,8 @@ static int hid_submit_ctrl(struct hid_device *hid)
 			return -1;
 		}
 		usbhid->last_ctrl = jiffies;
+	} else {
+		return -1;
 	}
 
 	return 0;
-- 
1.7.1


             reply	other threads:[~2011-09-03  0:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-03  0:07 Benson Leung [this message]
2011-09-13  1:29 ` [PATCH] HID: usbhid: fix suspend timeout due to RUNNING bits Benson Leung
2011-09-13  1:29   ` Benson Leung
2011-09-13  6:50   ` Jiri Kosina

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=1315008447-11012-1-git-send-email-bleung@chromium.org \
    --to=bleung@chromium.org \
    --cc=jkosina@suse.cz \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.