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

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 <vladimir.oltean@nxp.com>
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20241021174935.57658-3-florian.fainelli@broadcom.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Florian Fainelli and committed by
Jakub Kicinski
e69fbd28 890bde75

+23 -22
-22
drivers/net/ethernet/broadcom/bcmsysport.c
··· 27 27 28 28 #include "bcmsysport.h" 29 29 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 - 52 30 /* On SYSTEMPORT Lite, any register after RDMA_STATUS has the exact 53 31 * same layout, except it has been moved by 4 bytes up, *sigh* 54 32 */
+23
drivers/net/ethernet/broadcom/bcmsysport.h
··· 773 773 struct bcm_sysport_tx_ring *ring_map[DSA_MAX_PORTS * 8]; 774 774 775 775 }; 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 + 776 799 #endif /* __BCM_SYSPORT_H */