Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp294556pxj; Tue, 1 Jun 2021 22:33:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy+EtA8BmRIhRJ6M6TomPBhTxuY5YgR/5VWfpDqRZp6oeY7gktlWOAVxvfFb56ykFB91i3W X-Received: by 2002:a17:906:7203:: with SMTP id m3mr31923193ejk.381.1622611981555; Tue, 01 Jun 2021 22:33:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622611981; cv=none; d=google.com; s=arc-20160816; b=Byjf4284W+wsoQOgvtL5zd/KN7rZOmPel7E6/pAUCntWztlZkXr9YxWH+AlAXciIqw cTJzPQTiKQdTML2upKRqxSKU981kZNocDt8Azn4l8jhoSyk68avQb63qr09wiAvai0Dz V8tJR1DbodCh+SiYcbWpzjTUn/537gnDWpTnInGyOc2F3I2CVnhL1AkpIWCqIUdFQXtg i7SyBTfVm7Rzrd+hr+3vF6FpgeRukCx/gT8Y5ZDjsrqqFryp4CgaMwrpQICLNO+xn1Pq 2a0KvKrV3br4mvXlPSxn/dS0yGWO9zM6w7bOhvFR4dD2n9ujcOAIzcd4lH+ZSZeINCPg opoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=pU1TRPFdg/mvMNMBTDRgncKjTs5cmC/VyWt+TILhNqg=; b=SI5+KS3lzTHBc6i3eGxGd69fqMcjQH2+FpKQcv0jQttrsyPcwkp9LrPaugABteN10Z uFV5w6tJkpCcckBftPUlLMD/t3AUbZQDAfQKR03QW4DFGmD4uqA9FFc1Sn053OCxOHMd h3kylsttJQioweoFbWZNk3LRB4mB/wre/NieGet81j27Twijb8C94i+pBgzexdMWvJPL 7ZoR2C4PhDZWHNlS+mI7I4+6xayxqztVcwR8DDBtjgfjT552X21VImEOfJDcKkxP48vk blTyukepe0u1skf8PgIv+FWU2e0M6WfmbFdFZ5mWyscJ7kKJJOBU5Adtl7eeZ4P1xOSe PB+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=leBsDCLV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y10si319322ejk.718.2021.06.01.22.32.38; Tue, 01 Jun 2021 22:33:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=leBsDCLV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229830AbhFBCJd (ORCPT + 99 others); Tue, 1 Jun 2021 22:09:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41100 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229654AbhFBCJd (ORCPT ); Tue, 1 Jun 2021 22:09:33 -0400 Received: from mail-ot1-x32d.google.com (mail-ot1-x32d.google.com [IPv6:2607:f8b0:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7B0D5C061574 for ; Tue, 1 Jun 2021 19:07:50 -0700 (PDT) Received: by mail-ot1-x32d.google.com with SMTP id 69-20020a9d0a4b0000b02902ed42f141e1so1165905otg.2 for ; Tue, 01 Jun 2021 19:07:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=pU1TRPFdg/mvMNMBTDRgncKjTs5cmC/VyWt+TILhNqg=; b=leBsDCLV2SQ+QW8NeJ78bjOGFhHQDUCW/Evqpq2ZLpXULUTD/gYVSWB0dKF+OZ2v8/ C7XYgo/lznFWK0glQZ5BhIsDN4m+9THwBBrByZI1kPwsRbO+4oDbSI3miRWMTMXEL+TJ 1bdst67rVthfP5BTO5o7lI3krd9Eb7oCk4+SErPCDN/Egx3dajMebOIS64mmZR9VKZAA OixVbaRn4O994jn/KWkrQaEWsVAZ7QoxOgZvu9FzCcPJf+N7wHU74hl8nazHzgKTthi+ 5Wtb2q8dVFp8ElfhO3dwBkVDj8xJxy5wa6AceM5RNEykul5QZjSehyXxn02IrOPIi55P FBbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=pU1TRPFdg/mvMNMBTDRgncKjTs5cmC/VyWt+TILhNqg=; b=hpDU+Dt0NvdzfTpd2uGlRUNKsy7KdaRGEEzfSY6+myWObJO0bKdtQ32mVR7lBruo6K kSDUg5/H+DbWlpnpRpF2UFxpRQU1CzbLC8+FKCB2LFqcRYLJtQiemvbcWfWMRtWJW3a7 T0te3D1Keu2yqbilELx1gYk0kV0iOIJef2rgsMyNB1JJUTRmeaz9Hnz67CvcvwC9udlA hsC4ivh/xwBpw9itJzjs0FZj5rmEtTK0gXbS1q7HkwZ95FJuY02psGiIVNsbOR+4pQiZ KSLbjlofu77V55YcTWqcKtwEjdgOZZCuKteo86s5N1jTYsPklPpu1psPoZvqqPdVMct/ KsAA== X-Gm-Message-State: AOAM531aNf+/C6/snvF1bQJAPDQUkP348ytiCWxs+bTDnjkIBVqHPH1y oAvi+nBbE1Az9RHp/Lz4RU52z122bkJo+o5fIYI= X-Received: by 2002:a9d:6548:: with SMTP id q8mr24108150otl.311.1622599669886; Tue, 01 Jun 2021 19:07:49 -0700 (PDT) MIME-Version: 1.0 References: <20210529092816.3133745-1-yukuai3@huawei.com> In-Reply-To: <20210529092816.3133745-1-yukuai3@huawei.com> From: Alex Deucher Date: Tue, 1 Jun 2021 22:07:38 -0400 Message-ID: Subject: Re: [PATCH] drm/amd/display: fix gcc set but not used warning of variable 'old_plane_state' To: Yu Kuai Cc: "Wentland, Harry" , "Leo (Sunpeng) Li" , "Deucher, Alexander" , Christian Koenig , xinhui pan , Dave Airlie , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , yi.zhang@huawei.com, Maling list - DRI developers , amd-gfx list , LKML Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Applied. Thanks! Alex On Sat, May 29, 2021 at 5:19 AM Yu Kuai 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: war= ning: > variable =E2=80=98old_plane_state=E2=80=99 set but not used [-Wunused-bu= t-set-variable] > > Signed-off-by: Yu Kuai > --- > 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_s= tate *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_st= ate =3D NULL; > > /* Check if primary plane is contained inside overlay */ > - for_each_oldnew_plane_in_state_reverse(state, plane, old_plane_st= ate, new_plane_state, i) { > + for_each_new_plane_in_state_reverse(state, plane, new_plane_state= , i) { > if (plane->type =3D=3D 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 d= rm_printer *p); > (old_plane_state) =3D (__state)->planes[__i= ].old_state,\ > (new_plane_state) =3D (__state)->planes[__i= ].new_state, 1)) > > +/** > + * for_each_new_plane_in_state_reverse - other than only tracking new st= ate, > + * it's the same as for_each_oldnew_plane_in_state_reverse > + */ > +#define for_each_new_plane_in_state_reverse(__state, plane, new_plane_st= ate, __i) \ > + for ((__i) =3D ((__state)->dev->mode_config.num_total_plane - 1);= \ > + (__i) >=3D 0; = \ > + (__i)--) \ > + for_each_if ((__state)->planes[__i].ptr && \ > + ((plane) =3D (__state)->planes[__i].ptr, = \ > + (new_plane_state) =3D (__state)->planes[__i= ].new_state, 1)) > + > /** > * for_each_old_plane_in_state - iterate over all planes in an atomic up= date > * @__state: &struct drm_atomic_state pointer > -- > 2.25.4 >