Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3937584imm; Mon, 8 Oct 2018 12:00:14 -0700 (PDT) X-Google-Smtp-Source: ACcGV61jtLXhzH8Pupaw8I+0fAbYcCIE/v/aWHOfgzyztR8V64VE2x+oMpVREObhzudaGw37fbBH X-Received: by 2002:a17:902:1ab:: with SMTP id b40-v6mr25382969plb.82.1539025214438; Mon, 08 Oct 2018 12:00:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539025214; cv=none; d=google.com; s=arc-20160816; b=EA+ttLvaYIly5PQ9ps6nFQSDMorHr/wD1vv/qguy9bKxv3jpgnXlS2dljbuK5g5l+J v3Bg2ttAwvrM+/cID3ogH0tVGxMYW+xjMMsZzB9/nwZSexYoHo2gmvbAms6xdlE0BpGT AnZ9W9fL/ue3a8looPAC/aiKKpynDCa81/kmKFHVjTe8sqB+flPdQ2qWiHAyb+CWAVOT 01jnGdSRuqm7Yh7eQ9/m9WKwFAvkftFJzE65ABD2Uz4QX4AyscxVB8VVbAonL8zSxzgH YRyvTs+i31Kc6ZVhoJqfKuhd2RWkWb50jo7Cw51gGIQhmOrRaLfRl71sfXBT8cmODvUG /OWA== 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=oOjJbPhdQ89OevtjKX2PEOFjGnHq9IeIJDg0/5D+YkQ=; b=FOKejbx1MvYyfW2K96gr+8AB+hkMyvG2JKojKv+E81vkhDq6cw02onpNzosrJfGr0I 2VLBb7a3uDVyHpodg3LGMS6fiTVcwPt2mXMYIPhqP5OoOSpy+VrJhVTB3HmjUN2OdbMW G1jEyetB+GPhpgYGrFWPefJNe04JcUGqPLmgXsIa6C2EYM8OsUgqBhXqjLryzB4QjBu1 M0w5QGbP76vrWiuc8FzJpGf7WuYSg6a8r6dfJmTA5upsYxnncQo6APGi5QuDiJx01FLP 9VqcFXMuGmMD7dkdTGmA4RZEFwO1/z8D2+8eHEwlYVrEZjiKnzVXJnwlQcUWOl4EMMJS tQZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=L+XtNOe8; 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 r19-v6si17850886pgm.478.2018.10.08.11.59.59; Mon, 08 Oct 2018 12:00:14 -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=L+XtNOe8; 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 S1731804AbeJICDf (ORCPT + 99 others); Mon, 8 Oct 2018 22:03:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:53078 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726391AbeJICDe (ORCPT ); Mon, 8 Oct 2018 22:03:34 -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 140F220645; Mon, 8 Oct 2018 18:50:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539024626; bh=fKgrg47nqV9ju/tm9gxkpmeYvVftyyoyOxaf6rKmnos=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L+XtNOe8rj2g1Si2yPuE79J/Fx7AJS/wFIhEhaN25lwx8rSf4qw3iulOet+pfPs81 kjzEAjbBZ3DQ/v6AQ11+EReZ6u76jRTB8hRmG7j8UENIsRR9t7N9YDW17URrHyC7Oh LMDKjaLPdacWBQs4UV/xMFtDT0FrPjcxFyoPrFqU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Anurag Kumar Vulisha , Mathias Nyman , Sasha Levin Subject: [PATCH 4.18 101/168] usb: host: xhci-plat: Iterate over parent nodes for finding quirks Date: Mon, 8 Oct 2018 20:31:21 +0200 Message-Id: <20181008175623.900468568@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181008175620.043587728@linuxfoundation.org> References: <20181008175620.043587728@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: Anurag Kumar Vulisha [ Upstream commit 222471f7640d9771a993218d825d84825adc805d ] In xhci_plat_probe() both sysdev and pdev->dev are being used for finding quirks. There are some drivers(like dwc3 host.c) which adds quirks(like usb3-lpm-capable) into pdev and the logic present in xhci_plat_probe() checks for quirks in either sysdev or pdev for finding the quirks. Because of this logic, some of the quirks are getting missed(usb3-lpm-capable quirk added by dwc3 host.c driver is getting missed).This patch fixes this by iterating over all the available parents for finding the quirks. In this way all the quirks which are present in child or parent are correctly updated. Signed-off-by: Anurag Kumar Vulisha Signed-off-by: Mathias Nyman Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/xhci-plat.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -152,7 +152,7 @@ static int xhci_plat_probe(struct platfo { const struct xhci_plat_priv *priv_match; const struct hc_driver *driver; - struct device *sysdev; + struct device *sysdev, *tmpdev; struct xhci_hcd *xhci; struct resource *res; struct usb_hcd *hcd; @@ -272,19 +272,24 @@ static int xhci_plat_probe(struct platfo goto disable_clk; } - if (device_property_read_bool(sysdev, "usb2-lpm-disable")) - xhci->quirks |= XHCI_HW_LPM_DISABLE; + /* imod_interval is the interrupt moderation value in nanoseconds. */ + xhci->imod_interval = 40000; - if (device_property_read_bool(sysdev, "usb3-lpm-capable")) - xhci->quirks |= XHCI_LPM_SUPPORT; + /* Iterate over all parent nodes for finding quirks */ + for (tmpdev = &pdev->dev; tmpdev; tmpdev = tmpdev->parent) { - if (device_property_read_bool(&pdev->dev, "quirk-broken-port-ped")) - xhci->quirks |= XHCI_BROKEN_PORT_PED; + if (device_property_read_bool(tmpdev, "usb2-lpm-disable")) + xhci->quirks |= XHCI_HW_LPM_DISABLE; - /* imod_interval is the interrupt moderation value in nanoseconds. */ - xhci->imod_interval = 40000; - device_property_read_u32(sysdev, "imod-interval-ns", - &xhci->imod_interval); + if (device_property_read_bool(tmpdev, "usb3-lpm-capable")) + xhci->quirks |= XHCI_LPM_SUPPORT; + + if (device_property_read_bool(tmpdev, "quirk-broken-port-ped")) + xhci->quirks |= XHCI_BROKEN_PORT_PED; + + device_property_read_u32(tmpdev, "imod-interval-ns", + &xhci->imod_interval); + } hcd->usb_phy = devm_usb_get_phy_by_phandle(sysdev, "usb-phy", 0); if (IS_ERR(hcd->usb_phy)) {