All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] PCI: qcom: Make rst_names array static with const elements
@ 2021-10-12  2:21 Krzysztof Wilczyński
  0 siblings, 0 replies; only message in thread
From: Krzysztof Wilczyński @ 2021-10-12  2:21 UTC (permalink / raw)
  To: Bjorn Helgaas
  Cc: Lorenzo Pieralisi, Rob Herring, Stanimir Varbanov, Andy Gross,
	Bjorn Andersson, linux-pci, linux-arm-msm

A static const string array often reduces size of the size of text
section and can lead to an improved runtime performance as the need
to initialize and populate the array every time a given function is
called would be removed, contrary to local variables that live on
the stack and have to be initialized every time the come into scope.

Thus, make the rst_names array a static const array with constant
strings elements (stored in the .rodata section) so that it will be
stored in the data section and accessible for the total lifetime of
the running kernel.

Signed-off-by: Krzysztof Wilczyński <kw@linux.com>
---
 drivers/pci/controller/dwc/pcie-qcom.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/controller/dwc/pcie-qcom.c b/drivers/pci/controller/dwc/pcie-qcom.c
index 8a7a300163e5..6bb616b45388 100644
--- a/drivers/pci/controller/dwc/pcie-qcom.c
+++ b/drivers/pci/controller/dwc/pcie-qcom.c
@@ -977,9 +977,9 @@ static int qcom_pcie_get_resources_2_3_3(struct qcom_pcie *pcie)
 	struct dw_pcie *pci = pcie->pci;
 	struct device *dev = pci->dev;
 	int i;
-	const char *rst_names[] = { "axi_m", "axi_s", "pipe",
-				    "axi_m_sticky", "sticky",
-				    "ahb", "sleep", };
+	static const char * const rst_names[] = { "axi_m", "axi_s", "pipe",
+						  "axi_m_sticky", "sticky",
+						  "ahb", "sleep", };
 
 	res->iface = devm_clk_get(dev, "iface");
 	if (IS_ERR(res->iface))
-- 
2.33.0


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-10-12  2:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-12  2:21 [PATCH] PCI: qcom: Make rst_names array static with const elements Krzysztof Wilczyński

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.