Skip to contentSkip to conversation

drm: constify read-only regmap structs

PATCH Applied Javier Carrasco 4 participants 11 messages Sep 25, 2024 – Oct 19, 2024

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

cover drm: constify read-only regmap structs

This series adds the const modifier to the remaining regmap_bus and regmap_config structs under drm/ that are effectively used as const (i.e., only read after their declaration), but kept ad writtable data.

---
Javier Carrasco (6):
drm/bridge: dpc3433: Constify struct regmap_config drm/fsl-dcu: Constify struct regmap_config drm/mediatek: dp: Constify struct regmap_config drm/meson: Constify struct regmap_config drm/panel: ili9322: Constify struct regmap_bus drm/sprd: Constify struct regmap_bus

 drivers/gpu/drm/bridge/ti-dlpc3433.c         | 2 +-
 drivers/gpu/drm/fsl-dcu/fsl_tcon.c           | 2 +-
 drivers/gpu/drm/mediatek/mtk_dp.c            | 2 +-
 drivers/gpu/drm/meson/meson_drv.c            | 2 +-
 drivers/gpu/drm/panel/panel-ilitek-ili9322.c | 2 +-
 drivers/gpu/drm/sprd/sprd_dsi.c              | 2 +-
 6 files changed, 6 insertions(+), 6 deletions(-)

---
base-commit: 2b7275670032a98cba266bd1b8905f755b3e650f
change-id: 20240925-drm-const-regmap-307f2c358d10

Best regards,

Signature · 1 line
Javier Carrasco <[email protected]>
#1 lore raw

PATCH 1/6 drm/bridge: dpc3433: Constify struct regmap_config

dlpc_regmap_config is not modified and can be declared as const to move its data to a read-only section.

---
 drivers/gpu/drm/bridge/ti-dlpc3433.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/bridge/ti-dlpc3433.c +1 -1
index 6b559e071301..a0a1b5dd794e 100644
@@ -94,7 +94,7 @@ static const struct regmap_access_table dlpc_volatile_table = {
 	.n_yes_ranges = ARRAY_SIZE(dlpc_volatile_ranges),
 };
 
-static struct regmap_config dlpc_regmap_config = {
+static const struct regmap_config dlpc_regmap_config = {
 	.reg_bits		= 8,
 	.val_bits		= 8,
 	.max_register		= WR_DSI_PORT_EN,
Signature · 1 line
2.43.0
#2 lore raw

PATCH 2/6 drm/fsl-dcu: Constify struct regmap_config

In reply to Javier Carrasco

fsl_tcon_regmap_config is not modified and can be declared as const to move its data to a read-only section.

---
 drivers/gpu/drm/fsl-dcu/fsl_tcon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/fsl-dcu/fsl_tcon.c +1 -1
index 9eb5abaf7d66..49bbd00c77ae 100644
@@ -29,7 +29,7 @@ void fsl_tcon_bypass_enable(struct fsl_tcon *tcon)
 			   FSL_TCON_CTRL1_TCON_BYPASS);
 }
 
