All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] s390/mm: fix -Wunused-but-set-variable warnings
@ 2019-10-03 21:36 Qian Cai
  2019-10-04  9:00 ` Christian Borntraeger
  0 siblings, 1 reply; 2+ messages in thread
From: Qian Cai @ 2019-10-03 21:36 UTC (permalink / raw)
  To: heiko.carstens, gor, borntraeger; +Cc: linux-s390, linux-kernel, Qian Cai

Convert two functions to static inline to get ride of W=1 GCC warnings
like,

mm/gup.c: In function 'gup_pte_range':
mm/gup.c:1816:16: warning: variable 'ptem' set but not used
[-Wunused-but-set-variable]
  pte_t *ptep, *ptem;
                ^~~~

mm/mmap.c: In function 'acct_stack_growth':
mm/mmap.c:2322:16: warning: variable 'new_start' set but not used
[-Wunused-but-set-variable]
  unsigned long new_start;
                ^~~~~~~~~

Signed-off-by: Qian Cai <cai@lca.pw>
---
 arch/s390/include/asm/hugetlb.h | 9 +++++++--
 arch/s390/include/asm/pgtable.h | 3 ++-
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/arch/s390/include/asm/hugetlb.h b/arch/s390/include/asm/hugetlb.h
index bb59dd964590..de8f0bf5f238 100644
--- a/arch/s390/include/asm/hugetlb.h
+++ b/arch/s390/include/asm/hugetlb.h
@@ -12,8 +12,6 @@
 #include <asm/page.h>
 #include <asm/pgtable.h>
 
-
-#define is_hugepage_only_range(mm, addr, len)	0
 #define hugetlb_free_pgd_range			free_pgd_range
 #define hugepages_supported()			(MACHINE_HAS_EDAT1)
 
@@ -23,6 +21,13 @@ void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
 pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
 			      unsigned long addr, pte_t *ptep);
 
+static inline bool is_hugepage_only_range(struct mm_struct *mm,
+					  unsigned long addr,
+					  unsigned long len)
+{
+	return false;
+}
+
 /*
  * If the arch doesn't supply something else, assume that hugepage
  * size aligned regions are ok without further preparation.
diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h
index 36c578c0ff96..19c2cf001df3 100644
--- a/arch/s390/include/asm/pgtable.h
+++ b/arch/s390/include/asm/pgtable.h
@@ -1269,7 +1269,8 @@ static inline pte_t *pte_offset(pmd_t *pmd, unsigned long address)
 
 #define pte_offset_kernel(pmd, address) pte_offset(pmd, address)
 #define pte_offset_map(pmd, address) pte_offset_kernel(pmd, address)
-#define pte_unmap(pte) do { } while (0)
+
+static inline void pte_unmap(pte_t *pte) { }
 
 static inline bool gup_fast_permitted(unsigned long start, unsigned long end)
 {
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] s390/mm: fix -Wunused-but-set-variable warnings
  2019-10-03 21:36 [PATCH] s390/mm: fix -Wunused-but-set-variable warnings Qian Cai
@ 2019-10-04  9:00 ` Christian Borntraeger
  0 siblings, 0 replies; 2+ messages in thread
From: Christian Borntraeger @ 2019-10-04  9:00 UTC (permalink / raw)
  To: Qian Cai, heiko.carstens, gor; +Cc: linux-s390, linux-kernel



On 03.10.19 23:36, Qian Cai wrote:
> Convert two functions to static inline to get ride of W=1 GCC warnings
> like,
> 
> mm/gup.c: In function 'gup_pte_range':
> mm/gup.c:1816:16: warning: variable 'ptem' set but not used
> [-Wunused-but-set-variable]
>   pte_t *ptep, *ptem;
>                 ^~~~
> 
> mm/mmap.c: In function 'acct_stack_growth':
> mm/mmap.c:2322:16: warning: variable 'new_start' set but not used
> [-Wunused-but-set-variable]
>   unsigned long new_start;
>                 ^~~~~~~~~
> 
> Signed-off-by: Qian Cai <cai@lca.pw>

Thanks applied. 
> ---
>  arch/s390/include/asm/hugetlb.h | 9 +++++++--
>  arch/s390/include/asm/pgtable.h | 3 ++-
>  2 files changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/s390/include/asm/hugetlb.h b/arch/s390/include/asm/hugetlb.h
> index bb59dd964590..de8f0bf5f238 100644
> --- a/arch/s390/include/asm/hugetlb.h
> +++ b/arch/s390/include/asm/hugetlb.h
> @@ -12,8 +12,6 @@
>  #include <asm/page.h>
>  #include <asm/pgtable.h>
>  
> -
> -#define is_hugepage_only_range(mm, addr, len)	0
>  #define hugetlb_free_pgd_range			free_pgd_range
>  #define hugepages_supported()			(MACHINE_HAS_EDAT1)
>  
> @@ -23,6 +21,13 @@ void set_huge_pte_at(struct mm_struct *mm, unsigned long addr,
>  pte_t huge_ptep_get_and_clear(struct mm_struct *mm,
>  			      unsigned long addr, pte_t *ptep);
>  
> +static inline bool is_hugepage_only_range(struct mm_struct *mm,
> +					  unsigned long addr,
> +					  unsigned long len)
> +{
> +	return false;
> +}
> +
>  /*
>   * If the arch doesn't supply something else, assume that hugepage
>   * size aligned regions are ok without further preparation.
> diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h
> index 36c578c0ff96..19c2cf001df3 100644
> --- a/arch/s390/include/asm/pgtable.h
> +++ b/arch/s390/include/asm/pgtable.h
> @@ -1269,7 +1269,8 @@ static inline pte_t *pte_offset(pmd_t *pmd, unsigned long address)
>  
>  #define pte_offset_kernel(pmd, address) pte_offset(pmd, address)
>  #define pte_offset_map(pmd, address) pte_offset_kernel(pmd, address)
> -#define pte_unmap(pte) do { } while (0)
> +
> +static inline void pte_unmap(pte_t *pte) { }
>  
>  static inline bool gup_fast_permitted(unsigned long start, unsigned long end)
>  {
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-10-04  9:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-03 21:36 [PATCH] s390/mm: fix -Wunused-but-set-variable warnings Qian Cai
2019-10-04  9:00 ` Christian Borntraeger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.