Re: [PATCH] Use phys_addr_t type for physical address (arm64)

2014-10-02 Thread Min-Hua Chen
Change the type of physical address from unsigned long to phys_addr_t,
make valid_phys_addr_range more readable.

Signed-off-by: Min-Hua Chen 
---
 arch/arm64/include/asm/io.h |2 +-
 arch/arm64/mm/mmap.c|2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/include/asm/io.h b/arch/arm64/include/asm/io.h
index e0ecdcf..f771e8b 100644
--- a/arch/arm64/include/asm/io.h
+++ b/arch/arm64/include/asm/io.h
@@ -243,7 +243,7 @@ extern void __iomem *ioremap_cache(phys_addr_t
phys_addr, size_t size);
  * (PHYS_OFFSET and PHYS_MASK taken into account).
  */
 #define ARCH_HAS_VALID_PHYS_ADDR_RANGE
-extern int valid_phys_addr_range(unsigned long addr, size_t size);
+extern int valid_phys_addr_range(phys_addr_t addr, size_t size);
 extern int valid_mmap_phys_addr_range(unsigned long pfn, size_t size);

 extern int devmem_is_allowed(unsigned long pfn);
diff --git a/arch/arm64/mm/mmap.c b/arch/arm64/mm/mmap.c
index 8ed6cb1..1d73662 100644
--- a/arch/arm64/mm/mmap.c
+++ b/arch/arm64/mm/mmap.c
@@ -102,7 +102,7 @@ EXPORT_SYMBOL_GPL(arch_pick_mmap_layout);
  * You really shouldn't be using read() or write() on /dev/mem.  This might go
  * away in the future.
  */
-int valid_phys_addr_range(unsigned long addr, size_t size)
+int valid_phys_addr_range(phys_addr_t addr, size_t size)
 {
 if (addr < PHYS_OFFSET)
 return 0;
-- 
1.7.10.4

On Thu, Oct 2, 2014 at 5:27 PM, Will Deacon  wrote:
> On Wed, Oct 01, 2014 at 03:26:55PM +0100, Min-Hua Chen wrote:
>> I found that valid_phys_addr_range does not use
>> phys_addr_t to describe physical address.
>> Is it better to change the type from unsigned long to phys_addr_t?
>
> Yes, that looks like a sensible change. Both types are 64-bit on arm64, so
> it shouldn't affect functionality. Can you resend as a proper patch (with
> commit message) please?
>
> Will
>
>> Signed-off-by: Min-Hua Chen
>> diff --git a/arch/arm64/include/asm/io.h b/arch/arm64/include/asm/io.h
>> index e0ecdcf..f771e8b 100644
>> --- a/arch/arm64/include/asm/io.h
>> +++ b/arch/arm64/include/asm/io.h
>> @@ -243,7 +243,7 @@ extern void __iomem *ioremap_cache(phys_addr_t
>> phys_addr, size_t size);
>>   * (PHYS_OFFSET and PHYS_MASK taken into account).
>>   */
>>  #define ARCH_HAS_VALID_PHYS_ADDR_RANGE
>> -extern int valid_phys_addr_range(unsigned long addr, size_t size);
>> +extern int valid_phys_addr_range(phys_addr_t addr, size_t size);
>>  extern int valid_mmap_phys_addr_range(unsigned long pfn, size_t size);
>>
>>  extern int devmem_is_allowed(unsigned long pfn);
>> diff --git a/arch/arm64/mm/mmap.c b/arch/arm64/mm/mmap.c
>> index 8ed6cb1..1d73662 100644
>> --- a/arch/arm64/mm/mmap.c
>> +++ b/arch/arm64/mm/mmap.c
>> @@ -102,7 +102,7 @@ EXPORT_SYMBOL_GPL(arch_pick_mmap_layout);
>>   * You really shouldn't be using read() or write() on /dev/mem.  This might 
>> go
>>   * away in the future.
>>   */
>> -int valid_phys_addr_range(unsigned long addr, size_t size)
>> +int valid_phys_addr_range(phys_addr_t addr, size_t size)
>>  {
>>  if (addr < PHYS_OFFSET)
>>  return 0;
>> --
>> 1.7.10.4
>>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Use phys_addr_t type for physical address (arm64)

2014-10-02 Thread Will Deacon
On Wed, Oct 01, 2014 at 03:26:55PM +0100, Min-Hua Chen wrote:
> I found that valid_phys_addr_range does not use
> phys_addr_t to describe physical address.
> Is it better to change the type from unsigned long to phys_addr_t?

Yes, that looks like a sensible change. Both types are 64-bit on arm64, so
it shouldn't affect functionality. Can you resend as a proper patch (with
commit message) please?

