Skip to contentSkip to conversation

drm/imx: make static read-only array channel_offsets const

PATCH Applied Colin Ian King 2 participants 2 messages Jan 23, 2022 – Mar 29, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/imx: make static read-only array channel_offsets const

The static array channel_offsets is read-only so it make sense to make it const.

---
 drivers/gpu/ipu-v3/ipu-dc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/ipu-v3/ipu-dc.c +3 -2
index ca96b235491a..b038a6d7307b 100644
@@ -344,8 +344,9 @@ int ipu_dc_init(struct ipu_soc *ipu, struct device *dev,
 		unsigned long base, unsigned long template_base)
 {
 	struct ipu_dc_priv *priv;
-	static int channel_offsets[] = { 0, 0x1c, 0x38, 0x54, 0x58, 0x5c,
-		0x78, 0, 0x94, 0xb4};
+	static const int channel_offsets[] = {
+		0, 0x1c, 0x38, 0x54, 0x58, 0x5c, 0x78, 0, 0x94, 0xb4
+	};
 	int i;
 
 	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
Signature · 1 line
2.33.1
maintainer Applied
#1 lore raw
Quoted 26 lines · Colin Ian King

The static array channel_offsets is read-only so it make sense to make
it const.

---
 drivers/gpu/ipu-v3/ipu-dc.c | 5 +++--

 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/ipu-v3/ipu- renamed from drivers/gpu/ipu-v3/ipu-dc.c +0 -0

dc.c
index ca96b235491a..b038a6d7307b 100644

drivers/gpu/ipu-v3/ipu-dc.c +3 -2
@@ -344,8 +344,9 @@ int ipu_dc_init(struct ipu_soc *ipu, struct
 device *dev,
                 unsigned long base, unsigned long template_base)
  {
         struct ipu_dc_priv *priv;
-       static int channel_offsets[] = { 0, 0x1c, 0x38, 0x54, 0x58,
 0x5c,
-               0x78, 0, 0x94, 0xb4};
+       static const int channel_offsets[] = {
+               0, 0x1c, 0x38, 0x54, 0x58, 0x5c, 0x78, 0, 0x94, 0xb4
+       };
         int i;
Quoted 2 lines


        priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);

Thank you, applied to imx-drm/next.

regards
Philipp