diff options
author | Matt Carlson <mcarlson@broadcom.com> | 2011-04-13 13:05:06 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-04-14 02:10:07 +0200 |
commit | 48fa55a0a5e20b9e2a28a72c66c7027678cae6bb (patch) | |
tree | 9f8a3c77bbb17b414f51125003d44fb41bc306dd /drivers/net/tg3.c | |
parent | tg3: Dump registers when status block shows errors (diff) | |
download | linux-48fa55a0a5e20b9e2a28a72c66c7027678cae6bb.tar.xz linux-48fa55a0a5e20b9e2a28a72c66c7027678cae6bb.zip |
tg3: Automatically size stat/test string arrays
This patch reimplements the size preprocessor constants of the stats and
ethtool test string arrays. The size is calculated at compile time
rather than using static constants.
Signed-off-by: Matt Carlson <mcarlson@broadcom.com>
Signed-off-by: Benjamin Li <benli@broadcom.com>
Reviewed-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/tg3.c')
-rw-r--r-- | drivers/net/tg3.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c index b61b52f0a9fb..9975cdb38831 100644 --- a/drivers/net/tg3.c +++ b/drivers/net/tg3.c @@ -165,11 +165,6 @@ #define TG3_RAW_IP_ALIGN 2 -/* number of ETHTOOL_GSTATS u64's */ -#define TG3_NUM_STATS (sizeof(struct tg3_ethtool_stats)/sizeof(u64)) - -#define TG3_NUM_TEST 6 - #define TG3_FW_UPDATE_TIMEOUT_SEC 5 #define FIRMWARE_TG3 "tigon/tg3.bin" @@ -279,7 +274,7 @@ MODULE_DEVICE_TABLE(pci, tg3_pci_tbl); static const struct { const char string[ETH_GSTRING_LEN]; -} ethtool_stats_keys[TG3_NUM_STATS] = { +} ethtool_stats_keys[] = { { "rx_octets" }, { "rx_fragments" }, { "rx_ucast_packets" }, @@ -358,9 +353,12 @@ static const struct { { "nic_tx_threshold_hit" } }; +#define TG3_NUM_STATS ARRAY_SIZE(ethtool_stats_keys) + + static const struct { const char string[ETH_GSTRING_LEN]; -} ethtool_test_keys[TG3_NUM_TEST] = { +} ethtool_test_keys[] = { { "nvram test (online) " }, { "link test (online) " }, { "register test (offline)" }, @@ -369,6 +367,9 @@ static const struct { { "interrupt test (offline)" }, }; +#define TG3_NUM_TEST ARRAY_SIZE(ethtool_test_keys) + + static void tg3_write32(struct tg3 *tp, u32 off, u32 val) { writel(val, tp->regs + off); |