Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

PCI: dwc: Remove duplicate dw_pcie_ep_hide_ext_capability() function

Remove dw_pcie_ep_hide_ext_capability() and replace its usage with
dw_pcie_remove_ext_capability(). Both functions serve the same purpose
of hiding PCIe extended capabilities, but dw_pcie_remove_ext_capability()
provides a cleaner API that doesn't require the caller to specify the
previous capability ID.

Suggested-by: Niklas Cassel <cassel@kernel.org>
Signed-off-by: Qiang Yu <qiang.yu@oss.qualcomm.com>
Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
Tested-by: Niklas Cassel <cassel@kernel.org>
Link: https://patch.msgid.link/20251224-remove_dw_pcie_ep_hide_ext_capability-v1-1-4302c9cdc316@oss.qualcomm.com

authored by

Qiang Yu and committed by
Manivannan Sadhasivam
86291f77 58a17b26

+1 -49
-39
drivers/pci/controller/dwc/pcie-designware-ep.c
··· 75 75 cap, NULL, ep, func_no); 76 76 } 77 77 78 - /** 79 - * dw_pcie_ep_hide_ext_capability - Hide a capability from the linked list 80 - * @pci: DWC PCI device 81 - * @prev_cap: Capability preceding the capability that should be hidden 82 - * @cap: Capability that should be hidden 83 - * 84 - * Return: 0 if success, errno otherwise. 85 - */ 86 - int dw_pcie_ep_hide_ext_capability(struct dw_pcie *pci, u8 prev_cap, u8 cap) 87 - { 88 - u16 prev_cap_offset, cap_offset; 89 - u32 prev_cap_header, cap_header; 90 - 91 - prev_cap_offset = dw_pcie_find_ext_capability(pci, prev_cap); 92 - if (!prev_cap_offset) 93 - return -EINVAL; 94 - 95 - prev_cap_header = dw_pcie_readl_dbi(pci, prev_cap_offset); 96 - cap_offset = PCI_EXT_CAP_NEXT(prev_cap_header); 97 - cap_header = dw_pcie_readl_dbi(pci, cap_offset); 98 - 99 - /* cap must immediately follow prev_cap. */ 100 - if (PCI_EXT_CAP_ID(cap_header) != cap) 101 - return -EINVAL; 102 - 103 - /* Clear next ptr. */ 104 - prev_cap_header &= ~GENMASK(31, 20); 105 - 106 - /* Set next ptr to next ptr of cap. */ 107 - prev_cap_header |= cap_header & GENMASK(31, 20); 108 - 109 - dw_pcie_dbi_ro_wr_en(pci); 110 - dw_pcie_writel_dbi(pci, prev_cap_offset, prev_cap_header); 111 - dw_pcie_dbi_ro_wr_dis(pci); 112 - 113 - return 0; 114 - } 115 - EXPORT_SYMBOL_GPL(dw_pcie_ep_hide_ext_capability); 116 - 117 78 static int dw_pcie_ep_write_header(struct pci_epc *epc, u8 func_no, u8 vfunc_no, 118 79 struct pci_epf_header *hdr) 119 80 {
-7
drivers/pci/controller/dwc/pcie-designware.h
··· 912 912 int dw_pcie_ep_raise_msix_irq_doorbell(struct dw_pcie_ep *ep, u8 func_no, 913 913 u16 interrupt_num); 914 914 void dw_pcie_ep_reset_bar(struct dw_pcie *pci, enum pci_barno bar); 915 - int dw_pcie_ep_hide_ext_capability(struct dw_pcie *pci, u8 prev_cap, u8 cap); 916 915 struct dw_pcie_ep_func * 917 916 dw_pcie_ep_get_func_from_ep(struct dw_pcie_ep *ep, u8 func_no); 918 917 #else ··· 967 968 968 969 static inline void dw_pcie_ep_reset_bar(struct dw_pcie *pci, enum pci_barno bar) 969 970 { 970 - } 971 - 972 - static inline int dw_pcie_ep_hide_ext_capability(struct dw_pcie *pci, 973 - u8 prev_cap, u8 cap) 974 - { 975 - return 0; 976 971 } 977 972 978 973 static inline struct dw_pcie_ep_func *
+1 -3
drivers/pci/controller/dwc/pcie-dw-rockchip.c
··· 347 347 if (!of_device_is_compatible(dev->of_node, "rockchip,rk3588-pcie-ep")) 348 348 return; 349 349 350 - if (dw_pcie_ep_hide_ext_capability(pci, PCI_EXT_CAP_ID_SECPCI, 351 - PCI_EXT_CAP_ID_ATS)) 352 - dev_err(dev, "failed to hide ATS capability\n"); 350 + dw_pcie_remove_ext_capability(pci, PCI_EXT_CAP_ID_ATS); 353 351 } 354 352 355 353 static void rockchip_pcie_ep_init(struct dw_pcie_ep *ep)