From patchwork Thu Jan 19 15:09:47 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 9526175 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 84DDC601AE for ; Thu, 19 Jan 2017 15:10:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 738DD28559 for ; Thu, 19 Jan 2017 15:10:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 64DC928587; Thu, 19 Jan 2017 15:10:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0598D28559 for ; Thu, 19 Jan 2017 15:10:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 52A146EA49; Thu, 19 Jan 2017 15:10:01 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mout.kundenserver.de (mout.kundenserver.de [217.72.192.75]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5B7BB6EA49 for ; Thu, 19 Jan 2017 15:09:59 +0000 (UTC) Received: from wuerfel.localnet ([78.43.21.235]) by mrelayeu.kundenserver.de (mreue102 [212.227.15.145]) with ESMTPSA (Nemesis) id 0MYNYv-1czFkN1Lk1-00V9CX; Thu, 19 Jan 2017 16:09:50 +0100 From: Arnd Bergmann To: Thierry Reding Subject: Re: [PATCH] drm: tegra: shut up harmless warning on NOMMU Date: Thu, 19 Jan 2017 16:09:47 +0100 Message-ID: <7713814.tr8Zr0Cdrc@wuerfel> User-Agent: KMail/5.1.3 (Linux/4.4.0-34-generic; KDE/5.18.0; x86_64; ; ) In-Reply-To: <20170119110058.GD30182@ulmo.ba.sec> References: <20170112111425.3228358-1-arnd@arndb.de> <20170119110058.GD30182@ulmo.ba.sec> MIME-Version: 1.0 X-Provags-ID: V03:K0:/rvUbgX9pslx54ybOX2QLSHPtPadZalENTgsjXwkWRwEOereqCm 1gHw2xXa+dLfGO79A3K+VgtY9tT5ILFal1UODUusD9U1tZkr/VPKjV4LmuDgODRNemdFeNw sneSQJ8l6IkYYV9pCRaJ2VI5YKvXkU3FoHbRsaU+G1sB3+YEoNqPv9jc+IAMV89IVJLH1jv u7KnxEpV48tbFBTIB1VSw== X-UI-Out-Filterresults: notjunk:1; V01:K0:CiR6Vf8WkrE=:iFi1HxAWfvcIAUGnu5h5fp nkgBwiWAFKFHgOI8wOFJMgRSomMPkiZ9CzPtMH5KjW0YvbhibQOA1LPPIGAYmzQ0iYn3hEu7C hH/txZnTdjGffKBW3hNXzcKpfqQqV0HOgvoensm0iY6U/61s4E6IBZ47cWdWJxshH8ZPa5tza 35UhbuevhT91vY9Aqw5ssEuaO5p+0qXEvMc6vaE0y+Cqi9w6HVPpplYqSaYwlWzg5VZ7YLvH8 wGu5nt/u/UcrswtWbDiWcekM9mM/VdEzrmRdkGiIZhSs5BAjJ4Q80MyLreNb5kfaCjU/D+o2x qzNu7DD0Lj4oLEzeer16qpSqAUaGelXEjFxJhY04MtPcUOCjXkIF6QpiZfREzzFJKYdepkJBL C4KRIddHehvVM4fOsx5EtBQEiBzJjyoYr70U1i1Cqq3AhEzS2LV975l9Ww5ylMQLCbiOSqsNN 3vWqU2lWykR7XA+k0KLZXk5Upy7cD/wrGkjUso1LHDB1vloWcZbirvSsRDB9eUeQXFhyNOKUx e9Rp3e0QIEjS2mNsyJwb1jbN7JFL/HYNMuhl2+SLzE5dEM2opUQTZt/gwjPl/L1N9/ZnEFUwN m8hlogUZG5tEH+NDXHTnDVUmhrama7I6uH6MqDUjsGY4wmW2c3Qn8i4qj8tpkH03+XRNtiGhx yAbaAej0sIUd3qEOubyK7o5czbjsrSyrlWge7UYtRBcq5vBalzOkXKa5y10T/eM8s2N/Em7+c 4TJrwKLoL1KnaNs4 Cc: Alexandre Courbot , Stephen Warren , Daniel Vetter , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Mikko Perttunen , Russell King , linux-tegra@vger.kernel.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP On Thursday, January 19, 2017 12:00:58 PM CET Thierry Reding wrote: > 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: > > > > drivers/gpu/drm/tegra/gem.c: In function 'tegra_drm_mmap': > > drivers/gpu/drm/tegra/gem.c:508:12: unused variable 'prot' > > > > This marks the variable as __maybe_unused instead. > > > > Signed-off-by: Arnd Bergmann > > --- > > drivers/gpu/drm/tegra/gem.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > 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) > > > > vma->vm_pgoff = vm_pgoff; > > } else { > > - pgprot_t prot = vm_get_page_prot(vma->vm_flags); > > + pgprot_t prot __maybe_unused = 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 > Makes sense. How about this version? Arnd Acked-by: Thierry Reding --- From 83af6bc74423c90be7f580a827268b89f94b5c6b Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Thu, 19 Jan 2017 16:05:29 +0100 Subject: [PATCH] ARM: improve NOMMU definition of pgprot_*() The tegra DRM driver produces a harmless warning when built for NOMMU: drivers/gpu/drm/tegra/gem.c: In function 'tegra_drm_mmap': drivers/gpu/drm/tegra/gem.c:508:12: unused variable 'prot' This is because pgprot_writecombine() on ARM returns a constant and ignores its argument. The version in asm-generic doesn't have that problem, so let's use that one instead. We don't actually care about the value on NOMMU, and this is consistent with what some other architectures do. Signed-off-by: Arnd Bergmann diff --git a/arch/arm/include/asm/pgtable-nommu.h b/arch/arm/include/asm/pgtable-nommu.h index add094d09e3e..302240c19a5a 100644 --- a/arch/arm/include/asm/pgtable-nommu.h +++ b/arch/arm/include/asm/pgtable-nommu.h @@ -63,9 +63,9 @@ typedef pte_t *pte_addr_t; /* * Mark the prot value as uncacheable and unbufferable. */ -#define pgprot_noncached(prot) __pgprot(0) -#define pgprot_writecombine(prot) __pgprot(0) -#define pgprot_dmacoherent(prot) __pgprot(0) +#define pgprot_noncached(prot) (prot) +#define pgprot_writecombine(prot) (prot) +#define pgprot_dmacoherent(prot) (prot) /*