RE: [PATCH 4/8] staging: et131x: Use for loop to initialise contiguous macstat registers to zero

From: David Laight
Date: Thu Aug 21 2014 - 04:41:48 EST


From: Mark Einon
> 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.
...
> - writel(0, &macstat->txrx_0_64_byte_frames);
...
> - 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);
...
> struct macstat_regs { /* Location: */
> u32 pad[32]; /* 0x6000 - 607C */
>
> - /* Tx/Rx 0-64 Byte Frame Counter */
> + /* counters */
> u32 txrx_0_64_byte_frames; /* 0x6080 */
> -
> - /* Tx/Rx 65-127 Byte Frame Counter */
> u32 txrx_65_127_byte_frames; /* 0x6084 */

I think it would be best to also convert the stats counters to an array.

David



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/