Re: [PATCH] usb: host: xhci-plat: Iterate over parent nodes for finding quirks

From: Mathias Nyman
Date: Mon Aug 06 2018 - 06:47:42 EST


Hi,

Back from vacation

On 20.07.2018 18:39, Anurag Kumar Vulisha wrote:

Hi Mathias,

Thanks for providing your comments, please find my comments inline


- 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.

I have seen some drivers ( like dwc3 host.c) which create a child dev, which is
the pdev that is being passed to xhci_plat_probe(). So, sysdev may not be the
topmost parent. There could be some properties which may be present in parent
and may not be populated in the child. So, I made this change to search on all
available parents for finding a valid property

Ok, lets keep it like you wrote it



- 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


I thought it would be better if everything related to imod_interval is in one place,
so kept it as is. I can fix this in v2 if you suggest.

Default imod_interval needs to be set before the for loop to avoid overwriting a value
got from device property

So a v2 is needed

-Mathias