From patchwork Wed Jul 12 21:55:17 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 9837457 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 29AEB602D8 for ; Wed, 12 Jul 2017 21:55:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 18A2728534 for ; Wed, 12 Jul 2017 21:55:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0A3722867F; Wed, 12 Jul 2017 21:55:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6F45D28534 for ; Wed, 12 Jul 2017 21:55:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753507AbdGLVzV (ORCPT ); Wed, 12 Jul 2017 17:55:21 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:34671 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753452AbdGLVzU (ORCPT ); Wed, 12 Jul 2017 17:55:20 -0400 Received: by mail-pf0-f194.google.com with SMTP id c24so4686069pfe.1; Wed, 12 Jul 2017 14:55:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=DWbIONMCaVYOx+IWSpb++bZzZZtDVaGvTwEFMF5+JU8=; b=BjZvEFBuwCNmx/Kmuvrq7nTrBH9mKrdmOmyxPAzzrVXYKrhRPZtj7aczRqy9MZP6/z xmwCKJ9gEJYtuzJcn1N7EVTkNRo3ZdQ9UAdJdc+jWc5YYo7pqDdD8CV6tnPlkcA94QIT V9PpPqynoPqhxlG324PU/iPgADB5koBTPJOvqrsChUXelDGzhqbIUhhviD+ijzKkkv+e X+e68gwyHh4GpLWEfoD17LlpHm5bnmQediE+WKZ9MS1x+Bd2Q8XL+Tva7NOPkX4vA/iq IiFEONEyLbf+0MeaL+NGuC7CmbXqMPndazkPxLBw9ve44cwuSAuTuCIG4SblgnROyixO LSGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=DWbIONMCaVYOx+IWSpb++bZzZZtDVaGvTwEFMF5+JU8=; b=i47lXcjE7su3bwkPvv6PdF/lBPKxzukhUo3y8Mam5ki9hnaQlGPbUmZcoVblQXKCLg wwKXZibhiMYETI8yxCReBZaHApMab+csd4GhG6/hWNirLFJMvtWLMa0+x/IbTlk8cBQt hkYYy3n6Ty+S1zADhpLgaYPXGbGR3wJ2iUp09Dm0WfmNmSz4fHFoIoE1Nyg53g4ojONq dqvb5jcMN+oVIg1xEKcFXFipemGarTqiXYppPdDCQOcsm1FbHyihulOhx0GphPzkOB8+ Bxn1q4KlAYWF+mnDfW9R7FuCx7QKgys5Pz2FzNLp8iDaHgW4sVxMK8LarYCWxShFitTo 2NPg== X-Gm-Message-State: AIVw112qZjAGWfJSx1ICJE6uil/RbP7iR22oDUwnjlR7e4BoSdg1lxLd 9gOLBn2IQQ/wjAP8Jok= X-Received: by 10.84.157.74 with SMTP id u10mr6337167plu.137.1499896519767; Wed, 12 Jul 2017 14:55:19 -0700 (PDT) Received: from dtor-ws ([2620:0:1000:1311:b087:6a1c:96e1:e780]) by smtp.gmail.com with ESMTPSA id i19sm7529921pfj.78.2017.07.12.14.55.18 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Wed, 12 Jul 2017 14:55:19 -0700 (PDT) Date: Wed, 12 Jul 2017 14:55:17 -0700 From: Dmitry Torokhov To: Olof Johansson Cc: "linux-input@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: Regression during 4.13 merge window: Mouse not working (under X) Message-ID: <20170712215517.GA22123@dtor-ws> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP On Wed, Jul 12, 2017 at 02:45:18PM -0700, Olof Johansson wrote: > Dmitry, > > I installed current mainline (as of 3b06b1a744) on a z840 here, and > lost the mouse. > > Bisecting down, it seems like "HID: usbhid: remove custom locking from > usbhid_open/close" (e399396a6b0) is at fault, and if I revert that and > 283a21da1239 I get a working system again. Userspace is Ubuntu 16.04. Olof, does the patch below work for you? Tested-by: Olof Johansson diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c index 76013eb5cb7f..c008847e0b20 100644 --- a/drivers/hid/usbhid/hid-core.c +++ b/drivers/hid/usbhid/hid-core.c @@ -680,18 +680,21 @@ static int usbhid_open(struct hid_device *hid) struct usbhid_device *usbhid = hid->driver_data; int res; + set_bit(HID_OPENED, &usbhid->iofl); + if (hid->quirks & HID_QUIRK_ALWAYS_POLL) return 0; res = usb_autopm_get_interface(usbhid->intf); /* the device must be awake to reliably request remote wakeup */ - if (res < 0) + if (res < 0) { + clear_bit(HID_OPENED, &usbhid->iofl); return -EIO; + } usbhid->intf->needs_remote_wakeup = 1; set_bit(HID_RESUME_RUNNING, &usbhid->iofl); - set_bit(HID_OPENED, &usbhid->iofl); set_bit(HID_IN_POLLING, &usbhid->iofl); res = hid_start_in(hid); @@ -727,19 +730,20 @@ static void usbhid_close(struct hid_device *hid) { struct usbhid_device *usbhid = hid->driver_data; - if (hid->quirks & HID_QUIRK_ALWAYS_POLL) - return; - /* * Make sure we don't restart data acquisition due to * a resumption we no longer care about by avoiding racing * with hid_start_in(). */ spin_lock_irq(&usbhid->lock); - clear_bit(HID_IN_POLLING, &usbhid->iofl); clear_bit(HID_OPENED, &usbhid->iofl); + if (!(hid->quirks & HID_QUIRK_ALWAYS_POLL)) + clear_bit(HID_IN_POLLING, &usbhid->iofl); spin_unlock_irq(&usbhid->lock); + if (hid->quirks & HID_QUIRK_ALWAYS_POLL) + return; + hid_cancel_delayed_stuff(usbhid); usb_kill_urb(usbhid->urbin); usbhid->intf->needs_remote_wakeup = 0;