Skip to contentSkip to conversation

MIPS: page.h: define virt_to_pfn()

PATCH In review Florian Fainelli 2 participants 4 messages Mar 9, 2017 – Nov 9, 2017 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 MIPS: page.h: define virt_to_pfn()

Based on the existing definition of virt_to_page() which already does a PFN_DOWN(vir_to_phys(kaddr)).

---
 arch/mips/include/asm/page.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/mips/include/asm/page.h +2 -2
index 5f987598054f..ad461216b5a1 100644
@@ -240,8 +240,8 @@ static inline int pfn_valid(unsigned long pfn)
 
 #endif
 
-#define virt_to_page(kaddr)	pfn_to_page(PFN_DOWN(virt_to_phys((void *)     \
-								  (kaddr))))
+#define virt_to_pfn(kaddr)   	PFN_DOWN(virt_to_phys((void *)(kaddr)))
+#define virt_to_page(kaddr)	pfn_to_page(virt_to_pfn(kaddr))
 
 extern int __virt_addr_valid(const volatile void *kaddr);
 #define virt_addr_valid(kaddr)						\
Signature · 1 line
2.9.3
#1 lore raw

Hi Florian,

Quoted 2 lines · Florian Fainelli

Based on the existing definition of virt_to_page() which already does a PFN_DOWN(vir_to_phys(kaddr)).

I was just wondering if there was a particular motivation for this change?

Cheers
James

Quoted 24 lines
---
 arch/mips/include/asm/page.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/mips/include/asm/page.h +2 -2
index 5f987598054f..ad461216b5a1 100644
@@ -240,8 +240,8 @@ static inline int pfn_valid(unsigned long pfn)
 
 #endif
 
-#define virt_to_page(kaddr)	pfn_to_page(PFN_DOWN(virt_to_phys((void *)     \
-								  (kaddr))))
+#define virt_to_pfn(kaddr)   	PFN_DOWN(virt_to_phys((void *)(kaddr)))
+#define virt_to_page(kaddr)	pfn_to_page(virt_to_pfn(kaddr))
 
 extern int __virt_addr_valid(const volatile void *kaddr);
 #define virt_addr_valid(kaddr)						\
Signature · 1 line
2.9.3
#2 lore raw
Quoted 8 lines · James Hogan

Hi Florian,

Quoted 2 lines · Florian Fainelli

Based on the existing definition of virt_to_page() which already does a PFN_DOWN(vir_to_phys(kaddr)).

I was just wondering if there was a particular motivation for this change?

Initially that was a part of an experiment to try to build and use ION on MIPS, but I think this dependency somehow got removed. I might have thought about using it for CONFIG_DEBUG_VIRTUAL too.

In then end I sent it because it sounded like a simple change that could have some use later.

Thanks for going through the patch queue :)

Quoted 28 lines

Cheers
James

Quoted 24 lines
---
 arch/mips/include/asm/page.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/mips/include/asm/page.h +2 -2
index 5f987598054f..ad461216b5a1 100644
@@ -240,8 +240,8 @@ static inline int pfn_valid(unsigned long pfn)
 
 #endif
 
-#define virt_to_page(kaddr)	pfn_to_page(PFN_DOWN(virt_to_phys((void *)     \
-								  (kaddr))))
+#define virt_to_pfn(kaddr)   	PFN_DOWN(virt_to_phys((void *)(kaddr)))
+#define virt_to_page(kaddr)	pfn_to_page(virt_to_pfn(kaddr))
 
 extern int __virt_addr_valid(const volatile void *kaddr);
 #define virt_addr_valid(kaddr)						\
Signature · 1 line
2.9.3
Signature · 1 line
Florian
#3 lore raw
Quoted 10 lines · Florian Fainelli
Quoted 8 lines · James Hogan

Hi Florian,

Quoted 2 lines · Florian Fainelli

Based on the existing definition of virt_to_page() which already does a PFN_DOWN(vir_to_phys(kaddr)).

I was just wondering if there was a particular motivation for this change?

Quoted 6 lines

Initially that was a part of an experiment to try to build and use ION on MIPS, but I think this dependency somehow got removed. I might have thought about using it for CONFIG_DEBUG_VIRTUAL too.

In then end I sent it because it sounded like a simple change that could have some use later.

Okay thanks for clarifying. I've applied for 4.15.

Cheers
James