• Sam Ravnborg's avatar
    sparc64: fix warnings in psycho_common after ull conversion · e8dc7c48
    Sam Ravnborg authored
    After conversion to use unsigned long long for u64
    I saw following warnings:
    
      CC      arch/sparc/kernel/psycho_common.o
    arch/sparc/kernel/psycho_common.c: In function `psycho_check_stc_error':
    arch/sparc/kernel/psycho_common.c:104: warning: long long unsigned int format, long unsigned int arg (arg 4)
    arch/sparc/kernel/psycho_common.c:104: warning: long long unsigned int format, long unsigned int arg (arg 5)
    arch/sparc/kernel/psycho_common.c:114: warning: long long unsigned int format, long unsigned int arg (arg 4)
    arch/sparc/kernel/psycho_common.c:114: warning: long long unsigned int format, long unsigned int arg (arg 5)
    arch/sparc/kernel/psycho_common.c:114: warning: long long unsigned int format, long unsigned int arg (arg 6)
    arch/sparc/kernel/psycho_common.c:114: warning: long long unsigned int format, long unsigned int arg (arg 7)
    arch/sparc/kernel/psycho_common.c: In function `psycho_dump_iommu_tags_and_data':
    arch/sparc/kernel/psycho_common.c:187: warning: long long unsigned int format, long unsigned int arg (arg 8)
    arch/sparc/kernel/psycho_common.c:193: warning: long long unsigned int format, long unsigned int arg (arg 6)
    arch/sparc/kernel/psycho_common.c: In function `psycho_pcierr_intr':
    arch/sparc/kernel/psycho_common.c:333: warning: long long unsigned int format, long unsigned int arg (arg 3)
    arch/sparc/kernel/psycho_common.c:333: warning: long long unsigned int format, long unsigned int arg (arg 4)
    
    This is due to different integer promotion in my 32 bit hosted gcc.
    The fix is to force a few constants to ULL.
    
    The following stands out from the rest:
    +#define  PSYCHO_IOMMU_TAG_VPAGE         0x7ffffULL
    +#define  PSYCHO_IOMMU_DATA_PPAGE 0xfffffffULL
    
    They were needed otherwise the expression:
    
        (data_val & PSYCHO_IOMMU_DATA_PPAGE) << IOMMU_PAGE_SHIFT)
    
    were promoted to a unsigned long and not a unsigned long long as expected.
    
    I tried the alternative solution and made IOMMU_PAGE_SHIFT an ULL but that did not help.
    The only way gcc would make this expression an unsigned long long was to
    define PSYCHO_IOMMU_DATA_PPAGE as ULL. The alternative to add a cast was
    not considered a valid solution.
    
    We had this issue in two places and this were the only places the above
    two constants are used.
    
    A small coding style diff sneaked in too. 
    Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    e8dc7c48
psycho_common.c 14.2 KB