Will

> Signed-off-by: Min-Hua Chen
> diff --git a/arch/arm64/include/asm/io.h b/arch/arm64/include/asm/io.h
> index e0ecdcf..f771e8b 100644
> --- a/arch/arm64/include/asm/io.h
> +++ b/arch/arm64/include/asm/io.h
> @@ -243,7 +243,7 @@ extern void __iomem *ioremap_cache(phys_addr_t
> phys_addr, size_t size);
>   * (PHYS_OFFSET and PHYS_MASK taken into account).
>   */
>  #define ARCH_HAS_VALID_PHYS_ADDR_RANGE
> -extern int valid_phys_addr_range(unsigned long addr, size_t size);
> +extern int valid_phys_addr_range(phys_addr_t addr, size_t size);
>  extern int valid_mmap_phys_addr_range(unsigned long pfn, size_t size);
> 
>  extern int devmem_is_allowed(unsigned long pfn);
> diff --git a/arch/arm64/mm/mmap.c b/arch/arm64/mm/mmap.c
> index 8ed6cb1..1d73662 100644
> --- a/arch/arm64/mm/mmap.c
> +++ b/arch/arm64/mm/mmap.c
> @@ -102,7 +102,7 @@ EXPORT_SYMBOL_GPL(arch_pick_mmap_layout);
>   * You really shouldn't be using read() or write() on /dev/mem.  This might 
> go
>   * away in the future.
>   */
> -int valid_phys_addr_range(unsigned long addr, size_t size)
> +int valid_phys_addr_range(phys_addr_t addr, size_t size)
>  {
>  if (addr < PHYS_OFFSET)
>  return 0;
> -- 
> 1.7.10.4
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Use phys_addr_t type for physical address (arm64)

2014-10-02 Thread Will Deacon
On Wed, Oct 01, 2014 at 03:26:55PM +0100, Min-Hua Chen wrote:
 I found that valid_phys_addr_range does not use
 phys_addr_t to describe physical address.
 Is it better to change the type from unsigned long to phys_addr_t?

Yes, that looks like a sensible change. Both types are 64-bit on arm64, so
it shouldn't affect functionality. Can you resend as a proper patch (with
commit message) please?

Will

 Signed-off-by: Min-Hua Chenorca.c...@gmail.com
 diff --git a/arch/arm64/include/asm/io.h b/arch/arm64/include/asm/io.h
 index e0ecdcf..f771e8b 100644
 --- a/arch/arm64/include/asm/io.h
 +++ b/arch/arm64/include/asm/io.h
 @@ -243,7 +243,7 @@ extern void __iomem *ioremap_cache(phys_addr_t
 phys_addr, size_t size);
   * (PHYS_OFFSET and PHYS_MASK taken into account).
   */
  #define ARCH_HAS_VALID_PHYS_ADDR_RANGE
 -extern int valid_phys_addr_range(unsigned long addr, size_t size);
 +extern int valid_phys_addr_range(phys_addr_t addr, size_t size);
  extern int valid_mmap_phys_addr_range(unsigned long pfn, size_t size);
 
  extern int devmem_is_allowed(unsigned long pfn);
 diff --git a/arch/arm64/mm/mmap.c b/arch/arm64/mm/mmap.c
 index 8ed6cb1..1d73662 100644
 --- a/arch/arm64/mm/mmap.c
 +++ b/arch/arm64/mm/mmap.c
 @@ -102,7 +102,7 @@ EXPORT_SYMBOL_GPL(arch_pick_mmap_layout);
   * You really shouldn't be using read() or write() on /dev/mem.  This might 
 go
   * away in the future.
   */
 -int valid_phys_addr_range(unsigned long addr, size_t size)
 +int valid_phys_addr_range(phys_addr_t addr, size_t size)
  {
  if (addr  PHYS_OFFSET)
  return 0;
 -- 
 1.7.10.4
 
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] Use phys_addr_t type for physical address (arm64)

