From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752153AbdASLBP (ORCPT ); Thu, 19 Jan 2017 06:01:15 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:33791 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752042AbdASLBK (ORCPT ); Thu, 19 Jan 2017 06:01:10 -0500 Date: Thu, 19 Jan 2017 12:00:58 +0100 From: Thierry Reding To: Arnd Bergmann Cc: David Airlie , Stephen Warren , Alexandre Courbot , Mikko Perttunen , Daniel Vetter , dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] drm: tegra: shut up harmless warning on NOMMU Message-ID: <20170119110058.GD30182@ulmo.ba.sec> References: <20170112111425.3228358-1-arnd@arndb.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="sXc4Kmr5FA7axrvy" Content-Disposition: inline In-Reply-To: <20170112111425.3228358-1-arnd@arndb.de> User-Agent: Mutt/1.7.2 (2016-11-26) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --sXc4Kmr5FA7axrvy Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jan 12, 2017 at 12:13:51PM +0100, Arnd Bergmann wrote: > The tegra DRM driver is almost ok without an MMU, but there > is one small warning that I get: >=20 > drivers/gpu/drm/tegra/gem.c: In function 'tegra_drm_mmap': > drivers/gpu/drm/tegra/gem.c:508:12: unused variable 'prot' >=20 > This marks the variable as __maybe_unused instead. >=20 > Signed-off-by: Arnd Bergmann > --- > drivers/gpu/drm/tegra/gem.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/drivers/gpu/drm/tegra/gem.c b/drivers/gpu/drm/tegra/gem.c > index 7d853e6b5ff0..63f14b7a59a0 100644 > --- a/drivers/gpu/drm/tegra/gem.c > +++ b/drivers/gpu/drm/tegra/gem.c > @@ -505,7 +505,7 @@ int tegra_drm_mmap(struct file *file, struct vm_area_= struct *vma) > =20 > vma->vm_pgoff =3D vm_pgoff; > } else { > - pgprot_t prot =3D vm_get_page_prot(vma->vm_flags); > + pgprot_t prot __maybe_unused =3D vm_get_page_prot(vma->vm_flags); This seems to me like a suboptimal solution. The reason why this fails is because pgprot_writecombine(prot) for NOMMU translates to __pgprot(0) via a macro. This also means that we need to potentially add a __maybe_unused annotation to every local variable that stores a value that gets passed to pgprot_writecombine(). There fortunately aren't very many of those cases, but I still think that a better solution would be to turn pgprot_writecombine() into a static inline function, so that the parameter would get silently ignored. Or perhaps if it must remain a macro, then doing the following should still avoid the need to modify every call site: #define pgprot_writecombine(prot) ({ (void)prot; __pgprot(0); }) Thierry --sXc4Kmr5FA7axrvy Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEiOrDCAFJzPfAjcif3SOs138+s6EFAliAnGcACgkQ3SOs138+ s6Ez8A/+PEF1HeYHQziB+BNMghIdRWy56xkuFdI9/ShFVAt0u2stKjt5k8exDngo NcHS4sXzTtIxw2kv/TV+5qhE/OUUv7BWm3R09MvIiRuwL3KiGlmwdIbV8GbFWpFY jjKiXDgHhbRKlEnq28wFhTfvaty/3xmrDSLMN+1iBB970fNYLgTD8dLpYPxhnFp7 YewWxmjDg2NFpYdW6o1vbS31YvMnJxBGqHmUdNfvIt6kdwcBil0ldhLzVoZCb3vG OUDfGXdZ4JgkVmCQiCszyWChLJd0JgFTvytHRgVpUQRLaRkmAQHrL16kI1zj8tUg CHmLhQU2ACGUFz1V2qsfNCoCS0ZQjzNCn93rRBGkltEopIv+3dGc1PhG1kCDGEFw Rm6GCXfGAjiwkNpVUg1mpsue3LYadMvOhmLDV0R3dqWU0BQ/vwRamgvlAeIHWiGp fk1POIpK29B5sn2DFYAZc8Dq9CaIeSg9DAdQuzqimQZsZcqGsOPEgnwFarS6HpLh lEpO/nOWDkMEgm7iTjxnKji6DKtQ8NyPtYo6TlQ+bylThclnNen0FvHiokDFcu8E VFmu9f0kbPnBKEo8Iw71ZPH81NyCPy8NOlruQ3c1s+a650v+REFt0mOGSVp7a/j9 xpAbUAjMDOOGEwk4hzg3HtSxf3ME8R/l4hjG5+dmqxuqjXwYz/M= =fPBe -----END PGP SIGNATURE----- --sXc4Kmr5FA7axrvy--