Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3914368imm; Mon, 8 Oct 2018 11:36:22 -0700 (PDT) X-Google-Smtp-Source: ACcGV60br3gjr3syvlIT33so41ntgB/k6C/jwQu5IHJg8SrSLHDvqmWongQhMXciNmaJnxbV3RYW X-Received: by 2002:a63:e54d:: with SMTP id z13-v6mr22095472pgj.169.1539023782690; Mon, 08 Oct 2018 11:36:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539023782; cv=none; d=google.com; s=arc-20160816; b=FsrWJEBidldI8ul9nfepgzLZc2hoAOcFQGP+Rp8JBfIlMU0OQYMWn9h2a/DTc1lB1e joKf8T5Hu6H5UJ+li5aaXwbRb+tCy7uFeDI61lF6zFFE7GHlUA1MP4Jl9Akjxs/6Obzq nqN+7CWGbyRV0wIX33yFXuJTBdtcCirG8vEtu+w+8W5sEQ491YH8IDctDAh8uQGkJuyQ lQ9NOJD0mXTwEEZd/Nuk7Phtpu25D1TD10fA0tCzalIEwQlF+D7qxgUoDAVOWMtMohcm 5Tuht4JN40EjX/oY8MiJ/juDzXEmC5wPa0IRTjzjbh87rE/8TxdeWiY0BpHTjDYzxEWH ZSpw== 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:dkim-signature; bh=Uv36h7HmP/Frhna3IrG62BLAQosclIAOj61wjHBeuGg=; b=hhOhGvYbVfcxO0CE09NQI8WnpB1TC2Is7n2PzEE272g7DpSlgYHyB9S/tVyJm2YLNd QOxdx00NibXYIp0K+Wlp3LwExuHvRr7Z/9/7UT7DDkYOb0ya/+lWkGwxhU1uqb0HLdtG Y453dk1EEKRbuxIS8rqG+J5N5wrsZf5lY3UgNw2i9mIoqU18iH+7+4Jb640ichGSjbfv NKptcZQFbog/hNrPzNprFOP56Ka1y9XfKXxoYmWroh/3+RXTmzuI9Hp4KTZjaz4sQLxE 89W3JaLw5LZhhlNYV+zkHuUdEYHhLwEH4zt4zj4lqk60k8ody5rf68D1xyKOxTFnO7TB 3xXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=OtoUU0jh; 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 u13-v6si19231029pfl.129.2018.10.08.11.36.07; Mon, 08 Oct 2018 11:36:22 -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; dkim=pass header.i=@kernel.org header.s=default header.b=OtoUU0jh; 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 S1728109AbeJIBsK (ORCPT + 99 others); Mon, 8 Oct 2018 21:48:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:60134 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726723AbeJIBsK (ORCPT ); Mon, 8 Oct 2018 21:48:10 -0400 Received: from localhost (ip-213-127-77-176.ip.prioritytelecom.net [213.127.77.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A5C512087D; Mon, 8 Oct 2018 18:35:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539023707; bh=PCpuUBjTr3hN6g50cXPF27tOwYAPBPnA88Cq1XWRg2U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OtoUU0jhUq8wIvn+ZWvlZ+6VtBWQhRNh2tvwdkliZ+Sjcsn5N6lAUTovpzbjWzt+o S3jUA61wn96YCaZmIY/iYaaLSeCVIoWC83bTXsEDFHwXqwoWAwDgq2wMu/Ubx4Ss6h KxhApyO/kHs7c1695pbRWYN2p4dMD8vxvNyjEVio= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alan Stern Subject: [PATCH 4.4 057/113] USB: remove LPM management from usb_driver_claim_interface() Date: Mon, 8 Oct 2018 20:30:58 +0200 Message-Id: <20181008175534.157535821@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181008175530.864641368@linuxfoundation.org> References: <20181008175530.864641368@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.4-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 @@ -509,7 +509,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; @@ -530,16 +529,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 @@ -558,10 +547,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);