Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

+8 -10
+1 -1
drivers/gpu/drm/drm_simple_kms_helper.c
··· 97 97 if (has_primary != crtc_state->enable) 98 98 return -EINVAL; 99 99 100 - return drm_atomic_add_affected_planes(crtc_state->state, crtc); 100 + return drm_atomic_add_affected_planes(state, crtc); 101 101 } 102 102 103 103 static void drm_simple_kms_crtc_enable(struct drm_crtc *crtc,
+1 -1
drivers/gpu/drm/mxsfb/mxsfb_kms.c
··· 281 281 return -EINVAL; 282 282 283 283 /* TODO: Is this needed ? */ 284 - return drm_atomic_add_affected_planes(crtc_state->state, crtc); 284 + return drm_atomic_add_affected_planes(state, crtc); 285 285 } 286 286 287 287 static void mxsfb_crtc_atomic_flush(struct drm_crtc *crtc,
+1 -1
drivers/gpu/drm/omapdrm/omap_crtc.c
··· 583 583 return -EINVAL; 584 584 } 585 585 586 - pri_state = drm_atomic_get_new_plane_state(crtc_state->state, 586 + pri_state = drm_atomic_get_new_plane_state(state, 587 587 crtc->primary); 588 588 if (pri_state) { 589 589 struct omap_crtc_state *omap_crtc_state =
+3 -3
drivers/gpu/drm/tilcdc/tilcdc_crtc.c
··· 665 665 if (!crtc_state->active) 666 666 return 0; 667 667 668 - if (crtc_state->state->planes[0].ptr != crtc->primary || 669 - crtc_state->state->planes[0].state == NULL || 670 - crtc_state->state->planes[0].state->crtc != crtc) { 668 + if (state->planes[0].ptr != crtc->primary || 669 + state->planes[0].state == NULL || 670 + state->planes[0].state->crtc != crtc) { 671 671 dev_dbg(crtc->dev->dev, "CRTC primary plane must be present"); 672 672 return -EINVAL; 673 673 }
+1 -1
drivers/gpu/drm/vc4/vc4_crtc.c
··· 597 597 if (ret) 598 598 return ret; 599 599 600 - for_each_new_connector_in_state(crtc_state->state, conn, conn_state, 600 + for_each_new_connector_in_state(state, conn, conn_state, 601 601 i) { 602 602 if (conn_state->crtc != crtc) 603 603 continue;
+1 -3
drivers/gpu/drm/xlnx/zynqmp_disp.c
··· 1506 1506 static int zynqmp_disp_crtc_atomic_check(struct drm_crtc *crtc, 1507 1507 struct drm_atomic_state *state) 1508 1508 { 1509 - struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, 1510 - crtc); 1511 - return drm_atomic_add_affected_planes(crtc_state->state, crtc); 1509 + return drm_atomic_add_affected_planes(state, crtc); 1512 1510 } 1513 1511 1514 1512 static void