Commit becce4a4 authored by Mark Einon's avatar Mark Einon Committed by Greg Kroah-Hartman

staging: et131x: Use for loop to initialise contiguous macstat registers to zero

Replace a long list of contiguous writel() calls with a for loop iterating
over the same address values.

Also remove redundant comments on the macstat registers, the variable names
are good enough.
Signed-off-by: default avatarMark Einon <mark.einon@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6697b870
...@@ -1257,60 +1257,13 @@ static void et1310_config_txmac_regs(struct et131x_adapter *adapter) ...@@ -1257,60 +1257,13 @@ static void et1310_config_txmac_regs(struct et131x_adapter *adapter)
static void et1310_config_macstat_regs(struct et131x_adapter *adapter) static void et1310_config_macstat_regs(struct et131x_adapter *adapter)
{ {
struct macstat_regs __iomem *macstat = struct macstat_regs __iomem *macstat = &adapter->regs->macstat;
&adapter->regs->macstat; u32 *reg;
/* Next we need to initialize all the macstat registers to zero on /* initialize all the macstat registers to zero on the device */
* the device. for (reg = &macstat->txrx_0_64_byte_frames;
*/ reg <= &macstat->carry_reg2; reg++)
writel(0, &macstat->txrx_0_64_byte_frames); writel(0, reg);
writel(0, &macstat->txrx_65_127_byte_frames);
writel(0, &macstat->txrx_128_255_byte_frames);
writel(0, &macstat->txrx_256_511_byte_frames);
writel(0, &macstat->txrx_512_1023_byte_frames);
writel(0, &macstat->txrx_1024_1518_byte_frames);
writel(0, &macstat->txrx_1519_1522_gvln_frames);
writel(0, &macstat->rx_bytes);
writel(0, &macstat->rx_packets);
writel(0, &macstat->rx_fcs_errs);
writel(0, &macstat->rx_multicast_packets);
writel(0, &macstat->rx_broadcast_packets);
writel(0, &macstat->rx_control_frames);
writel(0, &macstat->rx_pause_frames);
writel(0, &macstat->rx_unknown_opcodes);
writel(0, &macstat->rx_align_errs);
writel(0, &macstat->rx_frame_len_errs);
writel(0, &macstat->rx_code_errs);
writel(0, &macstat->rx_carrier_sense_errs);
writel(0, &macstat->rx_undersize_packets);
writel(0, &macstat->rx_oversize_packets);
writel(0, &macstat->rx_fragment_packets);
writel(0, &macstat->rx_jabbers);
writel(0, &macstat->rx_drops);
writel(0, &macstat->tx_bytes);
writel(0, &macstat->tx_packets);
writel(0, &macstat->tx_multicast_packets);
writel(0, &macstat->tx_broadcast_packets);
writel(0, &macstat->tx_pause_frames);
writel(0, &macstat->tx_deferred);
writel(0, &macstat->tx_excessive_deferred);
writel(0, &macstat->tx_single_collisions);
writel(0, &macstat->tx_multiple_collisions);
writel(0, &macstat->tx_late_collisions);
writel(0, &macstat->tx_excessive_collisions);
writel(0, &macstat->tx_total_collisions);
writel(0, &macstat->tx_pause_honored_frames);
writel(0, &macstat->tx_drops);
writel(0, &macstat->tx_jabbers);
writel(0, &macstat->tx_fcs_errs);
writel(0, &macstat->tx_control_frames);
writel(0, &macstat->tx_oversize_frames);
writel(0, &macstat->tx_undersize_frames);
writel(0, &macstat->tx_fragments);
writel(0, &macstat->carry_reg1);
writel(0, &macstat->carry_reg2);
/* Unmask any counters that we want to track the overflow of. /* Unmask any counters that we want to track the overflow of.
* Initially this will be all counters. It may become clear later * Initially this will be all counters. It may become clear later
......
...@@ -1259,148 +1259,54 @@ struct mac_regs { /* Location: */ ...@@ -1259,148 +1259,54 @@ struct mac_regs { /* Location: */
struct macstat_regs { /* Location: */ struct macstat_regs { /* Location: */
u32 pad[32]; /* 0x6000 - 607C */ u32 pad[32]; /* 0x6000 - 607C */
/* Tx/Rx 0-64 Byte Frame Counter */ /* counters */
u32 txrx_0_64_byte_frames; /* 0x6080 */ u32 txrx_0_64_byte_frames; /* 0x6080 */
/* Tx/Rx 65-127 Byte Frame Counter */
u32 txrx_65_127_byte_frames; /* 0x6084 */ u32 txrx_65_127_byte_frames; /* 0x6084 */
/* Tx/Rx 128-255 Byte Frame Counter */
u32 txrx_128_255_byte_frames; /* 0x6088 */ u32 txrx_128_255_byte_frames; /* 0x6088 */
/* Tx/Rx 256-511 Byte Frame Counter */
u32 txrx_256_511_byte_frames; /* 0x608C */ u32 txrx_256_511_byte_frames; /* 0x608C */
/* Tx/Rx 512-1023 Byte Frame Counter */
u32 txrx_512_1023_byte_frames; /* 0x6090 */ u32 txrx_512_1023_byte_frames; /* 0x6090 */
/* Tx/Rx 1024-1518 Byte Frame Counter */
u32 txrx_1024_1518_byte_frames; /* 0x6094 */ u32 txrx_1024_1518_byte_frames; /* 0x6094 */
/* Tx/Rx 1519-1522 Byte Good VLAN Frame Count */
u32 txrx_1519_1522_gvln_frames; /* 0x6098 */ u32 txrx_1519_1522_gvln_frames; /* 0x6098 */
/* Rx Byte Counter */
u32 rx_bytes; /* 0x609C */ u32 rx_bytes; /* 0x609C */
/* Rx Packet Counter */
u32 rx_packets; /* 0x60A0 */ u32 rx_packets; /* 0x60A0 */
/* Rx FCS Error Counter */
u32 rx_fcs_errs; /* 0x60A4 */ u32 rx_fcs_errs; /* 0x60A4 */
/* Rx Multicast Packet Counter */
u32 rx_multicast_packets; /* 0x60A8 */ u32 rx_multicast_packets; /* 0x60A8 */
/* Rx Broadcast Packet Counter */
u32 rx_broadcast_packets; /* 0x60AC */ u32 rx_broadcast_packets; /* 0x60AC */
/* Rx Control Frame Packet Counter */
u32 rx_control_frames; /* 0x60B0 */ u32 rx_control_frames; /* 0x60B0 */
/* Rx Pause Frame Packet Counter */
u32 rx_pause_frames; /* 0x60B4 */ u32 rx_pause_frames; /* 0x60B4 */
/* Rx Unknown OP Code Counter */
u32 rx_unknown_opcodes; /* 0x60B8 */ u32 rx_unknown_opcodes; /* 0x60B8 */
/* Rx Alignment Error Counter */
u32 rx_align_errs; /* 0x60BC */ u32 rx_align_errs; /* 0x60BC */
/* Rx Frame Length Error Counter */
u32 rx_frame_len_errs; /* 0x60C0 */ u32 rx_frame_len_errs; /* 0x60C0 */
/* Rx Code Error Counter */
u32 rx_code_errs; /* 0x60C4 */ u32 rx_code_errs; /* 0x60C4 */
/* Rx Carrier Sense Error Counter */
u32 rx_carrier_sense_errs; /* 0x60C8 */ u32 rx_carrier_sense_errs; /* 0x60C8 */
/* Rx Undersize Packet Counter */
u32 rx_undersize_packets; /* 0x60CC */ u32 rx_undersize_packets; /* 0x60CC */
/* Rx Oversize Packet Counter */
u32 rx_oversize_packets; /* 0x60D0 */ u32 rx_oversize_packets; /* 0x60D0 */
/* Rx Fragment Counter */
u32 rx_fragment_packets; /* 0x60D4 */ u32 rx_fragment_packets; /* 0x60D4 */
/* Rx Jabber Counter */
u32 rx_jabbers; /* 0x60D8 */ u32 rx_jabbers; /* 0x60D8 */
/* Rx Drop */
u32 rx_drops; /* 0x60DC */ u32 rx_drops; /* 0x60DC */
/* Tx Byte Counter */
u32 tx_bytes; /* 0x60E0 */ u32 tx_bytes; /* 0x60E0 */
/* Tx Packet Counter */
u32 tx_packets; /* 0x60E4 */ u32 tx_packets; /* 0x60E4 */
/* Tx Multicast Packet Counter */
u32 tx_multicast_packets; /* 0x60E8 */ u32 tx_multicast_packets; /* 0x60E8 */
/* Tx Broadcast Packet Counter */
u32 tx_broadcast_packets; /* 0x60EC */ u32 tx_broadcast_packets; /* 0x60EC */
/* Tx Pause Control Frame Counter */
u32 tx_pause_frames; /* 0x60F0 */ u32 tx_pause_frames; /* 0x60F0 */
/* Tx Deferral Packet Counter */
u32 tx_deferred; /* 0x60F4 */ u32 tx_deferred; /* 0x60F4 */
/* Tx Excessive Deferral Packet Counter */
u32 tx_excessive_deferred; /* 0x60F8 */ u32 tx_excessive_deferred; /* 0x60F8 */
/* Tx Single Collision Packet Counter */
u32 tx_single_collisions; /* 0x60FC */ u32 tx_single_collisions; /* 0x60FC */
/* Tx Multiple Collision Packet Counter */
u32 tx_multiple_collisions; /* 0x6100 */ u32 tx_multiple_collisions; /* 0x6100 */
/* Tx Late Collision Packet Counter */
u32 tx_late_collisions; /* 0x6104 */ u32 tx_late_collisions; /* 0x6104 */
/* Tx Excessive Collision Packet Counter */
u32 tx_excessive_collisions; /* 0x6108 */ u32 tx_excessive_collisions; /* 0x6108 */
/* Tx Total Collision Packet Counter */
u32 tx_total_collisions; /* 0x610C */ u32 tx_total_collisions; /* 0x610C */
/* Tx Pause Frame Honored Counter */
u32 tx_pause_honored_frames; /* 0x6110 */ u32 tx_pause_honored_frames; /* 0x6110 */
/* Tx Drop Frame Counter */
u32 tx_drops; /* 0x6114 */ u32 tx_drops; /* 0x6114 */
/* Tx Jabber Frame Counter */
u32 tx_jabbers; /* 0x6118 */ u32 tx_jabbers; /* 0x6118 */
/* Tx FCS Error Counter */
u32 tx_fcs_errs; /* 0x611C */ u32 tx_fcs_errs; /* 0x611C */
/* Tx Control Frame Counter */
u32 tx_control_frames; /* 0x6120 */ u32 tx_control_frames; /* 0x6120 */
/* Tx Oversize Frame Counter */
u32 tx_oversize_frames; /* 0x6124 */ u32 tx_oversize_frames; /* 0x6124 */
/* Tx Undersize Frame Counter */
u32 tx_undersize_frames; /* 0x6128 */ u32 tx_undersize_frames; /* 0x6128 */
/* Tx Fragments Frame Counter */
u32 tx_fragments; /* 0x612C */ u32 tx_fragments; /* 0x612C */
/* Carry Register One Register */
u32 carry_reg1; /* 0x6130 */ u32 carry_reg1; /* 0x6130 */
/* Carry Register Two Register */
u32 carry_reg2; /* 0x6134 */ u32 carry_reg2; /* 0x6134 */
/* Carry Register One Mask Register */
u32 carry_reg1_mask; /* 0x6138 */ u32 carry_reg1_mask; /* 0x6138 */
/* Carry Register Two Mask Register */
u32 carry_reg2_mask; /* 0x613C */ u32 carry_reg2_mask; /* 0x613C */
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment