From: Alex Deucher <alexdeucher@gmail.com>
To: Yu Kuai <yukuai3@huawei.com>
Cc: amd-gfx list <amd-gfx@lists.freedesktop.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
yi.zhang@huawei.com, "Leo \(Sunpeng\) Li" <sunpeng.li@amd.com>,
xinhui pan <Xinhui.Pan@amd.com>,
LKML <linux-kernel@vger.kernel.org>,
Dave Airlie <airlied@linux.ie>,
Maling list - DRI developers <dri-devel@lists.freedesktop.org>,
"Deucher, Alexander" <alexander.deucher@amd.com>,
Christian Koenig <christian.koenig@amd.com>
Subject: Re: [PATCH] drm/amd/display: fix gcc set but not used warning of variable 'old_plane_state'
Date: Tue, 1 Jun 2021 22:07:38 -0400 [thread overview]
Message-ID: <CADnq5_Na=AdNCoQpDPVJ=5078s8C7SNMBo295H-Jp1fQZWkmCw@mail.gmail.com> (raw)
In-Reply-To: <20210529092816.3133745-1-yukuai3@huawei.com>
Applied. Thanks!
Alex
On Sat, May 29, 2021 at 5:19 AM Yu Kuai <yukuai3@huawei.com> wrote:
>
> 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 <yukuai3@huawei.com>
> ---
> drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 4 ++--
> include/drm/drm_atomic.h | 12 ++++++++++++
> 2 files changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> index f7a5e5b48ea6..9f4b334bc071 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
> @@ -10063,11 +10063,11 @@ static int validate_overlay(struct drm_atomic_state *state)
> {
> int i;
> 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;
>
> /* 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 (drm_atomic_plane_disabling(plane->state, new_plane_state))
> return 0;
> diff --git a/include/drm/drm_atomic.h b/include/drm/drm_atomic.h
> index ac5a28eff2c8..8f1350e599eb 100644
> --- a/include/drm/drm_atomic.h
> +++ b/include/drm/drm_atomic.h
> @@ -895,6 +895,18 @@ void drm_state_dump(struct drm_device *dev, struct drm_printer *p);
> (old_plane_state) = (__state)->planes[__i].old_state,\
> (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
> * @__state: &struct drm_atomic_state pointer
> --
> 2.25.4
>
prev parent reply other threads:[~2021-06-02 2:07 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-29 9:28 [PATCH] drm/amd/display: fix gcc set but not used warning of variable 'old_plane_state' Yu Kuai
2021-06-02 2:07 ` Alex Deucher [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CADnq5_Na=AdNCoQpDPVJ=5078s8C7SNMBo295H-Jp1fQZWkmCw@mail.gmail.com' \
--to=alexdeucher@gmail.com \
--cc=Xinhui.Pan@amd.com \
--cc=airlied@linux.ie \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=christian.koenig@amd.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sunpeng.li@amd.com \
--cc=tzimmermann@suse.de \
--cc=yi.zhang@huawei.com \
--cc=yukuai3@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).