On 22/10/26 09:31, Maxime Ripard wrote:
Recent commits renamed other reset helpers to use the state_init
suffix when they only initialize properties rather than allocate or
update the object state itself.

drm_atomic_helper_connector_tv_reset() falls in the same category:
it initializes the analog TV properties from the kernel command line
defaults without allocating any state. It also reads the connector
state through connector->state, coupling it to the reset path.

Rename it to drm_atomic_helper_connector_tv_state_init() and pass
the connector state explicitly as a parameter. This decouples it
from the reset hook and prepares for the conversion to
atomic_create_state where connector->state is not yet assigned.

Signed-off-by: Maxime Ripard <[email protected]>

Reviewed-by: Maíra Canal <[email protected]>

Best regards,
- Maíra
---
Cc: "Maíra Canal" <[email protected]>
Cc: Chen-Yu Tsai <[email protected]>
Cc: Dave Stevenson <[email protected]>
Cc: Raspberry Pi Kernel Maintenance <[email protected]>
Cc: Samuel Holland <[email protected]>
Cc: [email protected]
---
  drivers/gpu/drm/drm_atomic_state_helper.c | 13 +++++++------
  drivers/gpu/drm/sun4i/sun4i_tv.c          |  2 +-
  drivers/gpu/drm/vc4/vc4_vec.c             |  2 +-
  include/drm/drm_atomic_state_helper.h     |  3 ++-
  4 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/drm_atomic_state_helper.c 
b/drivers/gpu/drm/drm_atomic_state_helper.c
index 565947c544fe..3534925636d5 100644
--- a/drivers/gpu/drm/drm_atomic_state_helper.c
+++ b/drivers/gpu/drm/drm_atomic_state_helper.c
@@ -502,14 +502,15 @@ 
EXPORT_SYMBOL(drm_atomic_helper_connector_tv_margins_state_init);
/**
- * drm_atomic_helper_connector_tv_reset - Resets Analog TV connector properties
+ * drm_atomic_helper_connector_tv_state_init - Initializes Analog TV connector 
properties
+ * @state: the DRM state object
   * @connector: DRM connector
   *
- * Resets the analog TV properties attached to a connector
+ * Initializes the analog TV properties attached to a connector
   */
-void drm_atomic_helper_connector_tv_reset(struct drm_connector *connector)
+void drm_atomic_helper_connector_tv_state_init(struct drm_connector_state 
*state,
+                                              struct drm_connector *connector)
  {
        struct drm_device *dev = connector->dev;
        struct drm_cmdline_mode *cmdline = &connector->cmdline_mode;
-       struct drm_connector_state *state = connector->state;
        struct drm_property *prop;
        uint64_t val;
@@ -572,7 +573,7 @@ void drm_atomic_helper_connector_tv_reset(struct 
drm_connector *connector)
                        state->tv.hue = val;
- drm_atomic_helper_connector_tv_margins_state_init(connector->state, connector);
+       drm_atomic_helper_connector_tv_margins_state_init(state, connector);
  }
-EXPORT_SYMBOL(drm_atomic_helper_connector_tv_reset);
+EXPORT_SYMBOL(drm_atomic_helper_connector_tv_state_init);
/**
diff --git a/drivers/gpu/drm/sun4i/sun4i_tv.c b/drivers/gpu/drm/sun4i/sun4i_tv.c
index ce22f1662c0c..ea86f8a6a35e 100644
--- a/drivers/gpu/drm/sun4i/sun4i_tv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_tv.c
@@ -409,5 +409,5 @@ static void sun4i_tv_connector_reset(struct drm_connector 
*connector)
  {
        drm_atomic_helper_connector_reset(connector);
-       drm_atomic_helper_connector_tv_reset(connector);
+       drm_atomic_helper_connector_tv_state_init(connector->state, connector);
  }
diff --git a/drivers/gpu/drm/vc4/vc4_vec.c b/drivers/gpu/drm/vc4/vc4_vec.c
index 215b5d3dc5c5..7ab77f97df31 100644
--- a/drivers/gpu/drm/vc4/vc4_vec.c
+++ b/drivers/gpu/drm/vc4/vc4_vec.c
@@ -381,5 +381,5 @@ static void vc4_vec_connector_reset(struct drm_connector 
*connector)
  {
        drm_atomic_helper_connector_reset(connector);
-       drm_atomic_helper_connector_tv_reset(connector);
+       drm_atomic_helper_connector_tv_state_init(connector->state, connector);
  }
diff --git a/include/drm/drm_atomic_state_helper.h b/include/drm/drm_atomic_state_helper.h
index 4dac741af22c..5e8619aeef21 100644
--- a/include/drm/drm_atomic_state_helper.h
+++ b/include/drm/drm_atomic_state_helper.h
@@ -72,5 +72,6 @@ void drm_atomic_helper_connector_reset(struct drm_connector 
*connector);
  struct drm_connector_state *
  drm_atomic_helper_connector_create_state(struct drm_connector *connector);
-void drm_atomic_helper_connector_tv_reset(struct drm_connector *connector);
+void drm_atomic_helper_connector_tv_state_init(struct drm_connector_state 
*state,
+                                              struct drm_connector *connector);
  int drm_atomic_helper_connector_tv_check(struct drm_connector *connector,
                                         struct drm_atomic_commit *state);


Reply via email to