PCI: tegra: Constify static structs
PATCH 1/1 PCI: tegra: Constify static structs
The only usage of them is to assign their address to the 'ops' field in the pcie_port and the dw_pcie_ep structs, both which are pointers to const. Make them const to allow the compiler to put them in read-only memory.
--- drivers/pci/controller/dwc/pcie-tegra194.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pci/controller/dwc/pcie-tegra194.c +2 -2
@@ -1019,7 +1019,7 @@ static const struct dw_pcie_ops tegra_dw_pcie_ops = { .stop_link = tegra_pcie_dw_stop_link, }; -static struct dw_pcie_host_ops tegra_pcie_dw_host_ops = { +static const struct dw_pcie_host_ops tegra_pcie_dw_host_ops = { .host_init = tegra_pcie_dw_host_init, };
@@ -1881,7 +1881,7 @@ tegra_pcie_ep_get_features(struct dw_pcie_ep *ep)return &tegra_pcie_epc_features; } -static struct dw_pcie_ep_ops pcie_ep_ops = { +static const struct dw_pcie_ep_ops pcie_ep_ops = { .raise_irq = tegra_pcie_ep_raise_irq, .get_features = tegra_pcie_ep_get_features, };
Signature · 1 line
2.30.0
Hi Rikard,
Thank you for sending the patch over!
Quoted 4 lines
The only usage of them is to assign their address to the 'ops' field in the
pcie_portand thedw_pcie_epstructs, both which are pointers to const. Make them const to allow the compiler to put them in read-only memory.
[...]
Krzysztof
Lorenzo Pieralisi
AppliedQuoted 4 lines · Rikard Falkeborn
The only usage of them is to assign their address to the 'ops' field in the
pcie_portand thedw_pcie_epstructs, both which are pointers to const. Make them const to allow the compiler to put them in read-only memory.
Applied to pci/tegra, thanks!
[1/1] PCI: tegra: Constify static structs
https://git.kernel.org/lpieralisi/pci/c/d895ce7030
Thanks,
Lorenzo