Skip to contentSkip to conversation

um: define set_pte_at() as a static inline function, not a macro

PATCH In review Bartosz Golaszewski 3 participants 3 messages Mar 13, 2019 User-mode Linux (UML)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 um: define set_pte_at() as a static inline function, not a macro

From: Bartosz Golaszewski <[email protected]>

When defined as macro, the mm argument is unused and subsequently the variable passed as mm is considered unused by the compiler. This fixes a build warning.

---
 arch/um/include/asm/pgtable.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
arch/um/include/asm/pgtable.h +6 -1
index 9c04562310b3..b377df76cc28 100644
@@ -263,7 +263,12 @@ static inline void set_pte(pte_t *pteptr, pte_t pteval)
 	*pteptr = pte_mknewpage(*pteptr);
 	if(pte_present(*pteptr)) *pteptr = pte_mknewprot(*pteptr);
 }
-#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
+
+static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
+			      pte_t *pteptr, pte_t pteval)
+{
+	set_pte(pteptr, pteval);
+}
 
 #define __HAVE_ARCH_PTE_SAME
 static inline int pte_same(pte_t pte_a, pte_t pte_b)
Signature · 1 line
2.20.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

When defined as macro, the mm argument is unused and subsequently the variable passed as mm is considered unused by the compiler. This fixes a build warning.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
maintainer Reviewed-by Acked-by on v1 1/1
#2 lore raw
In reply to Bartosz Golaszewski
Quoted 20 lines · Bartosz Golaszewski

From: Bartosz Golaszewski <[email protected]>

When defined as macro, the mm argument is unused and subsequently the variable passed as mm is considered unused by the compiler. This fixes a build warning.

---
  arch/um/include/asm/pgtable.h | 7 ++++++-
  1 file changed, 6 insertions(+), 1 deletion(-)
arch/um/include/asm/pgtable.h +0 -0
index 9c04562310b3..b377df76cc28 100644
@@ -263,7 +263,12 @@ static inline void set_pte(pte_t *pteptr, pte_t pteval)
  	*pteptr = pte_mknewpage(*pteptr);
  	if(pte_present(*pteptr)) *pteptr = pte_mknewprot(*pteptr);
  }

arch/um/include/asm/pgtable.h static inline void set_pte(pte_t *pteptr, pte_t pteval) · line 274

Quoted 10 lines
arch/um/include/asm/pgtable.h +6 -1
-#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
+
+static inline void set_pte_at(struct mm_struct *mm, unsigned long addr,
+			      pte_t *pteptr, pte_t pteval)
+{
+	set_pte(pteptr, pteval);
+}
 
  #define __HAVE_ARCH_PTE_SAME
  static inline int pte_same(pte_t pte_a, pte_t pte_b)
Signature · 3 lines
Anton R. Ivanov
Cambridgegreys Limited. Registered in England. Company Number 10273661
https://www.cambridgegreys.com/