PCI: qcom-ep: Constify static dw_pcie_ep_ops
Subsystems (4)
PATCH 1/1 PCI: qcom-ep: Constify static dw_pcie_ep_ops
The only usage of pci_ep_ops is to assign its address to the ops field in the dw_pcie_ep struct which is a pointer to const struct dw_pcie_ep_ops. Make it const to allow the compiler to put it in read-only memory.
--- drivers/pci/controller/dwc/pcie-qcom-ep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/controller/dwc/pcie-qcom-ep.c +1 -1
@@ -619,7 +619,7 @@ static void qcom_pcie_ep_init(struct dw_pcie_ep *ep)dw_pcie_ep_reset_bar (pci, bar); } -static struct dw_pcie_ep_ops pci_ep_ops = { +static const struct dw_pcie_ep_ops pci_ep_ops = { .ep_init = qcom_pcie_ep_init, .raise_irq = qcom_pcie_ep_raise_irq, .get_features = qcom_pcie_epc_get_features,
Signature · 1 line
2.34.1
Hi Rikard,
Quoted 3 lines
The only usage of
pci_ep_opsis to assign its address to the ops field in thedw_pcie_epstruct which is a pointer to const structdw_pcie_ep_ops. Make it const to allow the compiler to put it in read-only memory.
[...]
drivers/pci/controller/dwc/pcie-qcom-ep.c static void qcom_pcie_ep_init(struct dw_pcie_ep *ep) · line 625
Quoted 9 lines
drivers/pci/controller/dwc/pcie-qcom-ep.c +1
-1@@ -619,7 +619,7 @@ static void qcom_pcie_ep_init(struct dw_pcie_ep *ep)dw_pcie_ep_reset_bar (pci, bar); } -static struct dw_pcie_ep_ops pci_ep_ops = { +static const struct dw_pcie_ep_ops pci_ep_ops = { .ep_init = qcom_pcie_ep_init, .raise_irq = qcom_pcie_ep_raise_irq, .get_features = qcom_pcie_epc_get_features,
Looks good, thank you!
Krzysztof
Lorenzo Pieralisi
AppliedQuoted 5 lines · Rikard Falkeborn
The only usage of
pci_ep_opsis to assign its address to the ops field in thedw_pcie_epstruct which is a pointer to const structdw_pcie_ep_ops. Make it const to allow the compiler to put it in read-only memory.
Applied to pci/qcom, thanks!
[1/1] PCI: qcom-ep: Constify static dw_pcie_ep_ops
https://git.kernel.org/lpieralisi/pci/c/840a720aaa
Thanks,
Lorenzo