linux/drivers/net/ethernet/freescale/fs_enet
Christophe Leroy c146f3d191 net: fs_enet: Fix warning due to wrong type
Building fs_enet on powerpc e500 leads to following warning:

    CC      drivers/net/ethernet/freescale/fs_enet/mac-scc.o
  In file included from ./include/linux/build_bug.h:5,
                   from ./include/linux/container_of.h:5,
                   from ./include/linux/list.h:5,
                   from ./include/linux/module.h:12,
                   from drivers/net/ethernet/freescale/fs_enet/mac-scc.c:15:
  drivers/net/ethernet/freescale/fs_enet/mac-scc.c: In function 'allocate_bd':
  ./include/linux/err.h:28:49: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast]
     28 | #define IS_ERR_VALUE(x) unlikely((unsigned long)(void *)(x) >= (unsigned long)-MAX_ERRNO)
        |                                                 ^
  ./include/linux/compiler.h:77:45: note: in definition of macro 'unlikely'
     77 | # define unlikely(x)    __builtin_expect(!!(x), 0)
        |                                             ^
  drivers/net/ethernet/freescale/fs_enet/mac-scc.c:138:13: note: in expansion of macro 'IS_ERR_VALUE'
    138 |         if (IS_ERR_VALUE(fep->ring_mem_addr))
        |             ^~~~~~~~~~~~

This is due to fep->ring_mem_addr not being a pointer but a DMA
address which is 64 bits on that platform while pointers are
32 bits as this is a 32 bits platform with wider physical bus.

However, using fep->ring_mem_addr is just wrong because
cpm_muram_alloc() returns an offset within the muram and not
a physical address directly. So use fpi->dpram_offset instead.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/ec67ea3a3bef7e58b8dc959f7c17d405af0d27e4.1723101144.git.christophe.leroy@csgroup.eu
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2024-08-09 22:08:16 -07:00
..
Kconfig
Makefile
fec.h
fs_enet-main.c net: ethernet: Use device_get_match_data() 2023-10-13 10:04:53 +01:00
fs_enet.h powerpc updates for 6.6 2023-08-31 12:43:10 -07:00
mac-fcc.c powerpc updates for 6.6 2023-08-31 12:43:10 -07:00
mac-fec.c net: fs_enet: Remove has_phy field in fs_platform_info struct 2023-08-08 15:01:29 -07:00
mac-scc.c net: fs_enet: Fix warning due to wrong type 2024-08-09 22:08:16 -07:00
mii-bitbang.c net: fs_enet: Fix address space and base types mismatches 2023-08-08 15:01:29 -07:00
mii-fec.c net: ethernet: Use device_get_match_data() 2023-10-13 10:04:53 +01:00