From patchwork Sat Sep 3 00:07:27 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benson Leung X-Patchwork-Id: 1123162 X-Patchwork-Delegate: jikos@jikos.cz Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p8308DQZ000962 for ; Sat, 3 Sep 2011 00:08:14 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751633Ab1ICAH6 (ORCPT ); Fri, 2 Sep 2011 20:07:58 -0400 Received: from mail-pz0-f42.google.com ([209.85.210.42]:49265 "EHLO mail-pz0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752018Ab1ICAH6 (ORCPT ); Fri, 2 Sep 2011 20:07:58 -0400 Received: by pzk37 with SMTP id 37so5195480pzk.1 for ; Fri, 02 Sep 2011 17:07:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:x-mailer; bh=56inLC8/rpRfVmr8aNiVcPoJXz4rJjgDbpdG47tbWvw=; b=TmVXeAVI0BYsptBZ6gQR5I6gVs2QmornHAuN6nb/azeU0XBSea09bYcWSIX99Ocmfk fV+jON+4AI81iyiDgnRMB2YfgjH8mPCVAcWDsTUFneoMwj7SB8klIJzPVAMnc+6EZNng 32D3uH122CQ2rbSIMYK329+LzTMh+Exk92IXQ= Received: by 10.68.19.6 with SMTP id a6mr2657565pbe.165.1315008477350; Fri, 02 Sep 2011 17:07:57 -0700 (PDT) Received: from localhost.localdomain (c-67-169-181-109.hsd1.ca.comcast.net. [67.169.181.109]) by mx.google.com with ESMTPS id i4sm1729177pbr.4.2011.09.02.17.07.56 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 02 Sep 2011 17:07:56 -0700 (PDT) From: Benson Leung 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 Message-Id: <1315008447-11012-1-git-send-email-bleung@chromium.org> X-Mailer: git-send-email 1.7.1 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Sat, 03 Sep 2011 00:08:14 +0000 (UTC) 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 --- 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;