diff mbox series

MIPS: Make phys_to_virt utilize __va()

Message ID 20220707203743.1226302-1-f.fainelli@gmail.com (mailing list archive)
State Accepted
Commit 9044576357b16d9ebbe10cc567277507d1165a54
Headers show
Series MIPS: Make phys_to_virt utilize __va() | expand

Commit Message

Florian Fainelli July 7, 2022, 8:37 p.m. UTC
The implementation is exactly the same, so avoid open-coding it in two
different locations.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 arch/mips/include/asm/io.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Serge Semin July 8, 2022, 12:34 p.m. UTC | #1
On Thu, Jul 07, 2022 at 01:37:42PM -0700, Florian Fainelli wrote:
> The implementation is exactly the same, so avoid open-coding it in two
> different locations.
> 
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

Seems reasonable. Thanks.

Reviewed-by: Serge Semin <fancer.lancer@gmail.com>

*Note it now looks exactly as the generic phys_to_virt().

-Sergey

> ---
>  arch/mips/include/asm/io.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h
> index 6f5c86d2bab4..880048a54362 100644
> --- a/arch/mips/include/asm/io.h
> +++ b/arch/mips/include/asm/io.h
> @@ -131,7 +131,7 @@ static inline phys_addr_t virt_to_phys(const volatile void *x)
>   */
>  static inline void * phys_to_virt(unsigned long address)
>  {
> -	return (void *)(address + PAGE_OFFSET - PHYS_OFFSET);
> +	return __va(address);
>  }
>  
>  /*
> -- 
> 2.25.1
>
Florian Fainelli July 8, 2022, 4:21 p.m. UTC | #2
On 7/8/22 05:34, Serge Semin wrote:
> On Thu, Jul 07, 2022 at 01:37:42PM -0700, Florian Fainelli wrote:
>> The implementation is exactly the same, so avoid open-coding it in two
>> different locations.
>>
>> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> 
> Seems reasonable. Thanks.
> 
> Reviewed-by: Serge Semin <fancer.lancer@gmail.com>
> 
> *Note it now looks exactly as the generic phys_to_virt().

True, though switching to asm-generic/io.h is a slightly bigger 
undertaking. I will cook something towards that goal however.
Thomas Bogendoerfer July 11, 2022, 8:38 a.m. UTC | #3
On Thu, Jul 07, 2022 at 01:37:42PM -0700, Florian Fainelli wrote:
> The implementation is exactly the same, so avoid open-coding it in two
> different locations.
> 
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> ---
>  arch/mips/include/asm/io.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h
> index 6f5c86d2bab4..880048a54362 100644
> --- a/arch/mips/include/asm/io.h
> +++ b/arch/mips/include/asm/io.h
> @@ -131,7 +131,7 @@ static inline phys_addr_t virt_to_phys(const volatile void *x)
>   */
>  static inline void * phys_to_virt(unsigned long address)
>  {
> -	return (void *)(address + PAGE_OFFSET - PHYS_OFFSET);
> +	return __va(address);
>  }
>  
>  /*
> -- 
> 2.25.1

applied to mips-next.

Thomas.
diff mbox series

Patch

diff --git a/arch/mips/include/asm/io.h b/arch/mips/include/asm/io.h
index 6f5c86d2bab4..880048a54362 100644
--- a/arch/mips/include/asm/io.h
+++ b/arch/mips/include/asm/io.h
@@ -131,7 +131,7 @@  static inline phys_addr_t virt_to_phys(const volatile void *x)
  */
 static inline void * phys_to_virt(unsigned long address)
 {
-	return (void *)(address + PAGE_OFFSET - PHYS_OFFSET);
+	return __va(address);
 }
 
 /*