summaryrefslogtreecommitdiffstats
path: root/drivers/net/tehuti.c
diff options
context:
space:
mode:
authorAlejandro Martinez Ruiz <alex@flawedcode.org>2007-10-18 10:00:15 +0200
committerDavid S. Miller <davem@davemloft.net>2008-01-28 15:03:36 -0800
commit4c3616cdda0632a3d0e39069765f9ea0e6bd093e (patch)
treed913f63996d479394bcdabd21ebfbdbe16bd1844 /drivers/net/tehuti.c
parentf59d9782751bf1a2c51e7e1e9f614ffec35fb52e (diff)
downloadlinux-4c3616cdda0632a3d0e39069765f9ea0e6bd093e.tar.bz2
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.c8
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)
strlcat(drvinfo->bus_info, pci_name(priv->pdev),
sizeof(drvinfo->bus_info));
- drvinfo->n_stats = ((priv->stats_flag) ?
- (sizeof(bdx_stat_names) / ETH_GSTRING_LEN) : 0);
+ drvinfo->n_stats = ((priv->stats_flag) ? ARRAY_SIZE(bdx_stat_names) : 0);
drvinfo->testinfo_len = 0;
drvinfo->regdump_len = 0;
drvinfo->eedump_len = 0;
@@ -2375,10 +2374,9 @@ static void bdx_get_strings(struct net_device *netdev, u32 stringset, u8 *data)
static int bdx_get_stats_count(struct net_device *netdev)
{
struct bdx_priv *priv = netdev->priv;
- BDX_ASSERT(sizeof(bdx_stat_names) / ETH_GSTRING_LEN
+ BDX_ASSERT(ARRAY_SIZE(bdx_stat_names)
!= sizeof(struct bdx_stats) / sizeof(u64));
- return ((priv->stats_flag) ? (sizeof(bdx_stat_names) / ETH_GSTRING_LEN)
- : 0);
+ return ((priv->stats_flag) ? ARRAY_SIZE(bdx_stat_names) : 0);
}
/*