Re: [PATCH v6 7/7] PCI: Unify wait for link active into generic pci
From: Stefan Roese
Date: Fri Jan 19 2018 - 09:19:39 EST
On 19.01.2018 12:10, Oza Pawandeep wrote:
> Clients such as pciehp, dpc are using pcie_wait_link_active, which waits
> till the link becomes active or inactive.
>
> Made generic function and moved it to drivers/pci/pci.c
>
> Signed-off-by: Oza Pawandeep <poza@xxxxxxxxxxxxxx>
>
> diff --git a/drivers/pci/hotplug/pciehp_hpc.c b/drivers/pci/hotplug/pciehp_hpc.c
> index 7bab060..26afeff 100644
> --- a/drivers/pci/hotplug/pciehp_hpc.c
> +++ b/drivers/pci/hotplug/pciehp_hpc.c
> @@ -245,25 +245,12 @@ bool pciehp_check_link_active(struct controller *ctrl)
> return ret;
> }
>
> -static void __pcie_wait_link_active(struct controller *ctrl, bool active)
> +static bool pcie_wait_link_active(struct controller *ctrl)
> {
> - int timeout = 1000;
> -
> - if (pciehp_check_link_active(ctrl) == active)
> - return;
> - while (timeout > 0) {
> - msleep(10);
> - timeout -= 10;
> - if (pciehp_check_link_active(ctrl) == active)
> - return;
> - }
> - ctrl_dbg(ctrl, "Data Link Layer Link Active not %s in 1000 msec\n",
> - active ? "set" : "cleared");
> -}
> + struct pci_dev *pdev = ctrl_dev(ctrl);
> + bool active = true;
>
> -static void pcie_wait_link_active(struct controller *ctrl)
> -{
> - __pcie_wait_link_active(ctrl, true);
> + return pci_wait_for_link(pdev, active);
> }
>
> static bool pci_bus_check_dev(struct pci_bus *bus, int devfn)
> diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
> index 4a7c686..0de83ea 100644
> --- a/drivers/pci/pci.c
> +++ b/drivers/pci/pci.c
> @@ -2805,7 +2805,7 @@ static void pci_std_enable_acs(struct pci_dev *dev)
> pci_read_config_word(dev, pos + PCI_ACS_CTRL, &ctrl);
>
> /* Source Validation */
> - ctrl |= (cap & PCI_ACS_SV);
> +// ctrl |= (cap & PCI_ACS_SV);
Could it be, that you missed to fix / clean something up here?
Thanks,
Stefan