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_margins_reset() falls in the same category: it initializes the TV margin properties from the kernel command line 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_margins_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. Reviewed-by: Maíra Canal <[email protected]> Reviewed-by: Thomas Zimmermann <[email protected]> Signed-off-by: Maxime Ripard <[email protected]> --- Cc: "Maíra Canal" <[email protected]> Cc: Dave Stevenson <[email protected]> Cc: Raspberry Pi Kernel Maintenance <[email protected]> Cc: Ruben Wauters <[email protected]> --- drivers/gpu/drm/drm_atomic_state_helper.c | 13 +++++++------ drivers/gpu/drm/gud/gud_connector.c | 3 ++- drivers/gpu/drm/vc4/vc4_hdmi.c | 3 ++- include/drm/drm_atomic_state_helper.h | 3 ++- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_state_helper.c b/drivers/gpu/drm/drm_atomic_state_helper.c index 406157a3660f..565947c544fe 100644 --- a/drivers/gpu/drm/drm_atomic_state_helper.c +++ b/drivers/gpu/drm/drm_atomic_state_helper.c @@ -483,13 +483,14 @@ EXPORT_SYMBOL(drm_atomic_helper_connector_create_state); /** - * drm_atomic_helper_connector_tv_margins_reset - Resets TV connector properties + * drm_atomic_helper_connector_tv_margins_state_init - Initializes TV connector properties + * @state: the DRM state object * @connector: DRM connector * - * Resets the TV-related properties attached to a connector. + * Initializes the TV-related properties attached to a connector. */ -void drm_atomic_helper_connector_tv_margins_reset(struct drm_connector *connector) +void drm_atomic_helper_connector_tv_margins_state_init(struct drm_connector_state *state, + struct drm_connector *connector) { struct drm_cmdline_mode *cmdline = &connector->cmdline_mode; - struct drm_connector_state *state = connector->state; state->tv.margins.left = cmdline->tv_margins.left; @@ -498,5 +499,5 @@ void drm_atomic_helper_connector_tv_margins_reset(struct drm_connector *connecto state->tv.margins.bottom = cmdline->tv_margins.bottom; } -EXPORT_SYMBOL(drm_atomic_helper_connector_tv_margins_reset); +EXPORT_SYMBOL(drm_atomic_helper_connector_tv_margins_state_init); /** @@ -571,5 +572,5 @@ void drm_atomic_helper_connector_tv_reset(struct drm_connector *connector) state->tv.hue = val; - drm_atomic_helper_connector_tv_margins_reset(connector); + drm_atomic_helper_connector_tv_margins_state_init(connector->state, connector); } EXPORT_SYMBOL(drm_atomic_helper_connector_tv_reset); diff --git a/drivers/gpu/drm/gud/gud_connector.c b/drivers/gpu/drm/gud/gud_connector.c index 8141c3a1e30a..a57f2565d33e 100644 --- a/drivers/gpu/drm/gud/gud_connector.c +++ b/drivers/gpu/drm/gud/gud_connector.c @@ -355,5 +355,6 @@ static void gud_connector_reset(struct drm_connector *connector) connector->state->tv = gconn->initial_tv_state; /* Set margins from command line */ - drm_atomic_helper_connector_tv_margins_reset(connector); + drm_atomic_helper_connector_tv_margins_state_init(connector->state, + connector); if (gconn->initial_brightness >= 0) connector->state->tv.brightness = gconn->initial_brightness; diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index 31942638fcd8..e14cbe4b5f15 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -509,5 +509,6 @@ static void vc4_hdmi_connector_reset(struct drm_connector *connector) drm_atomic_helper_connector_reset(connector); __drm_atomic_helper_connector_hdmi_state_init(connector->state, connector); - drm_atomic_helper_connector_tv_margins_reset(connector); + drm_atomic_helper_connector_tv_margins_state_init(connector->state, + connector); } diff --git a/include/drm/drm_atomic_state_helper.h b/include/drm/drm_atomic_state_helper.h index 4706eeab52c1..4dac741af22c 100644 --- a/include/drm/drm_atomic_state_helper.h +++ b/include/drm/drm_atomic_state_helper.h @@ -75,5 +75,6 @@ void drm_atomic_helper_connector_tv_reset(struct drm_connector *connector); int drm_atomic_helper_connector_tv_check(struct drm_connector *connector, struct drm_atomic_commit *state); -void drm_atomic_helper_connector_tv_margins_reset(struct drm_connector *connector); +void drm_atomic_helper_connector_tv_margins_state_init(struct drm_connector_state *state, + struct drm_connector *connector); void __drm_atomic_helper_connector_duplicate_state(struct drm_connector *connector, -- 2.55.0
