* [PATCH] powerpc: silence unused-but-set-variable warnings
@ 2019-03-07 3:48 Qian Cai
2019-03-07 6:34 ` Christophe Leroy
0 siblings, 1 reply; 2+ messages in thread
From: Qian Cai @ 2019-03-07 3:48 UTC (permalink / raw)
To: benh, paulus, mpe; +Cc: Qian Cai, linuxppc-dev, linux-kernel
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 <cai@lca.pw>
---
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)
/* 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 */
--
2.17.2 (Apple Git-113)
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] powerpc: silence unused-but-set-variable warnings
2019-03-07 3:48 [PATCH] powerpc: silence unused-but-set-variable warnings Qian Cai
@ 2019-03-07 6:34 ` Christophe Leroy
0 siblings, 0 replies; 2+ messages in thread
From: Christophe Leroy @ 2019-03-07 6:34 UTC (permalink / raw)
To: Qian Cai, benh, paulus, mpe; +Cc: linuxppc-dev, linux-kernel
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 <cai@lca.pw>
> ---
> 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 */
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-03-07 6:36 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-07 3:48 [PATCH] powerpc: silence unused-but-set-variable warnings Qian Cai
2019-03-07 6:34 ` Christophe Leroy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).