2014-10-02 Thread Min-Hua Chen
Change the type of physical address from unsigned long to phys_addr_t,
make valid_phys_addr_range more readable.

Signed-off-by: Min-Hua Chen orca.c...@gmail.com
---
 arch/arm64/include/asm/io.h |2 +-
 arch/arm64/mm/mmap.c|2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm64/include/asm/io.h b/arch/arm64/include/asm/io.h
index e0ecdcf..f771e8b 100644
--- a/arch/arm64/include/asm/io.h
+++ b/arch/arm64/include/asm/io.h
@@ -243,7 +243,7 @@ extern void __iomem *ioremap_cache(phys_addr_t
phys_addr, size_t size);
  * (PHYS_OFFSET and PHYS_MASK taken into account).
  */
 #define ARCH_HAS_VALID_PHYS_ADDR_RANGE
-extern int valid_phys_addr_range(unsigned long addr, size_t size);
+extern int valid_phys_addr_range(phys_addr_t addr, size_t size);
 extern int valid_mmap_phys_addr_range(unsigned long pfn, size_t size);

 extern int devmem_is_allowed(unsigned long pfn);
diff --git a/arch/arm64/mm/mmap.c b/arch/arm64/mm/mmap.c
index 8ed6cb1..1d73662 100644
--- a/arch/arm64/mm/mmap.c
+++ b/arch/arm64/mm/mmap.c
@@ -102,7 +102,7 @@ EXPORT_SYMBOL_GPL(arch_pick_mmap_layout);
  * You really shouldn't be using read() or write() on /dev/mem.  This might go
  * away in the future.
  */
-int valid_phys_addr_range(unsigned long addr, size_t size)
+int valid_phys_addr_range(phys_addr_t addr, size_t size)
 {
 if (addr  PHYS_OFFSET)
 return 0;
-- 
1.7.10.4

On Thu, Oct 2, 2014 at 5:27 PM, Will Deacon will.dea...@arm.com wrote:
 On Wed, Oct 01, 2014 at 03:26:55PM +0100, Min-Hua Chen wrote:
 I found that valid_phys_addr_range does not use
 phys_addr_t to describe physical address.
 Is it better to change the type from unsigned long to phys_addr_t?

 Yes, that looks like a sensible change. Both types are 64-bit on arm64, so
 it shouldn't affect functionality. Can you resend as a proper patch (with
 commit message) please?

 Will

 Signed-off-by: Min-Hua Chenorca.c...@gmail.com
 diff --git a/arch/arm64/include/asm/io.h b/arch/arm64/include/asm/io.h
 index e0ecdcf..f771e8b 100644
 --- a/arch/arm64/include/asm/io.h
 +++ b/arch/arm64/include/asm/io.h
 @@ -243,7 +243,7 @@ extern void __iomem *ioremap_cache(phys_addr_t
 phys_addr, size_t size);
   * (PHYS_OFFSET and PHYS_MASK taken into account).
   */
  #define ARCH_HAS_VALID_PHYS_ADDR_RANGE
 -extern int valid_phys_addr_range(unsigned long addr, size_t size);
 +extern int valid_phys_addr_range(phys_addr_t addr, size_t size);
  extern int valid_mmap_phys_addr_range(unsigned long pfn, size_t size);

  extern int devmem_is_allowed(unsigned long pfn);
 diff --git a/arch/arm64/mm/mmap.c b/arch/arm64/mm/mmap.c
 index 8ed6cb1..1d73662 100644
 --- a/arch/arm64/mm/mmap.c
 +++ b/arch/arm64/mm/mmap.c
 @@ -102,7 +102,7 @@ EXPORT_SYMBOL_GPL(arch_pick_mmap_layout);
   * You really shouldn't be using read() or write() on /dev/mem.  This might 
 go
   * away in the future.
   */
 -int valid_phys_addr_range(unsigned long addr, size_t size)
 +int valid_phys_addr_range(phys_addr_t addr, size_t size)
  {
  if (addr  PHYS_OFFSET)
  return 0;
 --
 1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] Use phys_addr_t type for physical address (arm64)

