Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1339510imm; Tue, 2 Oct 2018 06:46:47 -0700 (PDT) X-Google-Smtp-Source: ACcGV60sAeEKIfKfc0UW9hkrVIKN+W7k5eZYMOLjR+w0fCtwJPP2GZD0HxMK5puUE7FMdrZazPuI X-Received: by 2002:a62:1b45:: with SMTP id b66-v6mr16549450pfb.94.1538488007064; Tue, 02 Oct 2018 06:46:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538488007; cv=none; d=google.com; s=arc-20160816; b=Rib32wDTMusYczgt5VIUqrrISfJZYTF95k0tmRez+y7C50CxAd+J4xOR9hm6Ev4SQQ yepFpikdo9PjbGWB42jFyrFUgaaV2bWwmzZim98TMa02Ie96yYL7alk6x/9nznyU4gDZ 7mWRwAluhIA2ZZU+TFdkrog2kd34rsiXQcKvLp2oGf2yFG+koKIlqa3AaCdeBF5N+syZ M9uFBe5FuDgqN+xrKi6OOqnBsNerE3dd63qoVUptFLv9d2zommcKB0zeTv9L0eAcdMLV MbrKDw+JUcJ26fVoHRH4Fb3Gaq3puz8jST+jCZqFZaBAtsYJWAQTFkoT3ZL1Poef7qj2 IffA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=C09qSu5R/LRH8vsE0G6e/PNf00ZdkJgmgag+m4bkNS8=; b=LWNFAPJ3SXCp69/UZ4eokTphzZlATZI2VLu9qteZ5QfD7SCqXvfIH4bA0r9mxVXiRz KXwsjbRKjHzjr3ylsIUHYXfrgk50VMG5EZALC6IpNRVp5ClHtU6rV4f9v1pq02W+Jc8M Xf9hImSn/uCKS7pvZEh0hYt5AgjnwfjATA/jzIT43vUUOSjPRa/YTD1t+lau0HZlrzpt EV0zM0kdKOmcVms2b0MIh/jXDokRyXPTiJ/XnTtgpzLrKrVIu5iz9beEAFyf2RBSsN/A xo0L3cRLEyLrCzts9FjRb5BwiR1II5QQfh9oHliOlqtgLlxwBwtA7p5SAVyY6iFt37dr jzBg== 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 u36-v6si15159083pga.185.2018.10.02.06.46.32; Tue, 02 Oct 2018 06:46:47 -0700 (PDT) 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 S1732649AbeJBUSo (ORCPT + 99 others); Tue, 2 Oct 2018 16:18:44 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:35622 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732607AbeJBUSn (ORCPT ); Tue, 2 Oct 2018 16:18:43 -0400 Received: from localhost (24-104-73-23-ip-static.hfc.comcastbusiness.net [24.104.73.23]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 505AB5AA; Tue, 2 Oct 2018 13:35:19 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alan Stern Subject: [PATCH 4.14 102/137] USB: remove LPM management from usb_driver_claim_interface() Date: Tue, 2 Oct 2018 06:25:03 -0700 Message-Id: <20181002132505.646643160@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181002132458.446916963@linuxfoundation.org> References: <20181002132458.446916963@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable 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.") CC: Signed-off-by: Greg Kroah-Hartman --- drivers/usb/core/driver.c | 15 --------------- 1 file changed, 15 deletions(-) --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c @@ -512,7 +512,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; @@ -533,16 +532,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 @@ -561,10 +550,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); - if (retval) { dev->driver = NULL; usb_set_intfdata(iface, NULL);