Skip to content

Commit a6c3c37

Browse files
YuKuai-huaweialexdeucher
authored andcommitted
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: Yu Kuai <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 06888d5 commit a6c3c37

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10055,11 +10055,11 @@ static int validate_overlay(struct drm_atomic_state *state)
1005510055
{
1005610056
int i;
1005710057
struct drm_plane *plane;
10058-
struct drm_plane_state *old_plane_state, *new_plane_state;
10058+
struct drm_plane_state *new_plane_state;
1005910059
struct drm_plane_state *primary_state, *cursor_state, *overlay_state = NULL;
1006010060

1006110061
/* Check if primary plane is contained inside overlay */
10062-
for_each_oldnew_plane_in_state_reverse(state, plane, old_plane_state, new_plane_state, i) {
10062+
for_each_new_plane_in_state_reverse(state, plane, new_plane_state, i) {
1006310063
if (plane->type == DRM_PLANE_TYPE_OVERLAY) {
1006410064
if (drm_atomic_plane_disabling(plane->state, new_plane_state))
1006510065
return 0;

include/drm/drm_atomic.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -895,6 +895,18 @@ void drm_state_dump(struct drm_device *dev, struct drm_printer *p);
895895
(old_plane_state) = (__state)->planes[__i].old_state,\
896896
(new_plane_state) = (__state)->planes[__i].new_state, 1))
897897

898+
/**
899+
* for_each_new_plane_in_state_reverse - other than only tracking new state,
900+
* it's the same as for_each_oldnew_plane_in_state_reverse
901+
*/
902+
#define for_each_new_plane_in_state_reverse(__state, plane, new_plane_state, __i) \
903+
for ((__i) = ((__state)->dev->mode_config.num_total_plane - 1); \
904+
(__i) >= 0; \
905+
(__i)--) \
906+
for_each_if ((__state)->planes[__i].ptr && \
907+
((plane) = (__state)->planes[__i].ptr, \
908+
(new_plane_state) = (__state)->planes[__i].new_state, 1))
909+
898910
/**
899911
* for_each_old_plane_in_state - iterate over all planes in an atomic update
900912
* @__state: &struct drm_atomic_state pointer

0 commit comments

Comments
 (0)