net: stmmac: Move extern declarations from common.h to hwif.h
Subsystems (4)
PATCH 1/1 net: stmmac: Move extern declarations from common.h to hwif.h
These extern declarations are referenced in hwif.c only. Move them to hwif.h just like the other extern declarations.
Compile tested only.
No functional change intended.
--- drivers/net/ethernet/stmicro/stmmac/common.h | 14 -------------- drivers/net/ethernet/stmicro/stmmac/hwif.h | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 14 deletions(-)
drivers/net/ethernet/stmicro/stmmac/common.h +0 -14
@@ -543,18 +543,8 @@ struct dma_features {#define STMMAC_VLAN_INSERT 0x2#define STMMAC_VLAN_REPLACE 0x3 -extern const struct stmmac_desc_ops enh_desc_ops; -extern const struct stmmac_desc_ops ndesc_ops; -struct mac_device_info ; -extern const struct stmmac_hwtimestamp stmmac_ptp; -extern const struct stmmac_hwtimestamp dwmac1000_ptp; -extern const struct stmmac_mode_ops dwmac4_ring_mode_ops; - -extern const struct ptp_clock_info stmmac_ptp_clock_ops; -extern const struct ptp_clock_info dwmac1000_ptp_clock_ops; -struct mac_link {u32 caps;u32 speed_mask;
@@ -641,8 +631,4 @@ void stmmac_dwmac4_set_mac(void __iomem *ioaddr, bool enable);void dwmac_dma_flush_tx_fifo (void __iomem *ioaddr); -extern const struct stmmac_mode_ops ring_mode_ops; -extern const struct stmmac_mode_ops chain_mode_ops; -extern const struct stmmac_desc_ops dwmac4_desc_ops; -#endif /* __COMMON_H__ */
drivers/net/ethernet/stmicro/stmmac/hwif.h +14 -0
@@ -665,6 +665,20 @@ struct stmmac_regs_off {u32 est_off; }; +extern const struct stmmac_desc_ops ndesc_ops; +extern const struct stmmac_desc_ops enh_desc_ops; +extern const struct stmmac_desc_ops dwmac4_desc_ops; + +extern const struct stmmac_hwtimestamp stmmac_ptp; +extern const struct stmmac_hwtimestamp dwmac1000_ptp; + +extern const struct ptp_clock_info stmmac_ptp_clock_ops; +extern const struct ptp_clock_info dwmac1000_ptp_clock_ops; + +extern const struct stmmac_mode_ops ring_mode_ops; +extern const struct stmmac_mode_ops chain_mode_ops; +extern const struct stmmac_mode_ops dwmac4_ring_mode_ops; +extern const struct stmmac_ops dwmac100_ops;extern const struct stmmac_dma_ops dwmac100_dma_ops;extern const struct stmmac_ops dwmac1000_ops;
Signature · 1 line
2.34.1
Quoted 2 lines · Furong Xu
These extern declarations are referenced in
hwif.conly. Move them tohwif.hjust like the other extern declarations.
We normally have declarations in a header file that corresponds to their definition, rather than where they are used.
Quoted 14 lines
Compile tested only.
No functional change intended.Signed-off-by Furong Xu <[email protected]>--- drivers/net/ethernet/stmicro/stmmac/common.h | 14 -------------- drivers/net/ethernet/stmicro/stmmac/hwif.h | 14 ++++++++++++++ 2 files changed, 14 insertions(+), 14 deletions(-)drivers/net/ethernet/stmicro/stmmac/common.h +0
-0
drivers/net/ethernet/stmicro/stmmac/common.h struct dma_features { · line 546
Quoted 4 lines
drivers/net/ethernet/stmicro/stmmac/common.h +0
-1@@ -543,18 +543,8 @@ struct dma_features {#define STMMAC_VLAN_INSERT 0x2#define STMMAC_VLAN_REPLACE 0x3 -extern const struct stmmac_desc_ops enh_desc_ops;
Defined in enh_desc.c, but no header for it, so either common.h or hwif.h seems sensible.
drivers/net/ethernet/stmicro/stmmac/common.h struct dma_features { · line 547
Quoted 1 line
drivers/net/ethernet/stmicro/stmmac/common.h +0
-1-extern const struct stmmac_desc_ops ndesc_ops;
Defined in norm_desc.c, same situation as previous one.
drivers/net/ethernet/stmicro/stmmac/common.h struct dma_features { · line 551
Quoted 4 lines
drivers/net/ethernet/stmicro/stmmac/common.h +0
-2-struct mac_device_info ; -extern const struct stmmac_hwtimestamp stmmac_ptp;
Defined in stmmac_hwtstamp.c, same as above.
drivers/net/ethernet/stmicro/stmmac/common.h struct dma_features { · line 552
Quoted 1 line
drivers/net/ethernet/stmicro/stmmac/common.h +0
-1-extern const struct stmmac_hwtimestamp dwmac1000_ptp;
Ditto.
drivers/net/ethernet/stmicro/stmmac/common.h struct dma_features { · line 553
Quoted 1 line
drivers/net/ethernet/stmicro/stmmac/common.h +0
-1-extern const struct stmmac_mode_ops dwmac4_ring_mode_ops;
Defined in dwmac4_descs.c, maybe dwmac4_descs.h or dwmac4.h would make more sense than hwif.c ?
drivers/net/ethernet/stmicro/stmmac/common.h struct dma_features { · line 555
Quoted 2 lines
drivers/net/ethernet/stmicro/stmmac/common.h +0
-2- -extern const struct ptp_clock_info stmmac_ptp_clock_ops;
Defined in stmmac_ptp.c, and there is stmmac_ptp.h which contains a number of function declarations, so maybe moving that there would make more sense?
drivers/net/ethernet/stmicro/stmmac/common.h struct dma_features { · line 556
Quoted 1 line
drivers/net/ethernet/stmicro/stmmac/common.h +0
-1-extern const struct ptp_clock_info dwmac1000_ptp_clock_ops;
Same as stmmac_ptp_clock_ops.
drivers/net/ethernet/stmicro/stmmac/common.h void stmmac_dwmac4_set_mac(void __iomem *ioaddr, bool enable); · line 644
Quoted 9 lines
drivers/net/ethernet/stmicro/stmmac/common.h +0
-2-struct mac_link {u32 caps;u32 speed_mask;@@ -641,8 +631,4 @@ void stmmac_dwmac4_set_mac(void __iomem *ioaddr, bool enable);void dwmac_dma_flush_tx_fifo (void __iomem *ioaddr); -extern const struct stmmac_mode_ops ring_mode_ops;
Defined in ring_mode.c, same as enh_desc_ops.
drivers/net/ethernet/stmicro/stmmac/common.h void stmmac_dwmac4_set_mac(void __iomem *ioaddr, bool enable); · line 645
Quoted 1 line
drivers/net/ethernet/stmicro/stmmac/common.h +0
-1-extern const struct stmmac_mode_ops chain_mode_ops;
Defined in chain_mode.c, same as enh_desc_ops.
drivers/net/ethernet/stmicro/stmmac/common.h void stmmac_dwmac4_set_mac(void __iomem *ioaddr, bool enable); · line 646
Quoted 1 line
drivers/net/ethernet/stmicro/stmmac/common.h +0
-1-extern const struct stmmac_desc_ops dwmac4_desc_ops;
Defined in dwmac4_descs.c, similar situation to dwmac4_ring_mode_ops above.
So I think rather than bulk moving these to hwif.h, where some of them remain out of place, maybe placing some in a more appropriate header would be better.
Signature · 2 lines
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
Quoted 5 lines · Russell King (Oracle)
So I think rather than bulk moving these to
hwif.h, where some of them remain out of place, maybe placing some in a more appropriate header would be better.
Totally agree.
I am going to rework this patch into a bigger one.
pw-bot: changes-requested