Skip to contentSkip to conversation

powerpc: silence unused-but-set-variable warnings

PATCH Applied Qian Cai 3 participants 4 messages Mar 7, 2019 – Apr 21, 2019 PowerPC

lore
Share & tools
lore

Qian Cai

author
#0 lore raw

PATCH v2 1/1 powerpc: silence unused-but-set-variable warnings

pte_unmap() compiles away on some powerpc platforms, so silence the warnings below by making it a static inline function.

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]

---

v2: make it a static inline function.

 arch/powerpc/include/asm/book3s/64/pgtable.h | 3 ++-
 arch/powerpc/include/asm/nohash/64/pgtable.h | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
arch/powerpc/include/asm/book3s/64/pgtable.h +2 -1
index 868fcaf56f6b..d798e33a0c86 100644
@@ -1006,7 +1006,8 @@ 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)
+
+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 */
arch/powerpc/include/asm/nohash/64/pgtable.h +2 -1
index e77ed9761632..0384a3302fb6 100644
@@ -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 */
Signature · 1 line
2.17.2 (Apple Git-113)
Reviewed-by on v2 1/1
#1 lore raw

Le 07/03/2019 à 15:40, Qian Cai a écrit :

Quoted 15 lines

pte_unmap() compiles away on some powerpc platforms, so silence the warnings below by making it a static inline function.

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]

Quoted 2 lines
Quoted 37 lines

---

v2: make it a static inline function.

  arch/powerpc/include/asm/book3s/64/pgtable.h | 3 ++-
  arch/powerpc/include/asm/nohash/64/pgtable.h | 3 ++-
  2 files changed, 4 insertions(+), 2 deletions(-)
arch/powerpc/include/asm/book3s/64/pgtable.h +2 -1
index 868fcaf56f6b..d798e33a0c86 100644
@@ -1006,7 +1006,8 @@ 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)
+
+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 */
arch/powerpc/include/asm/nohash/64/pgtable.h +2 -1
index e77ed9761632..0384a3302fb6 100644
@@ -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 */
author
#2 lore raw
In reply to Qian Cai

Ping. The patchwork status is still New after a month.

Quoted 54 lines · Qian Cai

pte_unmap() compiles away on some powerpc platforms, so silence the warnings below by making it a static inline function.

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]

---

v2: make it a static inline function.

 arch/powerpc/include/asm/book3s/64/pgtable.h | 3 ++-
 arch/powerpc/include/asm/nohash/64/pgtable.h | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)
arch/powerpc/include/asm/book3s/64/pgtable.h +2 -1
index 868fcaf56f6b..d798e33a0c86 100644
@@ -1006,7 +1006,8 @@ 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)
+
+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 */
arch/powerpc/include/asm/nohash/64/pgtable.h +2 -1
index e77ed9761632..0384a3302fb6 100644
@@ -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 */
#3 lore raw
In reply to Qian Cai
Quoted 15 lines · Qian Cai

pte_unmap() compiles away on some powerpc platforms, so silence the warnings below by making it a static inline function.

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]

Quoted 3 lines

Applied to powerpc next, thanks.

https://git.kernel.org/powerpc/c/bff25143da0d623a1765bf78dbc82044

cheers