[PATCH] PCI: qcom: Make rst_names array static with const elements

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 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




[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux