aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorMatt Carlson <mcarlson@broadcom.com>2011-04-13 07:05:06 -0400
committerDavid S. Miller <davem@davemloft.net>2011-04-13 20:10:07 -0400
commit48fa55a0a5e20b9e2a28a72c66c7027678cae6bb (patch)
tree9f8a3c77bbb17b414f51125003d44fb41bc306dd /drivers
parente64de4e6c660dae6d6370b3acb59d5d5cc9ecf20 (diff)
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')
-rw-r--r--drivers/net/tg3.c15
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 @@
165 165
166#define TG3_RAW_IP_ALIGN 2 166#define TG3_RAW_IP_ALIGN 2
167 167
168/* number of ETHTOOL_GSTATS u64's */
169#define TG3_NUM_STATS (sizeof(struct tg3_ethtool_stats)/sizeof(u64))
170
171#define TG3_NUM_TEST 6
172
173#define TG3_FW_UPDATE_TIMEOUT_SEC 5 168#define TG3_FW_UPDATE_TIMEOUT_SEC 5
174 169
175#define FIRMWARE_TG3 "tigon/tg3.bin" 170#define FIRMWARE_TG3 "tigon/tg3.bin"
@@ -279,7 +274,7 @@ MODULE_DEVICE_TABLE(pci, tg3_pci_tbl);
279 274
280static const struct { 275static const struct {
281 const char string[ETH_GSTRING_LEN]; 276 const char string[ETH_GSTRING_LEN];
282} ethtool_stats_keys[TG3_NUM_STATS] = { 277} ethtool_stats_keys[] = {
283 { "rx_octets" }, 278 { "rx_octets" },
284 { "rx_fragments" }, 279 { "rx_fragments" },
285 { "rx_ucast_packets" }, 280 { "rx_ucast_packets" },
@@ -358,9 +353,12 @@ static const struct {
358 { "nic_tx_threshold_hit" } 353 { "nic_tx_threshold_hit" }
359}; 354};
360 355
356#define TG3_NUM_STATS ARRAY_SIZE(ethtool_stats_keys)
357
358
361static const struct { 359static const struct {
362 const char string[ETH_GSTRING_LEN]; 360 const char string[ETH_GSTRING_LEN];
363} ethtool_test_keys[TG3_NUM_TEST] = { 361} ethtool_test_keys[] = {
364 { "nvram test (online) " }, 362 { "nvram test (online) " },
365 { "link test (online) " }, 363 { "link test (online) " },
366 { "register test (offline)" }, 364 { "register test (offline)" },
@@ -369,6 +367,9 @@ static const struct {
369 { "interrupt test (offline)" }, 367 { "interrupt test (offline)" },
370}; 368};
371 369
370#define TG3_NUM_TEST ARRAY_SIZE(ethtool_test_keys)
371
372
372static void tg3_write32(struct tg3 *tp, u32 off, u32 val) 373static void tg3_write32(struct tg3 *tp, u32 off, u32 val)
373{ 374{
374 writel(val, tp->regs + off); 375 writel(val, tp->regs + off);