public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mathias Nyman <mathias.nyman@linux.intel.com>
To: "Thang Q. Nguyen" <tqnguyen@apm.com>
Cc: Mathias Nyman <mathias.nyman@intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	Tung Nguyen <tunguyen@apm.com>, Phong Vo <pvo@apm.com>,
	Loc Ho <lho@apm.com>, patches <patches@apm.com>,
	Adam Wallis <awallis@codeaurora.org>
Subject: Re: [PATCH v2 1/1] usb:xhci: update condition to select bus->sysdev from parent device
Date: Wed, 6 Sep 2017 09:32:22 +0300	[thread overview]
Message-ID: <59AF9676.9080904@linux.intel.com> (raw)
In-Reply-To: <CAKrQpSvP9nwCM7C4cxiwbvOqk-s=CxaoOJ8tCaYBCJvZ=rcUrw@mail.gmail.com>

On 06.09.2017 06:47, Thang Q. Nguyen wrote:
>
>
> On Tue, Sep 5, 2017 at 6:14 PM, Mathias Nyman <mathias.nyman@linux.intel.com <mailto:mathias.nyman@linux.intel.com>> wrote:
>
>     On 24.08.2017 05 <tel:24.08.2017%2005>:53, Thang Q. Nguyen wrote:
>
>         On Sat, Aug 19, 2017 at 10:43 AM, Thang Q. Nguyen <tqnguyen@apm.com <mailto:tqnguyen@apm.com>> wrote:
>
>             From: "Thang Q. Nguyen" <tqnguyen@apm.com <mailto:tqnguyen@apm.com>>
>
>             For commit 4c39d4b949d3 ("usb: xhci: use bus->sysdev for DMA
>             configuration"), sysdev points to devices known to the system firmware
>             or hardware for DMA parameters.
>             However, the parent of the system firmware/hardware device checking
>             logic does not work in ACPI boot mode. This patch updates the formulation
>             to check this case in both DT and ACPI.
>
>             Signed-off-by: Tung Nguyen <tunguyen@apm.com <mailto:tunguyen@apm.com>>
>             Signed-off-by: Thang Q. Nguyen <tqnguyen@apm.com <mailto:tqnguyen@apm.com>>
>             ---
>             Change since v1:
>                - Update codes to work with kernel 4.13-rc5
>             ---
>                drivers/usb/host/xhci-plat.c | 5 ++++-
>                1 file changed, 4 insertions(+), 1 deletion(-)
>
>             diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
>             index c04144b..1bb9729 100644
>             --- a/drivers/usb/host/xhci-plat.c
>             +++ b/drivers/usb/host/xhci-plat.c
>             @@ -187,7 +187,10 @@ static int xhci_plat_probe(struct platform_device *pdev)
>                        * 3. xhci_plat is grandchild of a pci device (dwc3-pci)
>                        */
>                       sysdev = &pdev->dev;
>             -       if (sysdev->parent && !sysdev->of_node && sysdev->parent->of_node)
>             +       if (sysdev->parent && !is_of_node(sysdev->fwnode) &&
>             +                       !is_acpi_device_node(sysdev->fwnode) &&
>             +                       (is_of_node(sysdev->parent->fwnode) ||
>             +                        is_acpi_device_node(sysdev->parent->fwnode)))
>                               sysdev = sysdev->parent;
>                #ifdef CONFIG_PCI
>                       else if (sysdev->parent && sysdev->parent->parent &&
>             --
>             1.8.3.1
>
>         Is there any comment about the patch?
>         With current kernel (4.13.0-rc6), booting the Linux using ACPI boot,
>         kernel is crashed right after probing the USB DWC3 driver with the
>         following messages:
>
>
>     That should work, but the if statements are getting quite elaborate.
>     How about replacing it all with:
>
>     -       sysdev = &pdev->dev;
>     -       if (sysdev->parent && !sysdev->of_node && sysdev->parent->of_node)
>     -               sysdev = sysdev->parent;
>     -#ifdef CONFIG_PCI
>     -       else if (sysdev->parent && sysdev->parent->parent &&
>     -                sysdev->parent->parent->bus == &pci_bus_type)
>     -               sysdev = sysdev->parent->parent;
>     -#endif
>     +
>     +       for (sysdev = &pdev->dev; sysdev; sysdev = sysdev->parent) {
>     +               if (is_of_node(sysdev->fwnode) ||
>     +                   is_acpi_device_node(sysdev->fwnode))
>     +                       break;
>     +       #ifdef CONFIG_PCI
>     +               else if (sysdev->bus == &pci_bus_type)
>     +                       break;
>     +       #endif
>     +       }
>     +
>     +       if (!sysdev)
>     +               sysdev = &pdev->dev
>
>     Does that work for you?
>
>     -Mathias
>
> It works for me. I tested the followings:
> - ACPI boot: 808622B7 (DWC3) and PNP0D10 (xhci-platform)
> - DT boot: snps,dwc3 (DWC3) and xhci-platform.
> Will you apply your codes into 4.14 kernel?

I will, thanks for testing

-Mathias

      parent reply	other threads:[~2017-09-06  6:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-19  3:43 [PATCH v2 1/1] usb:xhci: update condition to select bus->sysdev from parent device Thang Q. Nguyen
2017-08-24  2:53 ` Thang Q. Nguyen
2017-09-05 11:14   ` Mathias Nyman
     [not found]     ` <CAKrQpSvP9nwCM7C4cxiwbvOqk-s=CxaoOJ8tCaYBCJvZ=rcUrw@mail.gmail.com>
2017-09-06  6:32       ` Mathias Nyman [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=59AF9676.9080904@linux.intel.com \
    --to=mathias.nyman@linux.intel.com \
    --cc=awallis@codeaurora.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=lho@apm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@intel.com \
    --cc=patches@apm.com \
    --cc=pvo@apm.com \
    --cc=tqnguyen@apm.com \
    --cc=tunguyen@apm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox