]> git.dujemihanovic.xyz Git - linux.git/commitdiff
net: ibm: emac: Use __iomem annotation for emac_[xg]aht_base
authorSimon Horman <horms@kernel.org>
Fri, 6 Sep 2024 07:36:09 +0000 (08:36 +0100)
committerJakub Kicinski <kuba@kernel.org>
Tue, 10 Sep 2024 00:42:01 +0000 (17:42 -0700)
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>
drivers/net/ethernet/ibm/emac/core.c
drivers/net/ethernet/ibm/emac/core.h

index a19d098f2e2bf9ad0ea028eb2974a4114d9552ae..6ace558371726609cd8d7d2040b2d20e522fcfca 100644 (file)
@@ -418,8 +418,8 @@ do_retry:
 
 static void emac_hash_mc(struct emac_instance *dev)
 {
+       u32 __iomem *gaht_base = emac_gaht_base(dev);
        const int regs = EMAC_XAHT_REGS(dev);
-       u32 *gaht_base = emac_gaht_base(dev);
        u32 gaht_temp[EMAC_XAHT_MAX_REGS];
        struct netdev_hw_addr *ha;
        int i;
index 295516b07662668e4aac1bd8c5bf09bbba11c35b..d8664bd65e1f9d207339306673f1ab84f4849531 100644 (file)
@@ -400,7 +400,7 @@ static inline int emac_has_feature(struct emac_instance *dev,
        ((u32)(1 << (EMAC_XAHT_WIDTH(dev) - 1)) >>      \
         ((slot) & (u32)(EMAC_XAHT_WIDTH(dev) - 1)))
 
-static inline u32 *emac_xaht_base(struct emac_instance *dev)
+static inline u32 __iomem *emac_xaht_base(struct emac_instance *dev)
 {
        struct emac_regs __iomem *p = dev->emacp;
        int offset;
@@ -413,10 +413,10 @@ static inline u32 *emac_xaht_base(struct emac_instance *dev)
        else
                offset = offsetof(struct emac_regs, u0.emac4.iaht1);
 
-       return (u32 *)((ptrdiff_t)p + offset);
+       return (u32 __iomem *)((__force ptrdiff_t)p + offset);
 }
 
-static inline u32 *emac_gaht_base(struct emac_instance *dev)
+static inline u32 __iomem *emac_gaht_base(struct emac_instance *dev)
 {
        /* GAHT registers always come after an identical number of
         * IAHT registers.