Commit 4c3616cd authored by Alejandro Martinez Ruiz's avatar Alejandro Martinez Ruiz Committed by David S. Miller
Browse files

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: default avatarAlejandro Martinez Ruiz <alex@flawedcode.org>
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
parent f59d9782
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -4394,7 +4394,7 @@ static struct {
	{"tx_fifo_errors"},
	{"tx_packets"}
};
#define CAS_NUM_STAT_KEYS (sizeof(ethtool_cassini_statnames)/ETH_GSTRING_LEN)
#define CAS_NUM_STAT_KEYS ARRAY_SIZE(ethtool_cassini_statnames)

static struct {
	const int offsets;	/* neg. values for 2nd arg to cas_read_phy */
+2 −2
Original line number Diff line number Diff line
@@ -2369,7 +2369,7 @@ static const char e100_gstrings_test[][ETH_GSTRING_LEN] = {
	"Mac loopback     (offline)",
	"Phy loopback     (offline)",
};
#define E100_TEST_LEN	sizeof(e100_gstrings_test) / ETH_GSTRING_LEN
#define E100_TEST_LEN	ARRAY_SIZE(e100_gstrings_test)

static void e100_diag_test(struct net_device *netdev,
	struct ethtool_test *test, u64 *data)
@@ -2431,7 +2431,7 @@ static const char e100_gstrings_stats[][ETH_GSTRING_LEN] = {
	"rx_flow_control_unsupported", "tx_tco_packets", "rx_tco_packets",
};
#define E100_NET_STATS_LEN	21
#define E100_STATS_LEN	sizeof(e100_gstrings_stats) / ETH_GSTRING_LEN
#define E100_STATS_LEN	ARRAY_SIZE(e100_gstrings_stats)

static int e100_get_sset_count(struct net_device *netdev, int sset)
{
+1 −1
Original line number Diff line number Diff line
@@ -110,7 +110,7 @@ static const char e1000_gstrings_test[][ETH_GSTRING_LEN] = {
	"Interrupt test (offline)", "Loopback test  (offline)",
	"Link test   (on/offline)"
};
#define E1000_TEST_LEN sizeof(e1000_gstrings_test) / ETH_GSTRING_LEN
#define E1000_TEST_LEN	ARRAY_SIZE(e1000_gstrings_test)

static int
e1000_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
+1 −1
Original line number Diff line number Diff line
@@ -103,7 +103,7 @@ static const char e1000_gstrings_test[][ETH_GSTRING_LEN] = {
	"Interrupt test (offline)", "Loopback test  (offline)",
	"Link test   (on/offline)"
};
#define E1000_TEST_LEN sizeof(e1000_gstrings_test) / ETH_GSTRING_LEN
#define E1000_TEST_LEN	ARRAY_SIZE(e1000_gstrings_test)

static int e1000_get_settings(struct net_device *netdev,
			      struct ethtool_cmd *ecmd)
+1 −1
Original line number Diff line number Diff line
@@ -1431,7 +1431,7 @@ static const char myri10ge_gstrings_stats[][ETH_GSTRING_LEN] = {
};

#define MYRI10GE_NET_STATS_LEN      21
#define MYRI10GE_STATS_LEN  sizeof(myri10ge_gstrings_stats) / ETH_GSTRING_LEN
#define MYRI10GE_STATS_LEN	ARRAY_SIZE(myri10ge_gstrings_stats)

static void
myri10ge_get_strings(struct net_device *netdev, u32 stringset, u8 * data)
Loading