linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arm64: ARCH_PFN_OFFSET should be unsigned long
@ 2014-10-28  5:44 Neil Zhang
  2014-10-28 12:36 ` Will Deacon
  0 siblings, 1 reply; 4+ messages in thread
From: Neil Zhang @ 2014-10-28  5:44 UTC (permalink / raw)
  To: linux-arm-kernel

pfns are unsigned long, but PHYS_PFN_OFFSET is phys_addr_t. This leads
to page_to_pfn() returning phys_addr_t which cause type mismatches in
some print statements.

Signed-off-by: Neil Zhang <zhangwm@marvell.com>
---
 arch/arm64/include/asm/memory.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h
index ccc7087..a62cd07 100644
--- a/arch/arm64/include/asm/memory.h
+++ b/arch/arm64/include/asm/memory.h
@@ -142,7 +142,7 @@ static inline void *phys_to_virt(phys_addr_t x)
  *  virt_to_page(k)	convert a _valid_ virtual address to struct page *
  *  virt_addr_valid(k)	indicates whether a virtual address is valid
  */
-#define ARCH_PFN_OFFSET		PHYS_PFN_OFFSET
+#define ARCH_PFN_OFFSET		((unsigned long)PHYS_PFN_OFFSET)
 
 #define virt_to_page(kaddr)	pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
 #define	virt_addr_valid(kaddr)	pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] arm64: ARCH_PFN_OFFSET should be unsigned long
  2014-10-28  5:44 [PATCH] arm64: ARCH_PFN_OFFSET should be unsigned long Neil Zhang
@ 2014-10-28 12:36 ` Will Deacon
  2014-10-28 12:51   ` Arnd Bergmann
  0 siblings, 1 reply; 4+ messages in thread
From: Will Deacon @ 2014-10-28 12:36 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Oct 28, 2014 at 05:44:01AM +0000, Neil Zhang wrote:
> pfns are unsigned long, but PHYS_PFN_OFFSET is phys_addr_t. This leads
> to page_to_pfn() returning phys_addr_t which cause type mismatches in
> some print statements.

Do you have a specific example? Both of those types are 64-bit on arm64.

Will

> Signed-off-by: Neil Zhang <zhangwm@marvell.com>
> ---
>  arch/arm64/include/asm/memory.h |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/include/asm/memory.h b/arch/arm64/include/asm/memory.h
> index ccc7087..a62cd07 100644
> --- a/arch/arm64/include/asm/memory.h
> +++ b/arch/arm64/include/asm/memory.h
> @@ -142,7 +142,7 @@ static inline void *phys_to_virt(phys_addr_t x)
>   *  virt_to_page(k)	convert a _valid_ virtual address to struct page *
>   *  virt_addr_valid(k)	indicates whether a virtual address is valid
>   */
> -#define ARCH_PFN_OFFSET		PHYS_PFN_OFFSET
> +#define ARCH_PFN_OFFSET		((unsigned long)PHYS_PFN_OFFSET)
>  
>  #define virt_to_page(kaddr)	pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
>  #define	virt_addr_valid(kaddr)	pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
> -- 
> 1.7.9.5
> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] arm64: ARCH_PFN_OFFSET should be unsigned long
  2014-10-28 12:36 ` Will Deacon
@ 2014-10-28 12:51   ` Arnd Bergmann
  2014-10-28 13:36     ` Will Deacon
  0 siblings, 1 reply; 4+ messages in thread
From: Arnd Bergmann @ 2014-10-28 12:51 UTC (permalink / raw)
  To: linux-arm-kernel

On Tuesday 28 October 2014 12:36:11 Will Deacon wrote:
> On Tue, Oct 28, 2014 at 05:44:01AM +0000, Neil Zhang wrote:
> > pfns are unsigned long, but PHYS_PFN_OFFSET is phys_addr_t. This leads
> > to page_to_pfn() returning phys_addr_t which cause type mismatches in
> > some print statements.
> 
> Do you have a specific example? Both of those types are 64-bit on arm64.
> 
> 

printf warns about the fact that phys_addr_t is defined as 'u64', which
is 'unsigned long long' rather than 'unsigned long'. It's the same size
but not the same printf format string.

	Arnd

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] arm64: ARCH_PFN_OFFSET should be unsigned long
  2014-10-28 12:51   ` Arnd Bergmann
@ 2014-10-28 13:36     ` Will Deacon
  0 siblings, 0 replies; 4+ messages in thread
From: Will Deacon @ 2014-10-28 13:36 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Oct 28, 2014 at 12:51:56PM +0000, Arnd Bergmann wrote:
> On Tuesday 28 October 2014 12:36:11 Will Deacon wrote:
> > On Tue, Oct 28, 2014 at 05:44:01AM +0000, Neil Zhang wrote:
> > > pfns are unsigned long, but PHYS_PFN_OFFSET is phys_addr_t. This leads
> > > to page_to_pfn() returning phys_addr_t which cause type mismatches in
> > > some print statements.
> > 
> > Do you have a specific example? Both of those types are 64-bit on arm64.
> > 
> > 
> 
> printf warns about the fact that phys_addr_t is defined as 'u64', which
> is 'unsigned long long' rather than 'unsigned long'. It's the same size
> but not the same printf format string.

Ok, fair enough. I'll let Catalin pick this up for 3.18.

Will

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-10-28 13:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-10-28  5:44 [PATCH] arm64: ARCH_PFN_OFFSET should be unsigned long Neil Zhang
2014-10-28 12:36 ` Will Deacon
2014-10-28 12:51   ` Arnd Bergmann
2014-10-28 13:36     ` Will Deacon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).