Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp4737633imb; Wed, 6 Mar 2019 22:35:34 -0800 (PST) X-Google-Smtp-Source: APXvYqy694e3KXRuWyASiArKewlgoWF/aexx8lXaxS7iFaRvOJ5D1NIHC+gdJ+6XEYYNa7paYhRh X-Received: by 2002:a65:6241:: with SMTP id q1mr10115050pgv.340.1551940533975; Wed, 06 Mar 2019 22:35:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551940533; cv=none; d=google.com; s=arc-20160816; b=s8CutqLa7jcc72PbhblbKt/pAVR4jbGh/v98HdIeAM3nF4DEEHYP08cRorKGaZLQRV nSJhA0cRR44kg1kiklgRgIDm5tSGnI8eVcY2Lnc4TtF5u+5DguCexiP1JOgqz9PMrNdv ZfCDOF41uGgScmyJOQf9JP1eUXkTdG6GSLrIQ9jcr0qcy7taaxybGNjWjOGzLXbXC/YO dOiVRMNXKI7eZb2EjbGn9UESgnzswt/YTFuhUgcyMVM1BORKFqzG67440x8XjBE7js/9 SAsCR0rOcu0f8XeLTdry5JA+w0R5cnCHAroxzi7DlzJT2y9fW5ew/+0zBc+LbOkyazC3 dShw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=DLUTU4N4tm+YaD4okkr0dCWy+RzGTcAsCUFznaJT8bg=; b=Wol76TPuhXNM+rfdszZXW6hR6DPbxQdMg3O22chFZHNDJS42n6OXC2rMHLJH6ciLty j3T9PexwtHPH8a+YffsZyPK7e5SMXZR7rmLqLHIku9VqMHw/og8RODSZxIkQbpGQA4WE 8IOwDNGiKOGW+Fe3lubJHNMYoTrnc9BchNCFHll89SwhgLnSaCd/8Wvf8cF0QkuMFthg 8SzMgyKd0VY7jkZsskb8WrA0OwB9Y0DnqPF+jGBGd7YghukVOhwg3/8XYwre25hn4bKS 3ZPtDb6C0HHG1Ij9vnaczhmECIlabQboNcF1R62UrPS91g/CId6DYSsQG6CHLA5Qn/1T MfFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=vYKcdrAL; 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 v6si3443364plo.129.2019.03.06.22.35.18; Wed, 06 Mar 2019 22:35:33 -0800 (PST) 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=pass header.i=@c-s.fr header.s=mail header.b=vYKcdrAL; 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 S1726540AbfCGGe7 (ORCPT + 99 others); Thu, 7 Mar 2019 01:34:59 -0500 Received: from pegase1.c-s.fr ([93.17.236.30]:12095 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726441AbfCGGe7 (ORCPT ); Thu, 7 Mar 2019 01:34:59 -0500 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 44FLTX3gtpz9v089; Thu, 7 Mar 2019 07:34:56 +0100 (CET) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=vYKcdrAL; dkim-adsp=pass; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id ONlGw92ZOTaR; Thu, 7 Mar 2019 07:34:56 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 44FLTX2T0fz9v087; Thu, 7 Mar 2019 07:34:56 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1551940496; bh=DLUTU4N4tm+YaD4okkr0dCWy+RzGTcAsCUFznaJT8bg=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=vYKcdrALMijKxu+/AbgZqIMVsjVA7eUSEl6BWAHINsOy8p0Sx4xTfORmsU3AOaDVO YTvvH0RqDj7quR2CUk6ouxca/cxEuhq7FK0woblI5+bR4TwpGaZ9RtKbeni1HuFbms qQcP0Swl2zWp6JgyfwgjhIdVQ0enWZKpihZpmnzw= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 229C28B8C7; Thu, 7 Mar 2019 07:34:52 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id UwmCsRx0nhL3; Thu, 7 Mar 2019 07:34:52 +0100 (CET) Received: from po16846vm.idsi0.si.c-s.fr (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id AD4418B8C2; Thu, 7 Mar 2019 07:34:51 +0100 (CET) Subject: Re: [PATCH] powerpc: silence unused-but-set-variable warnings To: Qian Cai , benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org References: <20190307034821.48769-1-cai@lca.pw> From: Christophe Leroy Message-ID: Date: Thu, 7 Mar 2019 06:34:39 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20190307034821.48769-1-cai@lca.pw> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/07/2019 03:48 AM, Qian Cai wrote: > pte_unmap() compiles away on some powerpc platforms, so silence the > warnings below by using the argument to pte_unmap() as a nop. Also, fix > checkpatch.pl warnings "Single statement macros should not use a do {} > while (0) loop". > > mm/memory.c: In function 'copy_pte_range': > mm/memory.c:820:24: warning: variable 'orig_dst_pte' set but not used > [-Wunused-but-set-variable] > mm/memory.c:820:9: warning: variable 'orig_src_pte' set but not used > [-Wunused-but-set-variable] > mm/madvise.c: In function 'madvise_free_pte_range': > mm/madvise.c:318:9: warning: variable 'orig_pte' set but not used > [-Wunused-but-set-variable] > mm/swap_state.c: In function 'swap_ra_info': > mm/swap_state.c:634:15: warning: variable 'orig_pte' set but not used > [-Wunused-but-set-variable] > > Signed-off-by: Qian Cai > --- > arch/powerpc/include/asm/book3s/64/pgtable.h | 2 +- > arch/powerpc/include/asm/nohash/64/pgtable.h | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/arch/powerpc/include/asm/book3s/64/pgtable.h b/arch/powerpc/include/asm/book3s/64/pgtable.h > index 868fcaf56f6b..ec00ce6dd312 100644 > --- a/arch/powerpc/include/asm/book3s/64/pgtable.h > +++ b/arch/powerpc/include/asm/book3s/64/pgtable.h > @@ -1006,7 +1006,7 @@ extern struct page *pgd_page(pgd_t pgd); > (((pte_t *) pmd_page_vaddr(*(dir))) + pte_index(addr)) > > #define pte_offset_map(dir,addr) pte_offset_kernel((dir), (addr)) > -#define pte_unmap(pte) do { } while(0) > +#define pte_unmap(pte) (void)(pte) I think it would be better with a static inline --- a/arch/powerpc/include/asm/nohash/64/pgtable.h +++ b/arch/powerpc/include/asm/nohash/64/pgtable.h @@ -205,7 +205,8 @@ static inline void pgd_set(pgd_t *pgdp, unsigned long val) (((pte_t *) pmd_page_vaddr(*(dir))) + (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))) #define pte_offset_map(dir,addr) pte_offset_kernel((dir), (addr)) -#define pte_unmap(pte) do { } while(0) + +static inline void pte_unmap(pte_t *pte) { } /* to find an entry in a kernel page-table-directory */ /* This now only contains the vmalloc pages */ Christophe > > /* to find an entry in a kernel page-table-directory */ > /* This now only contains the vmalloc pages */ > diff --git a/arch/powerpc/include/asm/nohash/64/pgtable.h b/arch/powerpc/include/asm/nohash/64/pgtable.h > index e77ed9761632..103071afab3d 100644 > --- a/arch/powerpc/include/asm/nohash/64/pgtable.h > +++ b/arch/powerpc/include/asm/nohash/64/pgtable.h > @@ -205,7 +205,7 @@ static inline void pgd_set(pgd_t *pgdp, unsigned long val) > (((pte_t *) pmd_page_vaddr(*(dir))) + (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))) > > #define pte_offset_map(dir,addr) pte_offset_kernel((dir), (addr)) > -#define pte_unmap(pte) do { } while(0) > +#define pte_unmap(pte) (void)(pte) > > /* to find an entry in a kernel page-table-directory */ > /* This now only contains the vmalloc pages */ >