aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/et131x/et131x.c
diff options
context:
space:
mode:
authorMark Einon <mark.einon@gmail.com>2014-08-20 23:17:54 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-08-30 13:33:23 -0700
commitbecce4a47ea488c8f4f6fc0048085efb6fff72e7 (patch)
tree8d6bd4db58150bfc2fc94435147d976243d1038b /drivers/staging/et131x/et131x.c
parentstaging: et131x: Use for loop to initialise contiguous registers to zero (diff)
downloadlinux-dev-becce4a47ea488c8f4f6fc0048085efb6fff72e7.tar.xz
linux-dev-becce4a47ea488c8f4f6fc0048085efb6fff72e7.zip
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: Mark Einon <mark.einon@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/et131x/et131x.c')
-rw-r--r--drivers/staging/et131x/et131x.c59
1 files changed, 6 insertions, 53 deletions
diff --git a/drivers/staging/et131x/et131x.c b/drivers/staging/et131x/et131x.c
index 38e2cfe4c015..bd63dc4e7892 100644
--- a/drivers/staging/et131x/et131x.c
+++ b/drivers/staging/et131x/et131x.c
@@ -1257,60 +1257,13 @@ static void et1310_config_txmac_regs(struct et131x_adapter *adapter)
static void et1310_config_macstat_regs(struct et131x_adapter *adapter)
{
- struct macstat_regs __iomem *macstat =
- &adapter->regs->macstat;
+ struct macstat_regs __iomem *macstat = &adapter->regs->macstat;
+ u32 *reg;
- /* Next we need to initialize all the macstat registers to zero on
- * the device.
- */
- writel(0, &macstat->txrx_0_64_byte_frames);
- 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);
+ /* initialize all the macstat registers to zero on the device */
+ for (reg = &macstat->txrx_0_64_byte_frames;
+ reg <= &macstat->carry_reg2; reg++)
+ writel(0, reg);
/* Unmask any counters that we want to track the overflow of.
* Initially this will be all counters. It may become clear later