Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2950784imm; Fri, 20 Jul 2018 07:40:38 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfhNPHcQPXkqkPzjeY07A4pYykM6u//0A9dtxmOPQUOPdUR+hLxPK97AweD48wfi4ToEHDI X-Received: by 2002:a17:902:530a:: with SMTP id b10-v6mr2420466pli.316.1532097638334; Fri, 20 Jul 2018 07:40:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532097638; cv=none; d=google.com; s=arc-20160816; b=hCKkpdF3TggVtCdFrmBFkHOnXai/aW+1M09Xpd4pfHh+b9IVTHUHLwvb+Au6ELdom0 5xt9XOVINAHr3GeCw8Brjcb7G5ah0L8rNeF4/sOb2FOSYsw/aDwcaLlFIrxejNix/8WL dSBPe7Ryo7VBvH7eEZusS3U9bFaT1GomToxk+43wuCp5nQSJ62DOdx8tE5wqHMtScoZ/ 3Yxuns47enVNjgm4ma3nZObpO9mjE5ZINGlHmsma3KfnclSnARQ5YyS4HWehU5W61xN7 2peS91hylrnFDne0PiC8oLJ0zLmTumuuiccKbZ8P29OVnm8n4LKX3B3mAsYFRfabZZ9C 1GQA== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=rSZTBGpJb0hPB2FR5nd1MhA5kL6XNvEST7PY0B4OSrI=; b=zqUAs40UFxczM6h4Qm6THStUGq/9kEX/JxthY0ZmaW0nbddOXW6eWqkTIA4KSYC38C LjiNu8uc0EXxFQnSH9ZpzkIcsRwMdDlWtrYMylBncmLNQAsO+T/b++eHse0SNViWWdML 870G70SPWcO3SjQwYt4oC3nx+pLIpLf4NR6HR0hmw3KekXxKVGI2wv8s1HnLt1mW5zss vFyQxaEwF1/FElg58hAGoyWDaAWGiUMJXQk9PYOeR4KalycBRweDyqLlVp1SHvz8I08V 23jLHAoCekEsxTB7HMbFbjuY59gXj3A2tPzAerI9YLWsplNLRjMK9+ys/T+Ujwu8ASXB Ri3g== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 92-v6si1854771pli.518.2018.07.20.07.40.23; Fri, 20 Jul 2018 07:40:38 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731875AbeGTP2O (ORCPT + 99 others); Fri, 20 Jul 2018 11:28:14 -0400 Received: from mga14.intel.com ([192.55.52.115]:11707 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731244AbeGTP2N (ORCPT ); Fri, 20 Jul 2018 11:28:13 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Jul 2018 07:39:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,379,1526367600"; d="scan'208";a="217655388" Received: from mattu-haswell.fi.intel.com (HELO [10.237.72.164]) ([10.237.72.164]) by orsmga004.jf.intel.com with ESMTP; 20 Jul 2018 07:39:36 -0700 Subject: Re: [PATCH] usb: host: xhci-plat: Iterate over parent nodes for finding quirks To: Anurag Kumar Vulisha , Greg Kroah-Hartman Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org References: <1528212056-28390-1-git-send-email-anurag.kumar.vulisha@xilinx.com> From: Mathias Nyman Message-ID: Date: Fri, 20 Jul 2018 17:42:30 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <1528212056-28390-1-git-send-email-anurag.kumar.vulisha@xilinx.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Sorry about the delay with this patch, I have a couple comments inline. On 05.06.2018 18:20, Anurag Kumar Vulisha wrote: > 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 > --- > drivers/usb/host/xhci-plat.c | 29 ++++++++++++++++++----------- > 1 file changed, 18 insertions(+), 11 deletions(-) > > diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c > index c1b22fc..0cd0489 100644 > --- a/drivers/usb/host/xhci-plat.c > +++ b/drivers/usb/host/xhci-plat.c > @@ -152,7 +152,7 @@ static int xhci_plat_probe(struct platform_device *pdev) > { > 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,26 @@ static int xhci_plat_probe(struct platform_device *pdev) > goto disable_clk; > } > > - if (device_property_read_bool(sysdev, "usb2-lpm-disable")) > - xhci->quirks |= XHCI_HW_LPM_DISABLE; > + /* Iterate over all parent nodes for finding quirks */ > + for (tmpdev = &pdev->dev; tmpdev; tmpdev = tmpdev->parent) { Isn't sysdev at this point the topmost device that can have any of those device properties set? We could loop from &pdev->dev up to and including sysdev. It doesn't matter much but maybe avoid walking some extra parents. > > - if (device_property_read_bool(sysdev, "usb3-lpm-capable")) > - xhci->quirks |= XHCI_LPM_SUPPORT; > + if (device_property_read_bool(tmpdev, "usb2-lpm-disable")) > + xhci->quirks |= XHCI_HW_LPM_DISABLE; > > - if (device_property_read_bool(&pdev->dev, "quirk-broken-port-ped")) > - xhci->quirks |= XHCI_BROKEN_PORT_PED; > + if (device_property_read_bool(tmpdev, "usb3-lpm-capable")) > + xhci->quirks |= XHCI_LPM_SUPPORT; > > - /* imod_interval is the interrupt moderation value in nanoseconds. */ > - xhci->imod_interval = 40000; Setting the default imod_interval could be moved before the for() loop > - device_property_read_u32(sysdev, "imod-interval-ns", > - &xhci->imod_interval); > + if (device_property_read_bool(tmpdev, "quirk-broken-port-ped")) > + xhci->quirks |= XHCI_BROKEN_PORT_PED; > + > + /* > + * imod_interval is the interrupt moderation > + * value in nanoseconds. > + */ > + xhci->imod_interval = 40000; > + 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)) { > Otherwise everything looks fine. I will unfortunately be away again for another two weeks. -Mathias