Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

net: ibm: emac: Use __iomem annotation for emac_[xg]aht_base

dev->emacp contains an __iomem pointer and values derived
from it are used as __iomem pointers. So use this annotation
in the return type for helpers that derive pointers from dev->emacp.

Flagged by Sparse as:

.../core.c:444:36: warning: incorrect type in argument 1 (different address spaces)
.../core.c:444:36: expected unsigned int volatile [noderef] [usertype] __iomem *addr
.../core.c:444:36: got unsigned int [usertype] *
.../core.c: note: in included file:
.../core.h:416:25: warning: cast removes address space '__iomem' of expression

Compile tested only.
No functional change intended.

Signed-off-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20240906-emac-iomem-v1-1-207cc4f3fed0@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Simon Horman and committed by
Jakub Kicinski
5aa3b55b ae18d300

+4 -4
+1 -1
drivers/net/ethernet/ibm/emac/core.c
··· 418 418 419 419 static void emac_hash_mc(struct emac_instance *dev) 420 420 { 421 + u32 __iomem *gaht_base = emac_gaht_base(dev); 421 422 const int regs = EMAC_XAHT_REGS(dev); 422 - u32 *gaht_base = emac_gaht_base(dev); 423 423 u32 gaht_temp[EMAC_XAHT_MAX_REGS]; 424 424 struct netdev_hw_addr *ha; 425 425 int i;
+3 -3
drivers/net/ethernet/ibm/emac/core.h
··· 400 400 ((u32)(1 << (EMAC_XAHT_WIDTH(dev) - 1)) >> \ 401 401 ((slot) & (u32)(EMAC_XAHT_WIDTH(dev) - 1))) 402 402 403 - static inline u32 *emac_xaht_base(struct emac_instance *dev) 403 + static inline u32 __iomem *emac_xaht_base(struct emac_instance *dev) 404 404 { 405 405 struct emac_regs __iomem *p = dev->emacp; 406 406 int offset; ··· 413 413 else 414 414 offset = offsetof(struct emac_regs, u0.emac4.iaht1); 415 415 416 - return (u32 *)((ptrdiff_t)p + offset); 416 + return (u32 __iomem *)((__force ptrdiff_t)p + offset); 417 417 } 418 418 419 - static inline u32 *emac_gaht_base(struct emac_instance *dev) 419 + static inline u32 __iomem *emac_gaht_base(struct emac_instance *dev) 420 420 { 421 421 /* GAHT registers always come after an identical number of 422 422 * IAHT registers.