• Geert Uytterhoeven's avatar
    staging: octeon: Use "(uintptr_t)" to cast from pointer to int · 7d4dea95
    Geert Uytterhoeven authored
    On 32-bit:
    
        In file included from drivers/staging/octeon/octeon-ethernet.h:41,
    		     from drivers/staging/octeon/ethernet-tx.c:25:
        drivers/staging/octeon/octeon-stubs.h: In function ‘cvmx_phys_to_ptr’:
        drivers/staging/octeon/octeon-stubs.h:1205:9: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
          return (void *)(physical_address);
    	     ^
        drivers/staging/octeon/ethernet-tx.c: In function ‘cvm_oct_xmit’:
        drivers/staging/octeon/ethernet-tx.c:264:37: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
           hw_buffer.s.addr = XKPHYS_TO_PHYS((u64)skb->data);
    					 ^
        drivers/staging/octeon/octeon-stubs.h:2:30: note: in definition of macro ‘XKPHYS_TO_PHYS’
         #define XKPHYS_TO_PHYS(p)   (p)
    				  ^
        drivers/staging/octeon/ethernet-tx.c:268:37: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
           hw_buffer.s.addr = XKPHYS_TO_PHYS((u64)skb->data);
    					 ^
        drivers/staging/octeon/octeon-stubs.h:2:30: note: in definition of macro ‘XKPHYS_TO_PHYS’
         #define XKPHYS_TO_PHYS(p)   (p)
    				  ^
        drivers/staging/octeon/ethernet-tx.c:276:20: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    	 XKPHYS_TO_PHYS((u64)skb_frag_address(fs));
    			^
        drivers/staging/octeon/octeon-stubs.h:2:30: note: in definition of macro ‘XKPHYS_TO_PHYS’
         #define XKPHYS_TO_PHYS(p)   (p)
    				  ^
        drivers/staging/octeon/ethernet-tx.c:280:37: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
           hw_buffer.s.addr = XKPHYS_TO_PHYS((u64)CVM_OCT_SKB_CB(skb));
    					 ^
        drivers/staging/octeon/octeon-stubs.h:2:30: note: in definition of macro ‘XKPHYS_TO_PHYS’
         #define XKPHYS_TO_PHYS(p)   (p)
    				  ^
    
    Fix this by replacing casts to "u64" by casts to "uintptr_t", which is
    either 32-bit or 64-bit, and adding an intermediate cast to "uintptr_t"
    where needed.
    
    Exposed by commit 171a9bae ("staging/octeon: Allow test build on
    !MIPS").
    Signed-off-by: default avatarGeert Uytterhoeven <geert@linux-m68k.org>
    Link: https://lore.kernel.org/r/20190919095022.29099-1-geert@linux-m68k.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    7d4dea95
octeon-stubs.h 30.6 KB