From patchwork Wed Apr 15 13:18:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oliver Neukum X-Patchwork-Id: 6220721 X-Patchwork-Delegate: jikos@jikos.cz Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4B51CBF4A6 for ; Wed, 15 Apr 2015 13:19:36 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7367720274 for ; Wed, 15 Apr 2015 13:19:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7520620265 for ; Wed, 15 Apr 2015 13:19:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754606AbbDONTd (ORCPT ); Wed, 15 Apr 2015 09:19:33 -0400 Received: from cantor2.suse.de ([195.135.220.15]:51589 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754561AbbDONTc (ORCPT ); Wed, 15 Apr 2015 09:19:32 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 1CAD4AB13; Wed, 15 Apr 2015 13:19:30 +0000 (UTC) From: Oliver Neukum To: jkosina@suse.cz, linux-usb@vger.kernel.org, linux-input@vger.kernel.org, stern@rowland.harvard.edu Cc: Oliver Neukum Subject: [PATCH] usbhid: correct PM failure with closed devices Date: Wed, 15 Apr 2015 15:18:45 +0200 Message-Id: <1429103925-31304-1-git-send-email-oneukum@suse.de> X-Mailer: git-send-email 2.1.4 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When usbhid closes a device which was awake only because remote wakeup was required but not provided, the interface must go through a get/put cycle or the core will never reattempt to suspend the device. This brakes runtime PM for all joysticks. Signed-off-by: Oliver Neukum --- drivers/hid/usbhid/hid-core.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c index bfbe1be..63d1f0f 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c @@ -734,7 +734,15 @@ void usbhid_close(struct hid_device *hid) hid_cancel_delayed_stuff(usbhid); if (!(hid->quirks & HID_QUIRK_ALWAYS_POLL)) { usb_kill_urb(usbhid->urbin); + /* + * We need a put on the interface to force + * a recheck needed in case only a lack + * of capability to do remote wakeup + * kept us awake + */ + usb_autopm_get_interface(usbhid->intf); usbhid->intf->needs_remote_wakeup = 0; + usb_autopm_put_interface(usbhid->intf); } } else { spin_unlock_irq(&usbhid->lock);