Skip to contentSkip to conversation

drm: constify drm_encoder_helper_funcs structures

PATCH Superseded Bhumika Goyal 3 participants 6 messages Jun 20, 2017 – Jun 21, 2017

Subsystems (6)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover drm: constify drm_encoder_helper_funcs structures

Add const to drm_encoder_helper_funcs structures.

Bhumika Goyal (2):
drm/rockchip: add const to drm_encoder_helper_funcs structures drm/sun4i: add const to drm_encoder_helper_funcs structures

 drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 3 ++-
 drivers/gpu/drm/rockchip/inno_hdmi.c            | 2 +-
 drivers/gpu/drm/sun4i/sun4i_rgb.c               | 2 +-
 drivers/gpu/drm/sun4i/sun4i_tv.c                | 2 +-
 4 files changed, 5 insertions(+), 4 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/2 drm/rockchip: add const to drm_encoder_helper_funcs structures

Add const to drm_encoder_helper_funcs structures as they are only passed as an argument to the function drm_encoder_helper_add and this argument is of type const. So, add const to these structures. Also, fix line over 80 characters warning while adding const.

---
 drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 3 ++-
 drivers/gpu/drm/rockchip/inno_hdmi.c            | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +2 -1
index 9606121..96c6c10 100644
@@ -252,7 +252,8 @@ rockchip_dp_drm_encoder_atomic_check(struct drm_encoder *encoder,
 	return 0;
 }
 
