diff mbox series

PCI: qcom-ep: Constify static dw_pcie_ep_ops

Message ID 20211204220316.88655-1-rikard.falkeborn@gmail.com (mailing list archive)
State Not Applicable
Headers show
Series PCI: qcom-ep: Constify static dw_pcie_ep_ops | expand

Commit Message

Rikard Falkeborn Dec. 4, 2021, 10:03 p.m. UTC
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.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
 drivers/pci/controller/dwc/pcie-qcom-ep.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Krzysztof Wilczyński Dec. 4, 2021, 10:28 p.m. UTC | #1
Hi Rikard,

> 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.

[...]
> @@ -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!

Reviewed-by: Krzysztof Wilczyński <kw@linux.com>

	Krzysztof
Lorenzo Pieralisi Jan. 4, 2022, 3:30 p.m. UTC | #2
On Sat, 4 Dec 2021 23:03:16 +0100, Rikard Falkeborn wrote:
> 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.
> 
> 

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
diff mbox series

Patch

diff --git a/drivers/pci/controller/dwc/pcie-qcom-ep.c b/drivers/pci/controller/dwc/pcie-qcom-ep.c
index 7b17da2f9b3f..c4c78ba7fba5 100644
--- a/drivers/pci/controller/dwc/pcie-qcom-ep.c
+++ b/drivers/pci/controller/dwc/pcie-qcom-ep.c
@@ -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,