linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI: qcom-ep: Constify static dw_pcie_ep_ops
@ 2021-12-04 22:03 Rikard Falkeborn
  2021-12-04 22:28 ` Krzysztof Wilczyński
  2022-01-04 15:30 ` Lorenzo Pieralisi
  0 siblings, 2 replies; 3+ messages in thread
From: Rikard Falkeborn @ 2021-12-04 22:03 UTC (permalink / raw)
  To: Manivannan Sadhasivam, Lorenzo Pieralisi, Rob Herring,
	Krzysztof Wilczyński, Bjorn Helgaas
  Cc: linux-pci, linux-arm-msm, linux-kernel, Rikard Falkeborn

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(-)

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,
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] PCI: qcom-ep: Constify static dw_pcie_ep_ops
  2021-12-04 22:03 [PATCH] PCI: qcom-ep: Constify static dw_pcie_ep_ops Rikard Falkeborn
@ 2021-12-04 22:28 ` Krzysztof Wilczyński
  2022-01-04 15:30 ` Lorenzo Pieralisi
  1 sibling, 0 replies; 3+ messages in thread
From: Krzysztof Wilczyński @ 2021-12-04 22:28 UTC (permalink / raw)
  To: Rikard Falkeborn
  Cc: Manivannan Sadhasivam, Lorenzo Pieralisi, Rob Herring,
	Bjorn Helgaas, linux-pci, linux-arm-msm, linux-kernel

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] PCI: qcom-ep: Constify static dw_pcie_ep_ops
  2021-12-04 22:03 [PATCH] PCI: qcom-ep: Constify static dw_pcie_ep_ops Rikard Falkeborn
  2021-12-04 22:28 ` Krzysztof Wilczyński
@ 2022-01-04 15:30 ` Lorenzo Pieralisi
  1 sibling, 0 replies; 3+ messages in thread
From: Lorenzo Pieralisi @ 2022-01-04 15:30 UTC (permalink / raw)
  To: Rob Herring, Krzysztof Wilczyński, Rikard Falkeborn,
	Bjorn Helgaas, Manivannan Sadhasivam
  Cc: Lorenzo Pieralisi, linux-kernel, linux-arm-msm, linux-pci

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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-01-04 15:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-04 22:03 [PATCH] PCI: qcom-ep: Constify static dw_pcie_ep_ops Rikard Falkeborn
2021-12-04 22:28 ` Krzysztof Wilczyński
2022-01-04 15:30 ` Lorenzo Pieralisi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).