Skip to content

Commit 0114fcd

Browse files
ffainelliNipaLocal
authored and
NipaLocal
committed
net: systemport: Move IO macros to header file
Move the BCM_SYSPORT_IO_MACRO() definition and its use to bcmsysport.h where it is more appropriate and where static inline helpers are acceptable. While at it, make sure that the macro 'offset' argument does not trigger a checkpatch warning due to possible argument re-use. Suggested-by: Vladimir Oltean <[email protected]> Signed-off-by: Florian Fainelli <[email protected]> Reviewed-by: Simon Horman <[email protected]> Signed-off-by: NipaLocal <nipa@local>
1 parent 1d930d5 commit 0114fcd

File tree

2 files changed

+23
-22
lines changed

2 files changed

+23
-22
lines changed

drivers/net/ethernet/broadcom/bcmsysport.c

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -27,28 +27,6 @@
2727

2828
#include "bcmsysport.h"
2929

30-
/* I/O accessors register helpers */
31-
#define BCM_SYSPORT_IO_MACRO(name, offset) \
32-
static inline u32 name##_readl(struct bcm_sysport_priv *priv, u32 off) \
33-
{ \
34-
u32 reg = readl_relaxed(priv->base + offset + off); \
35-
return reg; \
36-
} \
37-
static inline void name##_writel(struct bcm_sysport_priv *priv, \
38-
u32 val, u32 off) \
39-
{ \
40-
writel_relaxed(val, priv->base + offset + off); \
41-
} \
42-
43-
BCM_SYSPORT_IO_MACRO(intrl2_0, SYS_PORT_INTRL2_0_OFFSET);
44-
BCM_SYSPORT_IO_MACRO(intrl2_1, SYS_PORT_INTRL2_1_OFFSET);
45-
BCM_SYSPORT_IO_MACRO(umac, SYS_PORT_UMAC_OFFSET);
46-
BCM_SYSPORT_IO_MACRO(gib, SYS_PORT_GIB_OFFSET);
47-
BCM_SYSPORT_IO_MACRO(tdma, SYS_PORT_TDMA_OFFSET);
48-
BCM_SYSPORT_IO_MACRO(rxchk, SYS_PORT_RXCHK_OFFSET);
49-
BCM_SYSPORT_IO_MACRO(rbuf, SYS_PORT_RBUF_OFFSET);
50-
BCM_SYSPORT_IO_MACRO(topctrl, SYS_PORT_TOPCTRL_OFFSET);
51-
5230
/* On SYSTEMPORT Lite, any register after RDMA_STATUS has the exact
5331
* same layout, except it has been moved by 4 bytes up, *sigh*
5432
*/

drivers/net/ethernet/broadcom/bcmsysport.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -773,4 +773,27 @@ struct bcm_sysport_priv {
773773
struct bcm_sysport_tx_ring *ring_map[DSA_MAX_PORTS * 8];
774774

775775
};
776+
777+
/* I/O accessors register helpers */
778+
#define BCM_SYSPORT_IO_MACRO(name, offset) \
779+
static inline u32 name##_readl(struct bcm_sysport_priv *priv, u32 off) \
780+
{ \
781+
u32 reg = readl_relaxed(priv->base + (offset) + off); \
782+
return reg; \
783+
} \
784+
static inline void name##_writel(struct bcm_sysport_priv *priv, \
785+
u32 val, u32 off) \
786+
{ \
787+
writel_relaxed(val, priv->base + (offset) + off); \
788+
} \
789+
790+
BCM_SYSPORT_IO_MACRO(intrl2_0, SYS_PORT_INTRL2_0_OFFSET);
791+
BCM_SYSPORT_IO_MACRO(intrl2_1, SYS_PORT_INTRL2_1_OFFSET);
792+
BCM_SYSPORT_IO_MACRO(umac, SYS_PORT_UMAC_OFFSET);
793+
BCM_SYSPORT_IO_MACRO(gib, SYS_PORT_GIB_OFFSET);
794+
BCM_SYSPORT_IO_MACRO(tdma, SYS_PORT_TDMA_OFFSET);
795+
BCM_SYSPORT_IO_MACRO(rxchk, SYS_PORT_RXCHK_OFFSET);
796+
BCM_SYSPORT_IO_MACRO(rbuf, SYS_PORT_RBUF_OFFSET);
797+
BCM_SYSPORT_IO_MACRO(topctrl, SYS_PORT_TOPCTRL_OFFSET);
798+
776799
#endif /* __BCM_SYSPORT_H */

0 commit comments

Comments
 (0)