Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3002322imu; Sun, 9 Dec 2018 14:49:24 -0800 (PST) X-Google-Smtp-Source: AFSGD/WvYkPsVZIfPC7OUFkP62rIjt68wRaaZ7fNV1Vfwr8DRkiNfIzOuy92g2b6NpFM6vA4zp4O X-Received: by 2002:a63:6302:: with SMTP id x2mr8833239pgb.183.1544395763933; Sun, 09 Dec 2018 14:49:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544395763; cv=none; d=google.com; s=arc-20160816; b=H+FZVH+7deYCGDrVsjM71gBiLGGgmpGzBIN1yyCMfnEaCFzYI5PZu3ukc+JBUfW2rL znuOOx2KvzvhnAjmF+qtyMxpVdgNBuASTKryp9ghnXTRRXXt/4R3bJ1cI4pUhvmsS1Qc COPheaG+RSFB3MS9/O/9W0PKM8tjvW9xMvXHMrV+G4q/jfUCYls65655q5vQvDiZ5UMB aIqMOAYHBZ+MaXG4J6jvX13olUg9wgwAfcVZo/if6/HmBXxBJpQlSK96lUT5V6hRsqOU 2L2dvOenukPOLJ4Azc6vQv/0ddH1P944+r64qrvIatbo58HcGmp5zF22Ly3DuxR766zv lNKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=ert5GwRD5xcgCCtysnDUkBe4iQsPZbEhHaKWTr/JUjU=; b=R3DaNC4WxPjnjmwoV47ZezCD/9gp0x+Y4EPaMZcD696J+P8xJW/wxY6r1ri8BLF1p/ oXIiwhFQjKdob60thpIelCfqmZlX5YWe9Q3nBHpBH/thyzGEatsi6xdKVSF356Op2WEh zUuXH4J5nhYBqHmFI0UW62RS+1GRyFQMTbHhEhu5DAw70ZBXpu9I/+gnZs35/HK1xMPA whGCTYzVD+7p/h51r6vZlTKLzGnLi+HHswvy73QMYBkPFEKutC5kKkvDrw/o2BiUcGf0 7wSrcROnnK1VQVmzEfjN0IINEybmMCsXjjTYASgAUb34ISQDv6suvdrmMhhd/zyZ2kLS /KwA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y18si8175147plp.269.2018.12.09.14.49.08; Sun, 09 Dec 2018 14:49:23 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727059AbeLIWBA (ORCPT + 99 others); Sun, 9 Dec 2018 17:01:00 -0500 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:35982 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726692AbeLIVze (ORCPT ); Sun, 9 Dec 2018 16:55:34 -0500 Received: from pub.yeoldevic.com ([81.174.156.145] helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1gW72x-0002if-Ik; Sun, 09 Dec 2018 21:55:31 +0000 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1gW72i-0003aj-O7; Sun, 09 Dec 2018 21:55:16 +0000 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Alan Stern" , "Greg Kroah-Hartman" Date: Sun, 09 Dec 2018 21:50:33 +0000 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) X-Patchwork-Hint: ignore Subject: [PATCH 3.16 254/328] USB: remove LPM management from usb_driver_claim_interface() In-Reply-To: X-SA-Exim-Connect-IP: 81.174.156.145 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.62-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Alan Stern commit c183813fcee44a249339b7c46e1ad271ca1870aa upstream. usb_driver_claim_interface() disables and re-enables Link Power Management, but it shouldn't do either one, for the reasons listed below. This patch removes the two LPM-related function calls from the routine. The reason for disabling LPM in the analogous function usb_probe_interface() is so that drivers won't have to deal with unwanted LPM transitions in their probe routine. But usb_driver_claim_interface() doesn't call the driver's probe routine (or any other callbacks), so that reason doesn't apply here. Furthermore, no driver other than usbfs will ever call usb_driver_claim_interface() unless it is already bound to another interface in the same device, which means disabling LPM here would be redundant. usbfs doesn't interact with LPM at all. Lastly, the error return from usb_unlocked_disable_lpm() isn't handled properly; the code doesn't clean up its earlier actions before returning. Signed-off-by: Alan Stern Fixes: 8306095fd2c1 ("USB: Disable USB 3.0 LPM in critical sections.") Signed-off-by: Greg Kroah-Hartman [bwh: Backported to 3.16: adjust context] Signed-off-by: Ben Hutchings --- drivers/usb/core/driver.c | 15 --------------- 1 file changed, 15 deletions(-) --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c @@ -522,7 +522,6 @@ int usb_driver_claim_interface(struct us struct device *dev; struct usb_device *udev; int retval = 0; - int lpm_disable_error = -ENODEV; if (!iface) return -ENODEV; @@ -539,16 +538,6 @@ int usb_driver_claim_interface(struct us iface->condition = USB_INTERFACE_BOUND; - /* See the comment about disabling LPM in usb_probe_interface(). */ - if (driver->disable_hub_initiated_lpm) { - lpm_disable_error = usb_unlocked_disable_lpm(udev); - if (lpm_disable_error) { - dev_err(&iface->dev, "%s Failed to disable LPM for driver %s\n.", - __func__, driver->name); - return -ENOMEM; - } - } - /* Claimed interfaces are initially inactive (suspended) and * runtime-PM-enabled, but only if the driver has autosuspend * support. Otherwise they are marked active, to prevent the @@ -567,10 +556,6 @@ int usb_driver_claim_interface(struct us if (device_is_registered(dev)) retval = device_bind_driver(dev); - /* Attempt to re-enable USB3 LPM, if the disable was successful. */ - if (!lpm_disable_error) - usb_unlocked_enable_lpm(udev); - return retval; } EXPORT_SYMBOL_GPL(usb_driver_claim_interface);