Skip to content

Commit 28e0223

Browse files
mripardpelwell
authored andcommitted
drm: Use the state pointer directly in atomic_check
Now that atomic_check takes the global atomic state as a parameter, we don't need to go through the pointer in the CRTC state. This was done using the following coccinelle script: @ crtc_atomic_func @ identifier helpers; identifier func; @@ static struct drm_crtc_helper_funcs helpers = { ..., .atomic_check = func, ..., }; @@ identifier crtc_atomic_func.func; identifier crtc, state; @@ func(struct drm_crtc *crtc, struct drm_atomic_state *state) { ... - struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, crtc); ... when != crtc_state - crtc_state->state + state ... } @@ struct drm_crtc_state *crtc_state; identifier crtc_atomic_func.func; identifier crtc, state; @@ func(struct drm_crtc *crtc, struct drm_atomic_state *state) { ... - crtc_state->state + state ... } Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Signed-off-by: Maxime Ripard <maxime@cerno.tech> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20201102133834.1176740-3-maxime@cerno.tech
1 parent b9f754b commit 28e0223

6 files changed

Lines changed: 8 additions & 10 deletions

File tree

‎drivers/gpu/drm/drm_simple_kms_helper.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ static int drm_simple_kms_crtc_check(struct drm_crtc *crtc,
9797
if (has_primary != crtc_state->enable)
9898
return -EINVAL;
9999

100-
return drm_atomic_add_affected_planes(crtc_state->state, crtc);
100+
return drm_atomic_add_affected_planes(state, crtc);
101101
}
102102

103103
static void drm_simple_kms_crtc_enable(struct drm_crtc *crtc,

‎drivers/gpu/drm/mxsfb/mxsfb_kms.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ static int mxsfb_crtc_atomic_check(struct drm_crtc *crtc,
282282
return -EINVAL;
283283

284284
/* TODO: Is this needed ? */
285-
return drm_atomic_add_affected_planes(crtc_state->state, crtc);
285+
return drm_atomic_add_affected_planes(state, crtc);
286286
}
287287

288288
static void mxsfb_crtc_atomic_flush(struct drm_crtc *crtc,

‎drivers/gpu/drm/omapdrm/omap_crtc.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@ static int omap_crtc_atomic_check(struct drm_crtc *crtc,
583583
return -EINVAL;
584584
}
585585

586-
pri_state = drm_atomic_get_new_plane_state(crtc_state->state,
586+
pri_state = drm_atomic_get_new_plane_state(state,
587587
crtc->primary);
588588
if (pri_state) {
589589
struct omap_crtc_state *omap_crtc_state =

‎drivers/gpu/drm/tilcdc/tilcdc_crtc.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -677,9 +677,9 @@ static int tilcdc_crtc_atomic_check(struct drm_crtc *crtc,
677677
if (!crtc_state->active)
678678
return 0;
679679

680-
if (crtc_state->state->planes[0].ptr != crtc->primary ||
681-
crtc_state->state->planes[0].state == NULL ||
682-
crtc_state->state->planes[0].state->crtc != crtc) {
680+
if (state->planes[0].ptr != crtc->primary ||
681+
state->planes[0].state == NULL ||
682+
state->planes[0].state->crtc != crtc) {
683683
dev_dbg(crtc->dev->dev, "CRTC primary plane must be present");
684684
return -EINVAL;
685685
}

‎drivers/gpu/drm/vc4/vc4_crtc.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -665,7 +665,7 @@ static int vc4_crtc_atomic_check(struct drm_crtc *crtc,
665665
}
666666
}
667667

668-
for_each_new_connector_in_state(crtc_state->state, conn, conn_state,
668+
for_each_new_connector_in_state(state, conn, conn_state,
669669
i) {
670670
if (conn_state->crtc != crtc)
671671
continue;

‎drivers/gpu/drm/xlnx/zynqmp_disp.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1507,9 +1507,7 @@ zynqmp_disp_crtc_atomic_disable(struct drm_crtc *crtc,
15071507
static int zynqmp_disp_crtc_atomic_check(struct drm_crtc *crtc,
15081508
struct drm_atomic_state *state)
15091509
{
1510-
struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state,
1511-
crtc);
1512-
return drm_atomic_add_affected_planes(crtc_state->state, crtc);
1510+
return drm_atomic_add_affected_planes(state, crtc);
15131511
}
15141512

15151513
static void

0 commit comments

Comments
 (0)