diff options
author | Alejandro Martinez Ruiz <alex@flawedcode.org> | 2007-10-18 04:00:15 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 18:03:36 -0500 |
commit | 4c3616cdda0632a3d0e39069765f9ea0e6bd093e (patch) | |
tree | d913f63996d479394bcdabd21ebfbdbe16bd1844 /drivers/net/tehuti.c | |
parent | f59d9782751bf1a2c51e7e1e9f614ffec35fb52e (diff) |
netdev: use ARRAY_SIZE() instead of sizeof(array) / ETH_GSTRING_LEN
Using ARRAY_SIZE() on arrays of the form array[][K] makes it unnecessary
to know the value of K when checking its size.
Signed-off-by: Alejandro Martinez Ruiz <alex@flawedcode.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/tehuti.c')
-rw-r--r-- | drivers/net/tehuti.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/net/tehuti.c b/drivers/net/tehuti.c index 21230c97b2a0..ccb8d447cec6 100644 --- a/drivers/net/tehuti.c +++ b/drivers/net/tehuti.c | |||
@@ -2174,8 +2174,7 @@ bdx_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo) | |||
2174 | strlcat(drvinfo->bus_info, pci_name(priv->pdev), | 2174 | strlcat(drvinfo->bus_info, pci_name(priv->pdev), |
2175 | sizeof(drvinfo->bus_info)); | 2175 | sizeof(drvinfo->bus_info)); |
2176 | 2176 | ||
2177 | drvinfo->n_stats = ((priv->stats_flag) ? | 2177 | drvinfo->n_stats = ((priv->stats_flag) ? ARRAY_SIZE(bdx_stat_names) : 0); |
2178 | (sizeof(bdx_stat_names) / ETH_GSTRING_LEN) : 0); | ||
2179 | drvinfo->testinfo_len = 0; | 2178 | drvinfo->testinfo_len = 0; |
2180 | drvinfo->regdump_len = 0; | 2179 | drvinfo->regdump_len = 0; |
2181 | drvinfo->eedump_len = 0; | 2180 | drvinfo->eedump_len = 0; |
@@ -2375,10 +2374,9 @@ static void bdx_get_strings(struct net_device *netdev, u32 stringset, u8 *data) | |||
2375 | static int bdx_get_stats_count(struct net_device *netdev) | 2374 | static int bdx_get_stats_count(struct net_device *netdev) |
2376 | { | 2375 | { |
2377 | struct bdx_priv *priv = netdev->priv; | 2376 | struct bdx_priv *priv = netdev->priv; |
2378 | BDX_ASSERT(sizeof(bdx_stat_names) / ETH_GSTRING_LEN | 2377 | BDX_ASSERT(ARRAY_SIZE(bdx_stat_names) |
2379 | != sizeof(struct bdx_stats) / sizeof(u64)); | 2378 | != sizeof(struct bdx_stats) / sizeof(u64)); |
2380 | return ((priv->stats_flag) ? (sizeof(bdx_stat_names) / ETH_GSTRING_LEN) | 2379 | return ((priv->stats_flag) ? ARRAY_SIZE(bdx_stat_names) : 0); |
2381 | : 0); | ||
2382 | } | 2380 | } |
2383 | 2381 | ||
2384 | /* | 2382 | /* |