Skip to content

Commit 3a4b05c

Browse files
PCI: cadence-ep: Introduce cdns_pcie_ep_disable() helper for cleanup
Introduce the helper function cdns_pcie_ep_disable() which will undo the configuration performed by cdns_pcie_ep_setup(). Also, export it for use by the existing callers of cdns_pcie_ep_setup(), thereby allowing them to cleanup on their exit path. Signed-off-by: Siddharth Vadapalli <[email protected]> Signed-off-by: Manivannan Sadhasivam <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Manivannan Sadhasivam <[email protected]> Link: https://patch.msgid.link/[email protected]
1 parent 47f25da commit 3a4b05c

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

drivers/pci/controller/cadence/pcie-cadence-ep.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,17 @@ static const struct pci_epc_ops cdns_pcie_epc_ops = {
646646
.get_features = cdns_pcie_ep_get_features,
647647
};
648648

649+
void cdns_pcie_ep_disable(struct cdns_pcie_ep *ep)
650+
{
651+
struct device *dev = ep->pcie.dev;
652+
struct pci_epc *epc = to_pci_epc(dev);
653+
654+
pci_epc_deinit_notify(epc);
655+
pci_epc_mem_free_addr(epc, ep->irq_phys_addr, ep->irq_cpu_addr,
656+
SZ_128K);
657+
pci_epc_mem_exit(epc);
658+
}
659+
EXPORT_SYMBOL_GPL(cdns_pcie_ep_disable);
649660

650661
int cdns_pcie_ep_setup(struct cdns_pcie_ep *ep)
651662
{

drivers/pci/controller/cadence/pcie-cadence.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,11 +544,16 @@ static inline void __iomem *cdns_pci_map_bus(struct pci_bus *bus, unsigned int d
544544

545545
#if IS_ENABLED(CONFIG_PCIE_CADENCE_EP)
546546
int cdns_pcie_ep_setup(struct cdns_pcie_ep *ep);
547+
void cdns_pcie_ep_disable(struct cdns_pcie_ep *ep);
547548
#else
548549
static inline int cdns_pcie_ep_setup(struct cdns_pcie_ep *ep)
549550
{
550551
return 0;
551552
}
553+
554+
static inline void cdns_pcie_ep_disable(struct cdns_pcie_ep *ep)
555+
{
556+
}
552557
#endif
553558

554559
void cdns_pcie_detect_quiet_min_delay_set(struct cdns_pcie *pcie);

0 commit comments

Comments
 (0)