Skip to contentSkip to conversation

s390/mm: Silence compiler warning when compiling without CONFIG_PGSTE

PATCH In review Thomas Huth 3 participants 4 messages Apr 7, 2019 – Apr 8, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 s390/mm: Silence compiler warning when compiling without CONFIG_PGSTE

If CONFIG_PGSTE is not set (e.g. when compiling without KVM), GCC complains:

CC arch/s390/mm/pgtable.o
arch/s390/mm/pgtable.c:413:15: warning: ‘pmd_alloc_map’ defined but not
used [-Wunused-function]
static pmd_t *pmd_alloc_map(struct mm_struct *mm, unsigned long addr)

               ^~~~~~~~~~~~~

Wrap the function with "#ifdef CONFIG_PGSTE" to silence the warning.

---
 arch/s390/mm/pgtable.c | 2 ++
 1 file changed, 2 insertions(+)
arch/s390/mm/pgtable.c +2 -0
index 8485d6dc2754..9ebd01219812 100644
@@ -410,6 +410,7 @@ static inline pmd_t pmdp_flush_lazy(struct mm_struct *mm,
 	return old;
 }
 
+#ifdef CONFIG_PGSTE
 static pmd_t *pmd_alloc_map(struct mm_struct *mm, unsigned long addr)
 {
 	pgd_t *pgd;
@@ -427,6 +428,7 @@ static pmd_t *pmd_alloc_map(struct mm_struct *mm, unsigned long addr)
 	pmd = pmd_alloc(mm, pud, addr);
 	return pmd;
 }
+#endif
 
 pmd_t pmdp_xchg_direct(struct mm_struct *mm, unsigned long addr,
 		       pmd_t *pmdp, pmd_t new)
Signature · 1 line
2.21.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 28 lines · Thomas Huth

If CONFIG_PGSTE is not set (e.g. when compiling without KVM), GCC complains:

CC arch/s390/mm/pgtable.o
arch/s390/mm/pgtable.c:413:15: warning: ‘pmd_alloc_map’ defined but not
used [-Wunused-function]
static pmd_t *pmd_alloc_map(struct mm_struct *mm, unsigned long addr)

               ^~~~~~~~~~~~~

Wrap the function with "#ifdef CONFIG_PGSTE" to silence the warning.

---
 arch/s390/mm/pgtable.c | 2 ++
 1 file changed, 2 insertions(+)
arch/s390/mm/pgtable.c +1 -0
index 8485d6dc2754..9ebd01219812 100644
@@ -410,6 +410,7 @@ static inline pmd_t pmdp_flush_lazy(struct mm_struct *mm,
 	return old;
 }
 
+#ifdef CONFIG_PGSTE
 static pmd_t *pmd_alloc_map(struct mm_struct *mm, unsigned long addr)
 {
 	pgd_t *pgd;

arch/s390/mm/pgtable.c static pmd_t *pmd_alloc_map(struct mm_struct *mm, unsigned long addr) · line 432

Quoted 5 lines
arch/s390/mm/pgtable.c +1 -0
@@ -427,6 +428,7 @@ static pmd_t *pmd_alloc_map(struct mm_struct *mm, unsigned long addr)
 	pmd = pmd_alloc(mm, pud, addr);
 	return pmd;
 }
+#endif
 

We could also move the function down to the functions where it is used

Signature · 3 lines
Thanks,

David / dhildenb
#2 lore raw
Quoted 24 lines · David Hildenbrand
Quoted 23 lines · Thomas Huth

If CONFIG_PGSTE is not set (e.g. when compiling without KVM), GCC complains:

CC arch/s390/mm/pgtable.o
arch/s390/mm/pgtable.c:413:15: warning: ‘pmd_alloc_map’ defined but not
used [-Wunused-function]
static pmd_t *pmd_alloc_map(struct mm_struct *mm, unsigned long addr)

               ^~~~~~~~~~~~~

Wrap the function with "#ifdef CONFIG_PGSTE" to silence the warning.

---
 arch/s390/mm/pgtable.c | 2 ++
 1 file changed, 2 insertions(+)
arch/s390/mm/pgtable.c +0 -0
index 8485d6dc2754..9ebd01219812 100644
@@ -410,6 +410,7 @@ static inline pmd_t pmdp_flush_lazy(struct mm_struct *mm,
 	return old;
 }
 
Quoted 12 lines

arch/s390/mm/pgtable.c static pmd_t *pmd_alloc_map(struct mm_struct *mm, unsigned long addr) · line 432

Quoted 10 lines
arch/s390/mm/pgtable.c +2 -0
+#ifdef CONFIG_PGSTE
 static pmd_t *pmd_alloc_map(struct mm_struct *mm, unsigned long addr)
 {
 	pgd_t *pgd;
@@ -427,6 +428,7 @@ static pmd_t *pmd_alloc_map(struct mm_struct *mm, unsigned long addr)
 	pmd = pmd_alloc(mm, pud, addr);
 	return pmd;
 }
+#endif
 

We could also move the function down to the functions where it is used

Yeah, I thought about that, too. Both have advantages:

- If we keep the code here, "git blame" shows a nicer history of these lines
- If we move the code, we need less #ifdefs

I'll leave the decision to the maintainers... Martin, Heiko?

Quoted 1 line

Thanks,
Thomas

#3 lore raw
Quoted 38 lines · Thomas Huth
Quoted 24 lines · David Hildenbrand
Quoted 23 lines · Thomas Huth

If CONFIG_PGSTE is not set (e.g. when compiling without KVM), GCC complains:

CC arch/s390/mm/pgtable.o
arch/s390/mm/pgtable.c:413:15: warning: ‘pmd_alloc_map’ defined but not
used [-Wunused-function]
static pmd_t *pmd_alloc_map(struct mm_struct *mm, unsigned long addr)

               ^~~~~~~~~~~~~

Wrap the function with "#ifdef CONFIG_PGSTE" to silence the warning.

---
 arch/s390/mm/pgtable.c | 2 ++
 1 file changed, 2 insertions(+)
arch/s390/mm/pgtable.c +0 -0
index 8485d6dc2754..9ebd01219812 100644
@@ -410,6 +410,7 @@ static inline pmd_t pmdp_flush_lazy(struct mm_struct *mm,
 	return old;
 }
 
Quoted 12 lines

arch/s390/mm/pgtable.c static pmd_t *pmd_alloc_map(struct mm_struct *mm, unsigned long addr) · line 432

Quoted 10 lines
arch/s390/mm/pgtable.c +2 -0
+#ifdef CONFIG_PGSTE
 static pmd_t *pmd_alloc_map(struct mm_struct *mm, unsigned long addr)
 {
 	pgd_t *pgd;
@@ -427,6 +428,7 @@ static pmd_t *pmd_alloc_map(struct mm_struct *mm, unsigned long addr)
 	pmd = pmd_alloc(mm, pud, addr);
 	return pmd;
 }
+#endif
 

We could also move the function down to the functions where it is used

Quoted 7 lines

Yeah, I thought about that, too. Both have advantages:

- If we keep the code here, "git blame" shows a nicer history of these lines
- If we move the code, we need less #ifdefs

I'll leave the decision to the maintainers... Martin, Heiko?

Applied without changes. Thanks!