Commit a6c3c37b authored by Yu Kuai's avatar Yu Kuai Committed by Alex Deucher

drm/amd/display: fix gcc set but not used warning of variable 'old_plane_state'

define a new macro for_each_new_plane_in_state_reverse to replace
for_each_oldnew_plane_in_state_reverse, so that the unused variable
'old_plane_state' can be removed.

Fix gcc warning:
drivers/gpu/drm/amd/amdgpu/../display/amdgpu_dm/amdgpu_dm.c:10066:26: warning:
 variable ‘old_plane_state’ set but not used [-Wunused-but-set-variable]
Signed-off-by: default avatarYu Kuai <yukuai3@huawei.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 06888d57
...@@ -10055,11 +10055,11 @@ static int validate_overlay(struct drm_atomic_state *state) ...@@ -10055,11 +10055,11 @@ static int validate_overlay(struct drm_atomic_state *state)
{ {
int i; int i;
struct drm_plane *plane; struct drm_plane *plane;
struct drm_plane_state *old_plane_state, *new_plane_state; struct drm_plane_state *new_plane_state;
struct drm_plane_state *primary_state, *cursor_state, *overlay_state = NULL; struct drm_plane_state *primary_state, *cursor_state, *overlay_state = NULL;
/* Check if primary plane is contained inside overlay */ /* Check if primary plane is contained inside overlay */
for_each_oldnew_plane_in_state_reverse(state, plane, old_plane_state, new_plane_state, i) { for_each_new_plane_in_state_reverse(state, plane, new_plane_state, i) {
if (plane->type == DRM_PLANE_TYPE_OVERLAY) { if (plane->type == DRM_PLANE_TYPE_OVERLAY) {
if (drm_atomic_plane_disabling(plane->state, new_plane_state)) if (drm_atomic_plane_disabling(plane->state, new_plane_state))
return 0; return 0;
......
...@@ -895,6 +895,18 @@ void drm_state_dump(struct drm_device *dev, struct drm_printer *p); ...@@ -895,6 +895,18 @@ void drm_state_dump(struct drm_device *dev, struct drm_printer *p);
(old_plane_state) = (__state)->planes[__i].old_state,\ (old_plane_state) = (__state)->planes[__i].old_state,\
(new_plane_state) = (__state)->planes[__i].new_state, 1)) (new_plane_state) = (__state)->planes[__i].new_state, 1))
/**
* for_each_new_plane_in_state_reverse - other than only tracking new state,
* it's the same as for_each_oldnew_plane_in_state_reverse
*/
#define for_each_new_plane_in_state_reverse(__state, plane, new_plane_state, __i) \
for ((__i) = ((__state)->dev->mode_config.num_total_plane - 1); \
(__i) >= 0; \
(__i)--) \
for_each_if ((__state)->planes[__i].ptr && \
((plane) = (__state)->planes[__i].ptr, \
(new_plane_state) = (__state)->planes[__i].new_state, 1))
/** /**
* for_each_old_plane_in_state - iterate over all planes in an atomic update * for_each_old_plane_in_state - iterate over all planes in an atomic update
* @__state: &struct drm_atomic_state pointer * @__state: &struct drm_atomic_state pointer
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment