LKML Archive mirror
 help / color / mirror / Atom feed
* [PATCH] PCI: tegra: Constify static structs
@ 2021-02-07 22:16 Rikard Falkeborn
  2021-03-07 17:28 ` Krzysztof Wilczyński
  2021-03-22 12:57 ` Lorenzo Pieralisi
  0 siblings, 2 replies; 3+ messages in thread
From: Rikard Falkeborn @ 2021-02-07 22:16 UTC (permalink / raw
  To: Lorenzo Pieralisi, Bjorn Helgaas, Thierry Reding, Jonathan Hunter
  Cc: Vidya Sagar, Jingoo Han, linux-pci, linux-tegra, linux-kernel,
	Rikard Falkeborn

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.

Signed-off-by: Rikard Falkeborn <rikard.falkeborn@gmail.com>
---
 drivers/pci/controller/dwc/pcie-tegra194.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/pci/controller/dwc/pcie-tegra194.c b/drivers/pci/controller/dwc/pcie-tegra194.c
index 6fa216e52d14..18acd48e8e9b 100644
--- a/drivers/pci/controller/dwc/pcie-tegra194.c
+++ b/drivers/pci/controller/dwc/pcie-tegra194.c
@@ -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,
 };
-- 
2.30.0


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

* Re: [PATCH] PCI: tegra: Constify static structs
  2021-02-07 22:16 [PATCH] PCI: tegra: Constify static structs Rikard Falkeborn
@ 2021-03-07 17:28 ` Krzysztof Wilczyński
  2021-03-22 12:57 ` Lorenzo Pieralisi
  1 sibling, 0 replies; 3+ messages in thread
From: Krzysztof Wilczyński @ 2021-03-07 17:28 UTC (permalink / raw
  To: Rikard Falkeborn
  Cc: Lorenzo Pieralisi, Bjorn Helgaas, Thierry Reding, Jonathan Hunter,
	Vidya Sagar, Jingoo Han, linux-pci, linux-tegra, linux-kernel

Hi Rikard,

Thank you for sending the patch over!

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

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

Krzysztof

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

* Re: [PATCH] PCI: tegra: Constify static structs
  2021-02-07 22:16 [PATCH] PCI: tegra: Constify static structs Rikard Falkeborn
  2021-03-07 17:28 ` Krzysztof Wilczyński
@ 2021-03-22 12:57 ` Lorenzo Pieralisi
  1 sibling, 0 replies; 3+ messages in thread
From: Lorenzo Pieralisi @ 2021-03-22 12:57 UTC (permalink / raw
  To: Thierry Reding, Bjorn Helgaas, Jonathan Hunter, Rikard Falkeborn
  Cc: Lorenzo Pieralisi, linux-kernel, linux-pci, linux-tegra,
	Vidya Sagar, Jingoo Han

On Sun, 7 Feb 2021 23:16:04 +0100, Rikard Falkeborn wrote:
> 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.

Applied to pci/tegra, thanks!

[1/1] PCI: tegra: Constify static structs
      https://git.kernel.org/lpieralisi/pci/c/d895ce7030

Thanks,
Lorenzo

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

end of thread, other threads:[~2021-03-22 13:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-02-07 22:16 [PATCH] PCI: tegra: Constify static structs Rikard Falkeborn
2021-03-07 17:28 ` Krzysztof Wilczyński
2021-03-22 12:57 ` 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 read-only IMAP folder(s) and NNTP newsgroup(s).