Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp5440772ybp; Tue, 8 Oct 2019 02:57:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqwMb8pR5blZTrAre4Ifyc6glZsNZuK0gWXGkUcFWL8QTqu0NmlPgwtKDcpITOrSMmkhQgPf X-Received: by 2002:a50:f0dd:: with SMTP id a29mr33136068edm.219.1570528622327; Tue, 08 Oct 2019 02:57:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570528622; cv=none; d=google.com; s=arc-20160816; b=Y9w4NdOcFfwjo1Fodts2JLYIuWQ0xBmr/XhihnH0GOqX+IM4/qqVcVwb3cIRqGX+Zx ZDao2mrr62vxR3/e989diIb64lWklQ+hKG+hpnzUPp4jwTiaW4JFPcuy3GtgKmWyiImE lTIk/xeBek7TL4ca1yi7siDOXuahpRca3jJ8mfDgswjy4ZX1vfI1lH53xOPn9PMEyfZg fXfQCyRSn+1K0LOZZzKLlMGtjqhX6znESNd1Rr9dWgN/Rkx0kSsqRVLreMH7Asv8R+Mx PDx7x4WlQNeHr+ael1Oxl5XCmgSR6fXmYN79cpxiKZwLrXBvzFl4JVOrVzNCrZKDTe6S Mfjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:mail-followup-to:message-id:subject:cc:to:from:date :dkim-signature; bh=glqoLLXRKhPZK2QNujLh3Eeqj01ONLHAWWq9xjc6ZXU=; b=r/+6u1SEWbX06MHIRMrExJV78ekkUYtEM2JCAu2NRH3rJLgIhwM4vgrTyuj5BhSGKW C31riMHB9uzGl8VMRFtxVvQAQ/rtRGZuCmDEvT/DjrQUmSXOvpSDDbncl05BMq+L3Su/ auk4Czf2j51kkW5HIN4umuEQUC9l0+HbAh8Zgx1hjP23XfLgzvLf4kbtqGTOAjElBChy aJH93/NnLvhE7b6MH1D4xW1ja2FgVRg4cApNCUZtyoybOZspqR0fpqn5l/F/Yrt+0c+P 2Fbgs7b/iyN7h3bTpWdUmavaze6Asod5Sg/KWr8UHrPiLWt9tQMxKPHaXJqsHef0unr3 8XMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@ffwll.ch header.s=google header.b=fgrfOdMm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y6si8458759ejj.113.2019.10.08.02.56.39; Tue, 08 Oct 2019 02:57:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@ffwll.ch header.s=google header.b=fgrfOdMm; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730278AbfJHJ4B (ORCPT + 99 others); Tue, 8 Oct 2019 05:56:01 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:36105 "EHLO mail-ed1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730177AbfJHJ4A (ORCPT ); Tue, 8 Oct 2019 05:56:00 -0400 Received: by mail-ed1-f68.google.com with SMTP id h2so15081401edn.3 for ; Tue, 08 Oct 2019 02:55:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ffwll.ch; s=google; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=glqoLLXRKhPZK2QNujLh3Eeqj01ONLHAWWq9xjc6ZXU=; b=fgrfOdMmS/aA3AyBG71zocxJJBLuxbcU15pBaS4rfJHfeqJZUhgTLTIf+zmrYyKH61 yRb8+de3BSxzoAS7jSBvYgCYqwuZxWehOPiam4BFyopIHzCHvEbTYudahMyH/JLwdcbh oj5WxPoTXh5Kn0PWmQmwysADXMjbOd2fcqSv8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=glqoLLXRKhPZK2QNujLh3Eeqj01ONLHAWWq9xjc6ZXU=; b=WuYHJnOopGO9nSRkLQ0WTgMZeDhTO9435nUF/ziFdkx0lKF5CPVhlCLti4d+rReieM aC2dhivKcEVfavx15O58jvqav8uX0S+AU5ZlRSXlXxzHiXmzUyfL/ZrzGCEDaNiNj6Ds 5kKV6vJsLuoIR9Cm2n2hXzb0xvkjwVt/7NFznVJG4+HV89TwVtER4hRH4zcQltPuhpye G8ZXKBhxQZBYGUEqIqY3RtaaFYbVsG3AtSIeP2hzhRDvxDcfNomQKcJ/riXwWAIaeOX2 h0IP9ryd2LoGHIX7aLTsnP3X5HgujN+rCr3sMKSzpKLKZ0Ud/3RhATb33fF2Nfj7+jUc Ydcg== X-Gm-Message-State: APjAAAVDYDqmMDsXlMq3sh7562ig3/6ZPSLj1yFxa+Qu2JmlnkyY0N9x mK4D5CsBR62rRv28acIQOveCYQ== X-Received: by 2002:a17:906:8c8:: with SMTP id o8mr28256623eje.56.1570528558229; Tue, 08 Oct 2019 02:55:58 -0700 (PDT) Received: from phenom.ffwll.local (212-51-149-96.fiber7.init7.net. [212.51.149.96]) by smtp.gmail.com with ESMTPSA id g19sm2217121eje.0.2019.10.08.02.55.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Oct 2019 02:55:57 -0700 (PDT) Date: Tue, 8 Oct 2019 11:55:55 +0200 From: Daniel Vetter To: Benjamin Gaignard Cc: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= , Benjamin Gaignard , David Airlie , Daniel Vetter , Linux Kernel Mailing List , ML dri-devel Subject: Re: [PATCH] drm: atomic helper: fix W=1 warnings Message-ID: <20191008095555.GK16989@phenom.ffwll.local> Mail-Followup-To: Benjamin Gaignard , Ville =?iso-8859-1?Q?Syrj=E4l=E4?= , Benjamin Gaignard , David Airlie , Linux Kernel Mailing List , ML dri-devel References: <20190909135205.10277-1-benjamin.gaignard@st.com> <20190909135205.10277-2-benjamin.gaignard@st.com> <20191003142738.GM1208@intel.com> <20191003150526.GN1208@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Operating-System: Linux phenom 5.2.0-2-amd64 User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 03, 2019 at 05:37:15PM +0200, Benjamin Gaignard wrote: > Le jeu. 3 oct. 2019 ? 17:05, Ville Syrj?l? > a ?crit : > > > > On Thu, Oct 03, 2019 at 04:46:54PM +0200, Benjamin Gaignard wrote: > > > Le jeu. 3 oct. 2019 ? 16:27, Ville Syrj?l? > > > a ?crit : > > > > > > > > On Mon, Sep 09, 2019 at 03:52:05PM +0200, Benjamin Gaignard wrote: > > > > > Fix warnings with W=1. > > > > > Few for_each macro set variables that are never used later. > > > > > Prevent warning by marking these variables as __maybe_unused. > > > > > > > > > > Signed-off-by: Benjamin Gaignard > > > > > --- > > > > > drivers/gpu/drm/drm_atomic_helper.c | 36 ++++++++++++++++++------------------ > > > > > 1 file changed, 18 insertions(+), 18 deletions(-) > > > > > > > > > > diff --git a/drivers/gpu/drm/drm_atomic_helper.c b/drivers/gpu/drm/drm_atomic_helper.c > > > > > index aa16ea17ff9b..b69d17b0b9bd 100644 > > > > > --- a/drivers/gpu/drm/drm_atomic_helper.c > > > > > +++ b/drivers/gpu/drm/drm_atomic_helper.c > > > > > @@ -262,7 +262,7 @@ steal_encoder(struct drm_atomic_state *state, > > > > > struct drm_encoder *encoder) > > > > > { > > > > > struct drm_crtc_state *crtc_state; > > > > > - struct drm_connector *connector; > > > > > + struct drm_connector __maybe_unused *connector; > > > > > > > > Rather ugly. IMO would be nicer if we could hide something inside > > > > the iterator macros to suppress the warning. > > > > > > Ok but how ? > > > connector is assigned in the macros but not used later and we can't > > > set "__maybe_unused" > > > in the macro. > > > Does another keyword exist for that ? > > > > Stick a (void)(connector) into the macro? > > That could work but it will look strange inside the macro. If this works I think it's fine, maybe together with a FIXME or so ... At least as an interim solution. Much better than sprinkling all the maybe_unused annotations around like in this patch. -Daniel > > > > > Another (arguably cleaner) idea would be to remove the connector/crtc/plane > > argument from the iterators entirely since it's redundant, and instead just > > extract it from the appropriate new/old state as needed. > > > > We could then also add a for_each_connector_in_state()/etc. which omit > > s the state arguments and just has the connector argument, for cases where > > you don't care about the states when iterating. > > That may lead to get a macro for each possible combination of used variables. > > > > > > > > > > > > > > > struct drm_connector_state *old_connector_state, *new_connector_state; > > > > > int i; > > > > > > > > > > @@ -412,7 +412,7 @@ mode_fixup(struct drm_atomic_state *state) > > > > > { > > > > > struct drm_crtc *crtc; > > > > > struct drm_crtc_state *new_crtc_state; > > > > > - struct drm_connector *connector; > > > > > + struct drm_connector __maybe_unused *connector; > > > > > struct drm_connector_state *new_conn_state; > > > > > int i; > > > > > int ret; > > > > > @@ -608,7 +608,7 @@ drm_atomic_helper_check_modeset(struct drm_device *dev, > > > > > { > > > > > struct drm_crtc *crtc; > > > > > struct drm_crtc_state *old_crtc_state, *new_crtc_state; > > > > > - struct drm_connector *connector; > > > > > + struct drm_connector __maybe_unused *connector; > > > > > struct drm_connector_state *old_connector_state, *new_connector_state; > > > > > int i, ret; > > > > > unsigned connectors_mask = 0; > > > > > @@ -984,7 +984,7 @@ crtc_needs_disable(struct drm_crtc_state *old_state, > > > > > static void > > > > > disable_outputs(struct drm_device *dev, struct drm_atomic_state *old_state) > > > > > { > > > > > - struct drm_connector *connector; > > > > > + struct drm_connector __maybe_unused *connector; > > > > > struct drm_connector_state *old_conn_state, *new_conn_state; > > > > > struct drm_crtc *crtc; > > > > > struct drm_crtc_state *old_crtc_state, *new_crtc_state; > > > > > @@ -1173,7 +1173,7 @@ crtc_set_mode(struct drm_device *dev, struct drm_atomic_state *old_state) > > > > > { > > > > > struct drm_crtc *crtc; > > > > > struct drm_crtc_state *new_crtc_state; > > > > > - struct drm_connector *connector; > > > > > + struct drm_connector __maybe_unused *connector; > > > > > struct drm_connector_state *new_conn_state; > > > > > int i; > > > > > > > > > > @@ -1294,7 +1294,7 @@ void drm_atomic_helper_commit_modeset_enables(struct drm_device *dev, > > > > > struct drm_crtc *crtc; > > > > > struct drm_crtc_state *old_crtc_state; > > > > > struct drm_crtc_state *new_crtc_state; > > > > > - struct drm_connector *connector; > > > > > + struct drm_connector __maybe_unused *connector; > > > > > struct drm_connector_state *new_conn_state; > > > > > int i; > > > > > > > > > > @@ -1384,7 +1384,7 @@ int drm_atomic_helper_wait_for_fences(struct drm_device *dev, > > > > > struct drm_atomic_state *state, > > > > > bool pre_swap) > > > > > { > > > > > - struct drm_plane *plane; > > > > > + struct drm_plane __maybe_unused *plane; > > > > > struct drm_plane_state *new_plane_state; > > > > > int i, ret; > > > > > > > > > > @@ -1431,7 +1431,7 @@ drm_atomic_helper_wait_for_vblanks(struct drm_device *dev, > > > > > struct drm_atomic_state *old_state) > > > > > { > > > > > struct drm_crtc *crtc; > > > > > - struct drm_crtc_state *old_crtc_state, *new_crtc_state; > > > > > + struct drm_crtc_state __maybe_unused *old_crtc_state, *new_crtc_state; > > > > > int i, ret; > > > > > unsigned crtc_mask = 0; > > > > > > > > > > @@ -1621,7 +1621,7 @@ static void commit_work(struct work_struct *work) > > > > > int drm_atomic_helper_async_check(struct drm_device *dev, > > > > > struct drm_atomic_state *state) > > > > > { > > > > > - struct drm_crtc *crtc; > > > > > + struct drm_crtc __maybe_unused *crtc; > > > > > struct drm_crtc_state *crtc_state; > > > > > struct drm_plane *plane = NULL; > > > > > struct drm_plane_state *old_plane_state = NULL; > > > > > @@ -1982,9 +1982,9 @@ int drm_atomic_helper_setup_commit(struct drm_atomic_state *state, > > > > > { > > > > > struct drm_crtc *crtc; > > > > > struct drm_crtc_state *old_crtc_state, *new_crtc_state; > > > > > - struct drm_connector *conn; > > > > > + struct drm_connector __maybe_unused *conn; > > > > > struct drm_connector_state *old_conn_state, *new_conn_state; > > > > > - struct drm_plane *plane; > > > > > + struct drm_plane __maybe_unused *plane; > > > > > struct drm_plane_state *old_plane_state, *new_plane_state; > > > > > struct drm_crtc_commit *commit; > > > > > int i, ret; > > > > > @@ -2214,7 +2214,7 @@ EXPORT_SYMBOL(drm_atomic_helper_fake_vblank); > > > > > */ > > > > > void drm_atomic_helper_commit_hw_done(struct drm_atomic_state *old_state) > > > > > { > > > > > - struct drm_crtc *crtc; > > > > > + struct drm_crtc __maybe_unused *crtc; > > > > > struct drm_crtc_state *old_crtc_state, *new_crtc_state; > > > > > struct drm_crtc_commit *commit; > > > > > int i; > > > > > @@ -2300,7 +2300,7 @@ EXPORT_SYMBOL(drm_atomic_helper_commit_cleanup_done); > > > > > int drm_atomic_helper_prepare_planes(struct drm_device *dev, > > > > > struct drm_atomic_state *state) > > > > > { > > > > > - struct drm_connector *connector; > > > > > + struct drm_connector __maybe_unused *connector; > > > > > struct drm_connector_state *new_conn_state; > > > > > struct drm_plane *plane; > > > > > struct drm_plane_state *new_plane_state; > > > > > @@ -2953,9 +2953,9 @@ int drm_atomic_helper_disable_all(struct drm_device *dev, > > > > > { > > > > > struct drm_atomic_state *state; > > > > > struct drm_connector_state *conn_state; > > > > > - struct drm_connector *conn; > > > > > + struct drm_connector __maybe_unused *conn; > > > > > struct drm_plane_state *plane_state; > > > > > - struct drm_plane *plane; > > > > > + struct drm_plane __maybe_unused *plane; > > > > > struct drm_crtc_state *crtc_state; > > > > > struct drm_crtc *crtc; > > > > > int ret, i; > > > > > @@ -3199,11 +3199,11 @@ int drm_atomic_helper_commit_duplicated_state(struct drm_atomic_state *state, > > > > > { > > > > > int i, ret; > > > > > struct drm_plane *plane; > > > > > - struct drm_plane_state *new_plane_state; > > > > > + struct drm_plane_state __maybe_unused *new_plane_state; > > > > > struct drm_connector *connector; > > > > > - struct drm_connector_state *new_conn_state; > > > > > + struct drm_connector_state __maybe_unused *new_conn_state; > > > > > struct drm_crtc *crtc; > > > > > - struct drm_crtc_state *new_crtc_state; > > > > > + struct drm_crtc_state __maybe_unused *new_crtc_state; > > > > > > > > > > state->acquire_ctx = ctx; > > > > > > > > > > -- > > > > > 2.15.0 > > > > > > > > > > _______________________________________________ > > > > > dri-devel mailing list > > > > > dri-devel@lists.freedesktop.org > > > > > https://lists.freedesktop.org/mailman/listinfo/dri-devel > > > > > > > > -- > > > > Ville Syrj?l? > > > > Intel > > > > -- > > Ville Syrj?l? > > Intel -- Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch