Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1359415imm; Tue, 2 Oct 2018 07:04:34 -0700 (PDT) X-Google-Smtp-Source: ACcGV62SX2kFB+V3kiYXNiDoPIKXuR75e/8Ev9lm1NiB1mV+xQFua2eZurZmxTxWfKI6jrZbY6jF X-Received: by 2002:a17:902:286a:: with SMTP id e97-v6mr17088270plb.340.1538489074844; Tue, 02 Oct 2018 07:04:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538489074; cv=none; d=google.com; s=arc-20160816; b=SAsSZ0x48Zm0XWsrNoS34Qr3pnY3kcwyCsEz7oVBmF6EY2xkLzqccYQCxq6hGTpLXX Ip6R92Zp5VOIwuf44L5AH/Hh7aBQQ1Sra64wty8m7qMfMfY41fA3v48Zu3WFLmV0VEXp t/VxxH9svDosQxcAWIXeGJtZjfkhqg5oRY8H3KL1sp0esBPn1cz6PHKU8oVhdHUU4wer 5FEMwjwXXT0TiRBtjlOUUIF7lUImDFBzdjS5wfe3kTj4cR3VkmYSqE18YT5+whHLS2YB xTBdYqve+uL6mOpjpQq6jD8pUOH5U+wkkX8Aoqzfuom+29bzptb+1hSM/TF6rt06kkQS KCew== 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=wqsAjluP1bwGDMzW+bWwClFxgrUtC3DF2rZDlGRc8hI=; b=jcNZHlo7XK7paj2I81zSYqfisQ/wQRrSxa6xVJ1S0Ezqx4z8M+RL5WzcaE1r9kDzaN JEA65pvuzsnJYgIuBMHbzhYBU3zqWpPy7Z5/gctVv/xSZHWWGUe6/n/7IxI4JeP9gGo8 c0Ecu5dZGN4jGt08V4OmLkBU0+KJrr3I6yT8zmukrvjTNH24wIYVUR2HM74lQtOS4bwb Fx3DRUTAOFVxc+M8uiFhFWFekb4D/MIfQC1eJPhDB0VBu4La/AxKMogmX3Mn+WkCj9Ru 606+AIv9XZ6btb8ZoqpQneRGNqg5uDIlYbyw5P3VnAWe5pHZGozQpXTmgAQ9NNyIFnuY y6Uw== 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 n26-v6si13891025pfk.14.2018.10.02.07.04.19; Tue, 02 Oct 2018 07:04:34 -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 S1730066AbeJBUNB (ORCPT + 99 others); Tue, 2 Oct 2018 16:13:01 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:33192 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730024AbeJBUNA (ORCPT ); Tue, 2 Oct 2018 16:13:00 -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 916F9B2F; Tue, 2 Oct 2018 13:29:38 +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.18 156/228] USB: remove LPM management from usb_driver_claim_interface() Date: Tue, 2 Oct 2018 06:24:13 -0700 Message-Id: <20181002132509.529848433@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181002132459.032960735@linuxfoundation.org> References: <20181002132459.032960735@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.18-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);