Re: [PATCH v5 09/12] PCI: endpoint: Make epc->ops->clear_bar()/pci_epc_clear_bar() take struct *epf_bar

From: Kishon Vijay Abraham I
Date: Thu Mar 29 2018 - 06:00:53 EST


Hi Niklas,

On Wednesday 28 March 2018 05:20 PM, Niklas Cassel wrote:
> Make epc->ops->clear_bar()/pci_epc_clear_bar() take struct *epf_bar.
>
> This is needed so that epc->ops->clear_bar() can clear the BAR pair,
> if the BAR is 64-bits wide.
>
> This also makes it possible for pci_epc_clear_bar() to sanity check
> the flags.
>
> Signed-off-by: Niklas Cassel <niklas.cassel@xxxxxxxx>
> ---
> drivers/pci/cadence/pcie-cadence-ep.c | 3 ++-
> drivers/pci/dwc/pcie-designware-ep.c | 13 ++++++++++---
> drivers/pci/endpoint/functions/pci-epf-test.c | 5 ++++-
> drivers/pci/endpoint/pci-epc-core.c | 7 ++++---
> include/linux/pci-epc.h | 5 +++--
> 5 files changed, 23 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/pci/cadence/pcie-cadence-ep.c b/drivers/pci/cadence/pcie-cadence-ep.c
> index 2905e098678c..3d8283e450a9 100644
> --- a/drivers/pci/cadence/pcie-cadence-ep.c
> +++ b/drivers/pci/cadence/pcie-cadence-ep.c
> @@ -145,10 +145,11 @@ static int cdns_pcie_ep_set_bar(struct pci_epc *epc, u8 fn,
> }
>
> static void cdns_pcie_ep_clear_bar(struct pci_epc *epc, u8 fn,
> - enum pci_barno bar)
> + struct pci_epf_bar *epf_bar)
> {
> struct cdns_pcie_ep *ep = epc_get_drvdata(epc);
> struct cdns_pcie *pcie = &ep->pcie;
> + enum pci_barno bar = epf_bar->barno;
> u32 reg, cfg, b, ctrl;
>
> if (bar < BAR_4) {
> diff --git a/drivers/pci/dwc/pcie-designware-ep.c b/drivers/pci/dwc/pcie-designware-ep.c
> index 571b90f88d84..cc4d8381c1dc 100644
> --- a/drivers/pci/dwc/pcie-designware-ep.c
> +++ b/drivers/pci/dwc/pcie-designware-ep.c
> @@ -19,7 +19,8 @@ void dw_pcie_ep_linkup(struct dw_pcie_ep *ep)
> pci_epc_linkup(epc);
> }
>
> -void dw_pcie_ep_reset_bar(struct dw_pcie *pci, enum pci_barno bar)
> +static void __dw_pcie_ep_reset_bar(struct dw_pcie *pci, enum pci_barno bar,
> + int flags)

Looks like the 'flags' are not used anywhere here?

Thanks
Kishon