Commit b49d81ded47e9d01f7128fce50d224ccc2150960
Committed by
Kumar Gala
1 parent
b2e0861e51
Exists in
master
and in
7 other branches
powerpc: fix warning when compiling immap_qe.h
Fix the warnings genereted by arch/powerpc/include/asm/immap_qe.h when CONFIG_PHYS_ADDR_T_64BIT is defined: immap_qe.h: In function 'immrbar_virt_to_phys': immap_qe.h:472:8: warning: cast from pointer to integer of different size immap_qe.h:472:24: warning: cast from pointer to integer of different size immap_qe.h:473:5: warning: cast from pointer to integer of different size immap_qe.h:473:21: warning: cast from pointer to integer of different size immap_qe.h:474:36: warning: cast from pointer to integer of different size Note that the QE does not support 36-bit physical addresses, so even when CONFIG_PHYS_ADDR_T_64BIT is defined, the QE MURAM must be located below the 4GB boundary. Signed-off-by: Timur Tabi <timur@freescale.com> Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Showing 1 changed file with 15 additions and 6 deletions Side-by-side Diff
arch/powerpc/include/asm/immap_qe.h
... | ... | @@ -467,13 +467,22 @@ |
467 | 467 | extern struct qe_immap __iomem *qe_immr; |
468 | 468 | extern phys_addr_t get_qe_base(void); |
469 | 469 | |
470 | -static inline unsigned long immrbar_virt_to_phys(void *address) | |
470 | +/* | |
471 | + * Returns the offset within the QE address space of the given pointer. | |
472 | + * | |
473 | + * Note that the QE does not support 36-bit physical addresses, so if | |
474 | + * get_qe_base() returns a number above 4GB, the caller will probably fail. | |
475 | + */ | |
476 | +static inline phys_addr_t immrbar_virt_to_phys(void *address) | |
471 | 477 | { |
472 | - if ( ((u32)address >= (u32)qe_immr) && | |
473 | - ((u32)address < ((u32)qe_immr + QE_IMMAP_SIZE)) ) | |
474 | - return (unsigned long)(address - (u32)qe_immr + | |
475 | - (u32)get_qe_base()); | |
476 | - return (unsigned long)virt_to_phys(address); | |
478 | + void *q = (void *)qe_immr; | |
479 | + | |
480 | + /* Is it a MURAM address? */ | |
481 | + if ((address >= q) && (address < (q + QE_IMMAP_SIZE))) | |
482 | + return get_qe_base() + (address - q); | |
483 | + | |
484 | + /* It's an address returned by kmalloc */ | |
485 | + return virt_to_phys(address); | |
477 | 486 | } |
478 | 487 | |
479 | 488 | #endif /* __KERNEL__ */ |