-static struct drm_encoder_helper_funcs rockchip_dp_encoder_helper_funcs = {
+static
+const struct drm_encoder_helper_funcs rockchip_dp_encoder_helper_funcs = {
 	.mode_fixup = rockchip_dp_drm_encoder_mode_fixup,
 	.mode_set = rockchip_dp_drm_encoder_mode_set,
 	.enable = rockchip_dp_drm_encoder_enable,
drivers/gpu/drm/rockchip/inno_hdmi.c +1 -1
index 7d9b75e..4ab9fad 100644
@@ -530,7 +530,7 @@ inno_hdmi_encoder_atomic_check(struct drm_encoder *encoder,
 	return 0;
 }
 
-static struct drm_encoder_helper_funcs inno_hdmi_encoder_helper_funcs = {
+static const struct drm_encoder_helper_funcs inno_hdmi_encoder_helper_funcs = {
 	.enable     = inno_hdmi_encoder_enable,
 	.disable    = inno_hdmi_encoder_disable,
 	.mode_fixup = inno_hdmi_encoder_mode_fixup,
Signature · 1 line
2.7.4
#4 lore raw

PATCH 2/2 drm/sun4i: add const to drm_encoder_helper_funcs structures

In reply to Bhumika Goyal

Add const to drm_encoder_helper_funcs structures as they are only passed as an argument to the function drm_encoder_helper_add and this argument is of type const. So, add const to these structures.

---
 drivers/gpu/drm/sun4i/sun4i_rgb.c | 2 +-
 drivers/gpu/drm/sun4i/sun4i_tv.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/sun4i/sun4i_rgb.c +1 -1
index 422b191..67847d2 100644
@@ -181,7 +181,7 @@ static void sun4i_rgb_encoder_mode_set(struct drm_encoder *encoder,
 	clk_set_phase(tcon->dclk, 120);
 }
 
-static struct drm_encoder_helper_funcs sun4i_rgb_enc_helper_funcs = {
+static const struct drm_encoder_helper_funcs sun4i_rgb_enc_helper_funcs = {
 	.atomic_check	= sun4i_rgb_atomic_check,
 	.mode_set	= sun4i_rgb_encoder_mode_set,
 	.disable	= sun4i_rgb_encoder_disable,
drivers/gpu/drm/sun4i/sun4i_tv.c +1 -1
index 338b9e5..b20f97a 100644
@@ -488,7 +488,7 @@ static void sun4i_tv_mode_set(struct drm_encoder *encoder,
 	regmap_write(tv->regs, SUN4I_TVE_SLAVE_REG, 0);
 }
 
-static struct drm_encoder_helper_funcs sun4i_tv_helper_funcs = {
+static const struct drm_encoder_helper_funcs sun4i_tv_helper_funcs = {
 	.atomic_check	= sun4i_tv_atomic_check,
 	.disable	= sun4i_tv_disable,
 	.enable		= sun4i_tv_enable,
Signature · 1 line
2.7.4
Acked-by on v1 2/2
#5 lore raw

Re: [PATCH 2/2] drm/sun4i: add const to drm_encoder_helper_funcs structures

Quoted 5 lines · Bhumika Goyal

Add const to drm_encoder_helper_funcs structures as they are only passed as an argument to the function drm_encoder_helper_add and this argument is of type const. So, add const to these structures.

Signature · 3 lines
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
#2 lore raw

Re: [PATCH 1/2] drm/rockchip: add const to drm_encoder_helper_funcs structures

In reply to Bhumika Goyal
Quoted 16 lines · Bhumika Goyal

Add const to drm_encoder_helper_funcs structures as they are only passed as an argument to the function drm_encoder_helper_add and this argument is of type const. So, add const to these structures. Also, fix line over 80 characters warning while adding const.

---
  drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 3 ++-
  drivers/gpu/drm/rockchip/inno_hdmi.c            | 2 +-
  2 files changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +0 -0
index 9606121..96c6c10 100644

drivers/gpu/drm/rockchip/analogix_dp-rockchip.c rockchip_dp_drm_encoder_atomic_check(struct drm_encoder *encoder, · line 256

Quoted 6 lines
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +2 -1
@@ -252,7 +252,8 @@ rockchip_dp_drm_encoder_atomic_check(struct drm_encoder *encoder,
  	return 0;
  }
 
-static struct drm_encoder_helper_funcs rockchip_dp_encoder_helper_funcs = {
+static
+const struct drm_encoder_helper_funcs rockchip_dp_encoder_helper_funcs = {

I don't think split static and const into two line is a good idea, it's ugly. I'm ok over 80 characters with good-looking.
Or split like following:
static const struct drm_encoder_helper_funcs rockchip_dp_encoder_helper_funcs = {

Quoted 8 lines
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +0 -0
  	.mode_fixup = rockchip_dp_drm_encoder_mode_fixup,
  	.mode_set = rockchip_dp_drm_encoder_mode_set,
  	.enable = rockchip_dp_drm_encoder_enable,
drivers/gpu/drm/rockchip/inno_hdmi.c +0 -0
index 7d9b75e..4ab9fad 100644

drivers/gpu/drm/rockchip/inno_hdmi.c inno_hdmi_encoder_atomic_check(struct drm_encoder *encoder, · line 536

Quoted 8 lines
drivers/gpu/drm/rockchip/inno_hdmi.c +1 -1
@@ -530,7 +530,7 @@ inno_hdmi_encoder_atomic_check(struct drm_encoder *encoder,
  	return 0;
  }
 
-static struct drm_encoder_helper_funcs inno_hdmi_encoder_helper_funcs = {
+static const struct drm_encoder_helper_funcs inno_hdmi_encoder_helper_funcs = {
  	.enable     = inno_hdmi_encoder_enable,
  	.disable    = inno_hdmi_encoder_disable,
  	.mode_fixup = inno_hdmi_encoder_mode_fixup,

Thanks

Signature · 1 line
?ark Yao
#3 lore raw

Re: [PATCH 1/2] drm/rockchip: add const to drm_encoder_helper_funcs structures

Quoted 26 lines · Mark yao
Quoted 25 lines · Bhumika Goyal

Add const to drm_encoder_helper_funcs structures as they are only passed as an argument to the function drm_encoder_helper_add and this argument is of type const. So, add const to these structures. Also, fix line over 80 characters warning while adding const.

---
  drivers/gpu/drm/rockchip/analogix_dp-rockchip.c | 3 ++-
  drivers/gpu/drm/rockchip/inno_hdmi.c            | 2 +-
  2 files changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +2 -0
index 9606121..96c6c10 100644
@@ -252,7 +252,8 @@ rockchip_dp_drm_encoder_atomic_check(struct
 drm_encoder *encoder,
        return 0;
  }
  -static struct drm_encoder_helper_funcs rockchip_dp_encoder_helper_funcs
 = {
+static
+const struct drm_encoder_helper_funcs rockchip_dp_encoder_helper_funcs =
Quoted 9 lines

drivers/gpu/drm/rockchip/analogix_dp-rockchip.c rockchip_dp_drm_encoder_atomic_check(struct · line 259

Quoted 1 line
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +0 -0
 {

I don't think split static and const into two line is a good idea, it's ugly. I'm ok over 80 characters with good-looking.
Or split like following:
static const struct drm_encoder_helper_funcs rockchip_dp_encoder_helper_funcs = {

Okay, so I will let the line exceed over 80 characters and send a v2.

Thanks,
Bhumika

Quoted 27 lines
Quoted 9 lines
drivers/gpu/drm/rockchip/analogix_dp-rockchip.c +0 -0
        .mode_fixup = rockchip_dp_drm_encoder_mode_fixup,
        .mode_set = rockchip_dp_drm_encoder_mode_set,
        .enable = rockchip_dp_drm_encoder_enable,
drivers/gpu/drm/rockchip/inno_hdmi.c +0 -0
index 7d9b75e..4ab9fad 100644

drivers/gpu/drm/rockchip/inno_hdmi.c inno_hdmi_encoder_atomic_check(struct drm_encoder · line 536

Quoted 10 lines
drivers/gpu/drm/rockchip/inno_hdmi.c +1 -0
@@ -530,7 +530,7 @@ inno_hdmi_encoder_atomic_check(struct drm_encoder
 *encoder,
        return 0;
  }
  -static struct drm_encoder_helper_funcs inno_hdmi_encoder_helper_funcs =
 {
+static const struct drm_encoder_helper_funcs
 inno_hdmi_encoder_helper_funcs = {
        .enable     = inno_hdmi_encoder_enable,
        .disable    = inno_hdmi_encoder_disable,
        .mode_fixup = inno_hdmi_encoder_mode_fixup,

Thanks

--
Mark Yao