2014-10-01 Thread Min-Hua Chen
Hi,

I found that valid_phys_addr_range does not use
phys_addr_t to describe physical address.
Is it better to change the type from unsigned long to phys_addr_t?

Thanks,
Min-Hua


Signed-off-by: Min-Hua Chen
diff --git a/arch/arm64/include/asm/io.h b/arch/arm64/include/asm/io.h
index e0ecdcf..f771e8b 100644
--- a/arch/arm64/include/asm/io.h
+++ b/arch/arm64/include/asm/io.h
@@ -243,7 +243,7 @@ extern void __iomem *ioremap_cache(phys_addr_t
phys_addr, size_t size);
  * (PHYS_OFFSET and PHYS_MASK taken into account).
  */
 #define ARCH_HAS_VALID_PHYS_ADDR_RANGE
-extern int valid_phys_addr_range(unsigned long addr, size_t size);
+extern int valid_phys_addr_range(phys_addr_t addr, size_t size);
 extern int valid_mmap_phys_addr_range(unsigned long pfn, size_t size);

 extern int devmem_is_allowed(unsigned long pfn);
diff --git a/arch/arm64/mm/mmap.c b/arch/arm64/mm/mmap.c
index 8ed6cb1..1d73662 100644
--- a/arch/arm64/mm/mmap.c
+++ b/arch/arm64/mm/mmap.c
@@ -102,7 +102,7 @@ EXPORT_SYMBOL_GPL(arch_pick_mmap_layout);
  * You really shouldn't be using read() or write() on /dev/mem.  This might go
  * away in the future.
  */
-int valid_phys_addr_range(unsigned long addr, size_t size)
+int valid_phys_addr_range(phys_addr_t addr, size_t size)
 {
 if (addr < PHYS_OFFSET)
 return 0;
-- 
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] Use phys_addr_t type for physical address (arm64)

2014-10-01 Thread Min-Hua Chen
Hi,

I found that valid_phys_addr_range does not use
phys_addr_t to describe physical address.
Is it better to change the type from unsigned long to phys_addr_t?

Thanks,
Min-Hua


Signed-off-by: Min-Hua Chenorca.c...@gmail.com
diff --git a/arch/arm64/include/asm/io.h b/arch/arm64/include/asm/io.h
index e0ecdcf..f771e8b 100644
--- a/arch/arm64/include/asm/io.h
+++ b/arch/arm64/include/asm/io.h
@@ -243,7 +243,7 @@ extern void __iomem *ioremap_cache(phys_addr_t
phys_addr, size_t size);
  * (PHYS_OFFSET and PHYS_MASK taken into account).
  */
 #define ARCH_HAS_VALID_PHYS_ADDR_RANGE
-extern int valid_phys_addr_range(unsigned long addr, size_t size);
+extern int valid_phys_addr_range(phys_addr_t addr, size_t size);
 extern int valid_mmap_phys_addr_range(unsigned long pfn, size_t size);

 extern int devmem_is_allowed(unsigned long pfn);
diff --git a/arch/arm64/mm/mmap.c b/arch/arm64/mm/mmap.c
index 8ed6cb1..1d73662 100644
--- a/arch/arm64/mm/mmap.c
+++ b/arch/arm64/mm/mmap.c
@@ -102,7 +102,7 @@ EXPORT_SYMBOL_GPL(arch_pick_mmap_layout);
  * You really shouldn't be using read() or write() on /dev/mem.  This might go
  * away in the future.
  */
-int valid_phys_addr_range(unsigned long addr, size_t size)
+int valid_phys_addr_range(phys_addr_t addr, size_t size)
 {
 if (addr  PHYS_OFFSET)
 return 0;
-- 
1.7.10.4
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/