-static struct regmap_config fsl_tcon_regmap_config = {
+static const struct regmap_config fsl_tcon_regmap_config = {
 	.reg_bits = 32,
 	.reg_stride = 4,
 	.val_bits = 32,
Signature · 1 line
2.43.0
#3 lore raw

PATCH 3/6 drm/mediatek: dp: Constify struct regmap_config

In reply to Javier Carrasco

mtk_dp_regmap_config is not modified and can be declared as const to move its data to a read-only section.

---
 drivers/gpu/drm/mediatek/mtk_dp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/mediatek/mtk_dp.c +1 -1
index d8796a904eca..f0f6f402994a 100644
@@ -311,7 +311,7 @@ static const struct mtk_dp_efuse_fmt mt8195_dp_efuse_fmt[MTK_DP_CAL_MAX] = {
 	},
 };
 
-static struct regmap_config mtk_dp_regmap_config = {
+static const struct regmap_config mtk_dp_regmap_config = {
 	.reg_bits = 32,
 	.val_bits = 32,
 	.reg_stride = 4,
Signature · 1 line
2.43.0
#4 lore raw

PATCH 4/6 drm/meson: Constify struct regmap_config

In reply to Javier Carrasco

meson_regmap_config is not modified and can be declared as const to move its data to a read-only section.

---
 drivers/gpu/drm/meson/meson_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/meson/meson_drv.c +1 -1
index 4bd0baa2a4f5..6c8677d1f562 100644
@@ -126,7 +126,7 @@ static bool meson_vpu_has_available_connectors(struct device *dev)
 	return false;
 }
 
-static struct regmap_config meson_regmap_config = {
+static const struct regmap_config meson_regmap_config = {
 	.reg_bits       = 32,
 	.val_bits       = 32,
 	.reg_stride     = 4,
Signature · 1 line
2.43.0
#5 lore raw

PATCH 5/6 drm/panel: ili9322: Constify struct regmap_bus

In reply to Javier Carrasco

ili9322_regmap_bus is not modified and can be declared as const to move its data to a read-only section.

---
 drivers/gpu/drm/panel/panel-ilitek-ili9322.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/panel/panel-ilitek-ili9322.c +1 -1
index 4a6dcfd781e8..94b7dfef3b5e 100644
@@ -318,7 +318,7 @@ static int ili9322_regmap_spi_read(void *context, const void *reg,
 	return spi_write_then_read(spi, buf, 1, val, 1);
 }
 
-static struct regmap_bus ili9322_regmap_bus = {
+static const struct regmap_bus ili9322_regmap_bus = {
 	.write = ili9322_regmap_spi_write,
 	.read = ili9322_regmap_spi_read,
 	.reg_format_endian_default = REGMAP_ENDIAN_BIG,
Signature · 1 line
2.43.0
#7 lore raw

PATCH 6/6 drm/sprd: Constify struct regmap_bus

In reply to Javier Carrasco

regmap_txt_io is not modified and can be declared as const to move its data to a read-only section.

---
 drivers/gpu/drm/sprd/sprd_dsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/sprd/sprd_dsi.c +1 -1
index 0b69c140eab3..44a7a579660f 100644
@@ -209,7 +209,7 @@ static int regmap_tst_io_read(void *context, u32 reg, u32 *val)
 	return 0;
 }
 
-static struct regmap_bus regmap_tst_io = {
+static const struct regmap_bus regmap_tst_io = {
 	.reg_write = regmap_tst_io_write,
 	.reg_read = regmap_tst_io_read,
 };
Signature · 1 line
2.43.0
Reviewed-by on the v1 series
#8 lore raw
In reply to Javier Carrasco
Quoted 5 lines · Javier Carrasco

This series adds the const modifier to the remaining regmap_bus and regmap_config structs under drm/ that are effectively used as const (i.e., only read after their declaration), but kept ad writtable data.

Quoted 9 lines

---
Javier Carrasco (6):
drm/bridge: dpc3433: Constify struct regmap_config drm/fsl-dcu: Constify struct regmap_config drm/mediatek: dp: Constify struct regmap_config drm/meson: Constify struct regmap_config drm/panel: ili9322: Constify struct regmap_bus drm/sprd: Constify struct regmap_bus

For the series:

Signature · 2 lines
With best wishes
Dmitry
maintainer Reviewed-by on the v1 series
#9 lore raw
In reply to Javier Carrasco

Il 25/09/24 17:42, Javier Carrasco ha scritto:

Quoted 5 lines

This series adds the const modifier to the remaining regmap_bus and regmap_config structs under drm/ that are effectively used as const (i.e., only read after their declaration), but kept ad writtable data.

For the entire series:

Quoted 21 lines

---
Javier Carrasco (6):
drm/bridge: dpc3433: Constify struct regmap_config drm/fsl-dcu: Constify struct regmap_config drm/mediatek: dp: Constify struct regmap_config drm/meson: Constify struct regmap_config drm/panel: ili9322: Constify struct regmap_bus drm/sprd: Constify struct regmap_bus

  drivers/gpu/drm/bridge/ti-dlpc3433.c         | 2 +-
  drivers/gpu/drm/fsl-dcu/fsl_tcon.c           | 2 +-
  drivers/gpu/drm/mediatek/mtk_dp.c            | 2 +-
  drivers/gpu/drm/meson/meson_drv.c            | 2 +-
  drivers/gpu/drm/panel/panel-ilitek-ili9322.c | 2 +-
  drivers/gpu/drm/sprd/sprd_dsi.c              | 2 +-
  6 files changed, 6 insertions(+), 6 deletions(-)

---
base-commit: 2b7275670032a98cba266bd1b8905f755b3e650f
change-id: 20240925-drm-const-regmap-307f2c358d10

Best regards,

maintainer Reviewed-by on v1 5/6
#6 lore raw

Re: [PATCH 5/6] drm/panel: ili9322: Constify struct regmap_bus

In reply to Javier Carrasco
Quoted 14 lines · Javier Carrasco

ili9322_regmap_bus is not modified and can be declared as const to move its data to a read-only section.

---
  drivers/gpu/drm/panel/panel-ilitek-ili9322.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/panel/panel-ilitek-ili9322.c +0 -0
index 4a6dcfd781e8..94b7dfef3b5e 100644

drivers/gpu/drm/panel/panel-ilitek-ili9322.c static int ili9322_regmap_spi_read(void *context, const void *reg, · line 324

Quoted 8 lines
drivers/gpu/drm/panel/panel-ilitek-ili9322.c +1 -1
@@ -318,7 +318,7 @@ static int ili9322_regmap_spi_read(void *context, const void *reg,
  	return spi_write_then_read(spi, buf, 1, val, 1);
  }
 
-static struct regmap_bus ili9322_regmap_bus = {
+static const struct regmap_bus ili9322_regmap_bus = {
  	.write = ili9322_regmap_spi_write,
  	.read = ili9322_regmap_spi_read,
  	.reg_format_endian_default = REGMAP_ENDIAN_BIG,
#10 lore raw
In reply to Javier Carrasco
Quoted 5 lines · Javier Carrasco

This series adds the const modifier to the remaining regmap_bus and regmap_config structs under drm/ that are effectively used as const (i.e., only read after their declaration), but kept ad writtable data.

Applied to drm-misc-next, thanks!

[1/6] drm/bridge: dpc3433: Constify struct regmap_config

      commit: b895a1805e0b01d523afa71818cb97a5d2655fcf
[2/6] drm/fsl-dcu: Constify struct regmap_config
      commit: 9239d961ce9d95ec13e241407d0320228e664d68
[3/6] drm/mediatek: dp: Constify struct regmap_config
      commit: 02f686d17c4305a0b5e2a9de749664dfe9c0f63e
[4/6] drm/meson: Constify struct regmap_config
      commit: 0bcbddb7ef0edb8b4ca994033128e955bb8b1b74
[5/6] drm/panel: ili9322: Constify struct regmap_bus
      commit: 6a92271233fb4789f69a9ba9410b23e2e5ab30e2
[6/6] drm/sprd: Constify struct regmap_bus
      commit: 420fb223fe6049f5eecac0d28136df5bc5699ea2

Best regards,

Signature · 2 lines
With best wishes
Dmitry