aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/e1000e/ethtool.c3
-rw-r--r--drivers/net/e1000e/phy.c3
-rw-r--r--drivers/net/ixgbe/ixgbe_ethtool.c3
-rw-r--r--drivers/net/tehuti.c2
-rw-r--r--drivers/net/tulip/de4x5.c2
-rw-r--r--drivers/net/wireless/ipw2100.c3
-rw-r--r--drivers/net/wireless/libertas/11d.c24
-rw-r--r--drivers/net/wireless/libertas/wext.c11
-rw-r--r--drivers/net/wireless/wavelan.c2
-rw-r--r--drivers/net/wireless/wavelan_cs.c4
10 files changed, 19 insertions, 38 deletions
diff --git a/drivers/net/e1000e/ethtool.c b/drivers/net/e1000e/ethtool.c
index b36b853bed1a..e6ff3af8ef0f 100644
--- a/drivers/net/e1000e/ethtool.c
+++ b/drivers/net/e1000e/ethtool.c
@@ -95,8 +95,7 @@ static const struct e1000_stats e1000_gstrings_stats[] = {
95 { "tx_dma_failed", E1000_STAT(tx_dma_failed) }, 95 { "tx_dma_failed", E1000_STAT(tx_dma_failed) },
96}; 96};
97 97
98#define E1000_GLOBAL_STATS_LEN \ 98#define E1000_GLOBAL_STATS_LEN ARRAY_SIZE(e1000_gstrings_stats)
99 sizeof(e1000_gstrings_stats) / sizeof(struct e1000_stats)
100#define E1000_STATS_LEN (E1000_GLOBAL_STATS_LEN) 99#define E1000_STATS_LEN (E1000_GLOBAL_STATS_LEN)
101static const char e1000_gstrings_test[][ETH_GSTRING_LEN] = { 100static const char e1000_gstrings_test[][ETH_GSTRING_LEN] = {
102 "Register test (offline)", "Eeprom test (offline)", 101 "Register test (offline)", "Eeprom test (offline)",
diff --git a/drivers/net/e1000e/phy.c b/drivers/net/e1000e/phy.c
index 793231810ae0..fc6fee112f1c 100644
--- a/drivers/net/e1000e/phy.c
+++ b/drivers/net/e1000e/phy.c
@@ -49,8 +49,7 @@ static const u16 e1000_igp_2_cable_length_table[] =
49 100, 105, 109, 113, 116, 119, 122, 124, 104, 109, 114, 118, 121, 49 100, 105, 109, 113, 116, 119, 122, 124, 104, 109, 114, 118, 121,
50 124}; 50 124};
51#define IGP02E1000_CABLE_LENGTH_TABLE_SIZE \ 51#define IGP02E1000_CABLE_LENGTH_TABLE_SIZE \
52 (sizeof(e1000_igp_2_cable_length_table) / \ 52 ARRAY_SIZE(e1000_igp_2_cable_length_table)
53 sizeof(e1000_igp_2_cable_length_table[0]))
54 53
55/** 54/**
56 * e1000e_check_reset_block_generic - Check if PHY reset is blocked 55 * e1000e_check_reset_block_generic - Check if PHY reset is blocked
diff --git a/drivers/net/ixgbe/ixgbe_ethtool.c b/drivers/net/ixgbe/ixgbe_ethtool.c
index a4e576a0c543..36353447716d 100644
--- a/drivers/net/ixgbe/ixgbe_ethtool.c
+++ b/drivers/net/ixgbe/ixgbe_ethtool.c
@@ -96,8 +96,7 @@ static struct ixgbe_stats ixgbe_gstrings_stats[] = {
96 ((((struct ixgbe_adapter *)netdev->priv)->num_tx_queues + \ 96 ((((struct ixgbe_adapter *)netdev->priv)->num_tx_queues + \
97 ((struct ixgbe_adapter *)netdev->priv)->num_rx_queues) * \ 97 ((struct ixgbe_adapter *)netdev->priv)->num_rx_queues) * \
98 (sizeof(struct ixgbe_queue_stats) / sizeof(u64))) 98 (sizeof(struct ixgbe_queue_stats) / sizeof(u64)))
99#define IXGBE_GLOBAL_STATS_LEN \ 99#define IXGBE_GLOBAL_STATS_LEN ARRAY_SIZE(ixgbe_gstrings_stats)
100 sizeof(ixgbe_gstrings_stats) / sizeof(struct ixgbe_stats)
101#define IXGBE_STATS_LEN (IXGBE_GLOBAL_STATS_LEN + IXGBE_QUEUE_STATS_LEN) 100#define IXGBE_STATS_LEN (IXGBE_GLOBAL_STATS_LEN + IXGBE_QUEUE_STATS_LEN)
102 101
103static int ixgbe_get_settings(struct net_device *netdev, 102static int ixgbe_get_settings(struct net_device *netdev,
diff --git a/drivers/net/tehuti.c b/drivers/net/tehuti.c
index ccb8d447cec6..17585e5eed53 100644
--- a/drivers/net/tehuti.c
+++ b/drivers/net/tehuti.c
@@ -621,7 +621,7 @@ err:
621static void __init bdx_firmware_endianess(void) 621static void __init bdx_firmware_endianess(void)
622{ 622{
623 int i; 623 int i;
624 for (i = 0; i < sizeof(s_firmLoad) / sizeof(u32); i++) 624 for (i = 0; i < ARRAY_SIZE(s_firmLoad); i++)
625 s_firmLoad[i] = CPU_CHIP_SWAP32(s_firmLoad[i]); 625 s_firmLoad[i] = CPU_CHIP_SWAP32(s_firmLoad[i]);
626} 626}
627 627
diff --git a/drivers/net/tulip/de4x5.c b/drivers/net/tulip/de4x5.c
index 6e8b18a3b3cc..2738a591c2ec 100644
--- a/drivers/net/tulip/de4x5.c
+++ b/drivers/net/tulip/de4x5.c
@@ -4168,7 +4168,7 @@ de4x5_bad_srom(struct de4x5_private *lp)
4168{ 4168{
4169 int i, status = 0; 4169 int i, status = 0;
4170 4170
4171 for (i=0; i<sizeof(enet_det)/ETH_ALEN; i++) { 4171 for (i=0; i < ARRAY_SIZE(enet_det); i++) {
4172 if (!de4x5_strncmp((char *)&lp->srom, (char *)&enet_det[i], 3) && 4172 if (!de4x5_strncmp((char *)&lp->srom, (char *)&enet_det[i], 3) &&
4173 !de4x5_strncmp((char *)&lp->srom+0x10, (char *)&enet_det[i], 3)) { 4173 !de4x5_strncmp((char *)&lp->srom+0x10, (char *)&enet_det[i], 3)) {
4174 if (i == 0) { 4174 if (i == 0) {
diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c
index fc6cdd8086c1..dc3813b26440 100644
--- a/drivers/net/wireless/ipw2100.c
+++ b/drivers/net/wireless/ipw2100.c
@@ -6591,8 +6591,7 @@ static const long ipw2100_frequencies[] = {
6591 2472, 2484 6591 2472, 2484
6592}; 6592};
6593 6593
6594#define FREQ_COUNT (sizeof(ipw2100_frequencies) / \ 6594#define FREQ_COUNT ARRAY_SIZE(ipw2100_frequencies)
6595 sizeof(ipw2100_frequencies[0]))
6596 6595
6597static const long ipw2100_rates_11b[] = { 6596static const long ipw2100_rates_11b[] = {
6598 1000000, 6597 1000000,
diff --git a/drivers/net/wireless/libertas/11d.c b/drivers/net/wireless/libertas/11d.c
index 9cf0211de67f..8bbd3227e6fb 100644
--- a/drivers/net/wireless/libertas/11d.c
+++ b/drivers/net/wireless/libertas/11d.c
@@ -46,13 +46,11 @@ static struct chan_freq_power channel_freq_power_UN_BG[] = {
46static u8 wlan_region_2_code(u8 * region) 46static u8 wlan_region_2_code(u8 * region)
47{ 47{
48 u8 i; 48 u8 i;
49 u8 size = sizeof(region_code_mapping)/
50 sizeof(struct region_code_mapping);
51 49
52 for (i = 0; region[i] && i < COUNTRY_CODE_LEN; i++) 50 for (i = 0; region[i] && i < COUNTRY_CODE_LEN; i++)
53 region[i] = toupper(region[i]); 51 region[i] = toupper(region[i]);
54 52
55 for (i = 0; i < size; i++) { 53 for (i = 0; i < ARRAY_SIZE(region_code_mapping); i++) {
56 if (!memcmp(region, region_code_mapping[i].region, 54 if (!memcmp(region, region_code_mapping[i].region,
57 COUNTRY_CODE_LEN)) 55 COUNTRY_CODE_LEN))
58 return (region_code_mapping[i].code); 56 return (region_code_mapping[i].code);
@@ -65,9 +63,8 @@ static u8 wlan_region_2_code(u8 * region)
65static u8 *wlan_code_2_region(u8 code) 63static u8 *wlan_code_2_region(u8 code)
66{ 64{
67 u8 i; 65 u8 i;
68 u8 size = sizeof(region_code_mapping) 66
69 / sizeof(struct region_code_mapping); 67 for (i = 0; i < ARRAY_SIZE(region_code_mapping); i++) {
70 for (i = 0; i < size; i++) {
71 if (region_code_mapping[i].code == code) 68 if (region_code_mapping[i].code == code)
72 return (region_code_mapping[i].region); 69 return (region_code_mapping[i].region);
73 } 70 }
@@ -90,8 +87,7 @@ static u8 wlan_get_chan_11d(u8 band, u8 firstchan, u8 nrchan, u8 * chan)
90 u8 cfp_no; 87 u8 cfp_no;
91 88
92 cfp = channel_freq_power_UN_BG; 89 cfp = channel_freq_power_UN_BG;
93 cfp_no = sizeof(channel_freq_power_UN_BG) / 90 cfp_no = ARRAY_SIZE(channel_freq_power_UN_BG);
94 sizeof(struct chan_freq_power);
95 91
96 for (i = 0; i < cfp_no; i++) { 92 for (i = 0; i < cfp_no; i++) {
97 if ((cfp + i)->channel == firstchan) { 93 if ((cfp + i)->channel == firstchan) {
@@ -141,16 +137,12 @@ static u8 wlan_channel_known_11d(u8 chan,
141u32 libertas_chan_2_freq(u8 chan, u8 band) 137u32 libertas_chan_2_freq(u8 chan, u8 band)
142{ 138{
143 struct chan_freq_power *cf; 139 struct chan_freq_power *cf;
144 u16 cnt;
145 u16 i; 140 u16 i;
146 u32 freq = 0; 141 u32 freq = 0;
147 142
148 cf = channel_freq_power_UN_BG; 143 cf = channel_freq_power_UN_BG;
149 cnt =
150 sizeof(channel_freq_power_UN_BG) /
151 sizeof(struct chan_freq_power);
152 144
153 for (i = 0; i < cnt; i++) { 145 for (i = 0; i < ARRAY_SIZE(channel_freq_power_UN_BG); i++) {
154 if (chan == cf[i].channel) 146 if (chan == cf[i].channel)
155 freq = cf[i].freq; 147 freq = cf[i].freq;
156 } 148 }
@@ -664,8 +656,7 @@ int libertas_create_dnld_countryinfo_11d(wlan_private * priv)
664 if (priv->adapter->enable11d) { 656 if (priv->adapter->enable11d) {
665 /* update parsed_region_chan_11; dnld domaininf to FW */ 657 /* update parsed_region_chan_11; dnld domaininf to FW */
666 658
667 for (j = 0; j < sizeof(adapter->region_channel) / 659 for (j = 0; j < ARRAY_SIZE(adapter->region_channel); j++) {
668 sizeof(adapter->region_channel[0]); j++) {
669 region_chan = &adapter->region_channel[j]; 660 region_chan = &adapter->region_channel[j];
670 661
671 lbs_deb_11d("%d region_chan->band %d\n", j, 662 lbs_deb_11d("%d region_chan->band %d\n", j,
@@ -679,8 +670,7 @@ int libertas_create_dnld_countryinfo_11d(wlan_private * priv)
679 break; 670 break;
680 } 671 }
681 672
682 if (j >= sizeof(adapter->region_channel) / 673 if (j >= ARRAY_SIZE(adapter->region_channel)) {
683 sizeof(adapter->region_channel[0])) {
684 lbs_deb_11d("region_chan not found, band %d\n", 674 lbs_deb_11d("region_chan not found, band %d\n",
685 adapter->curbssparams.band); 675 adapter->curbssparams.band);
686 ret = -1; 676 ret = -1;
diff --git a/drivers/net/wireless/libertas/wext.c b/drivers/net/wireless/libertas/wext.c
index 4dec5e5565bb..4ef5b9e00c77 100644
--- a/drivers/net/wireless/libertas/wext.c
+++ b/drivers/net/wireless/libertas/wext.c
@@ -52,11 +52,9 @@ struct chan_freq_power *libertas_find_cfp_by_band_and_channel(wlan_adapter * ada
52{ 52{
53 struct chan_freq_power *cfp = NULL; 53 struct chan_freq_power *cfp = NULL;
54 struct region_channel *rc; 54 struct region_channel *rc;
55 int count = sizeof(adapter->region_channel) /
56 sizeof(adapter->region_channel[0]);
57 int i, j; 55 int i, j;
58 56
59 for (j = 0; !cfp && (j < count); j++) { 57 for (j = 0; !cfp && (j < ARRAY_SIZE(adapter->region_channel)); j++) {
60 rc = &adapter->region_channel[j]; 58 rc = &adapter->region_channel[j];
61 59
62 if (adapter->enable11d) 60 if (adapter->enable11d)
@@ -93,11 +91,9 @@ static struct chan_freq_power *find_cfp_by_band_and_freq(wlan_adapter * adapter,
93{ 91{
94 struct chan_freq_power *cfp = NULL; 92 struct chan_freq_power *cfp = NULL;
95 struct region_channel *rc; 93 struct region_channel *rc;
96 int count = sizeof(adapter->region_channel) /
97 sizeof(adapter->region_channel[0]);
98 int i, j; 94 int i, j;
99 95
100 for (j = 0; !cfp && (j < count); j++) { 96 for (j = 0; !cfp && (j < ARRAY_SIZE(adapter->region_channel)); j++) {
101 rc = &adapter->region_channel[j]; 97 rc = &adapter->region_channel[j];
102 98
103 if (adapter->enable11d) 99 if (adapter->enable11d)
@@ -624,8 +620,7 @@ static int wlan_get_range(struct net_device *dev, struct iw_request_info *info,
624 } 620 }
625 if (!flag) { 621 if (!flag) {
626 for (j = 0; (range->num_frequency < IW_MAX_FREQUENCIES) 622 for (j = 0; (range->num_frequency < IW_MAX_FREQUENCIES)
627 && (j < sizeof(adapter->region_channel) 623 && (j < ARRAY_SIZE(adapter->region_channel)); j++) {
628 / sizeof(adapter->region_channel[0])); j++) {
629 cfp = adapter->region_channel[j].CFP; 624 cfp = adapter->region_channel[j].CFP;
630 for (i = 0; (range->num_frequency < IW_MAX_FREQUENCIES) 625 for (i = 0; (range->num_frequency < IW_MAX_FREQUENCIES)
631 && adapter->region_channel[j].valid 626 && adapter->region_channel[j].valid
diff --git a/drivers/net/wireless/wavelan.c b/drivers/net/wireless/wavelan.c
index a1f8a1687842..b343ce2235eb 100644
--- a/drivers/net/wireless/wavelan.c
+++ b/drivers/net/wireless/wavelan.c
@@ -3740,7 +3740,7 @@ static int wv_check_ioaddr(unsigned long ioaddr, u8 * mac)
3740 * non-NCR/AT&T/Lucent ISA card. See wavelan.p.h for detail on 3740 * non-NCR/AT&T/Lucent ISA card. See wavelan.p.h for detail on
3741 * how to configure your card. 3741 * how to configure your card.
3742 */ 3742 */
3743 for (i = 0; i < (sizeof(MAC_ADDRESSES) / sizeof(char) / 3); i++) 3743 for (i = 0; i < ARRAY_SIZE(MAC_ADDRESSES); i++)
3744 if ((mac[0] == MAC_ADDRESSES[i][0]) && 3744 if ((mac[0] == MAC_ADDRESSES[i][0]) &&
3745 (mac[1] == MAC_ADDRESSES[i][1]) && 3745 (mac[1] == MAC_ADDRESSES[i][1]) &&
3746 (mac[2] == MAC_ADDRESSES[i][2])) 3746 (mac[2] == MAC_ADDRESSES[i][2]))
diff --git a/drivers/net/wireless/wavelan_cs.c b/drivers/net/wireless/wavelan_cs.c
index 577c647824fe..f5b38de4f0df 100644
--- a/drivers/net/wireless/wavelan_cs.c
+++ b/drivers/net/wireless/wavelan_cs.c
@@ -3223,14 +3223,14 @@ wv_mmc_init(struct net_device * dev)
3223 * non-NCR/AT&T/Lucent PCMCIA cards, see wavelan_cs.h for detail on 3223 * non-NCR/AT&T/Lucent PCMCIA cards, see wavelan_cs.h for detail on
3224 * how to configure your card... 3224 * how to configure your card...
3225 */ 3225 */
3226 for(i = 0; i < (sizeof(MAC_ADDRESSES) / sizeof(char) / 3); i++) 3226 for(i = 0; i < ARRAY_SIZE(MAC_ADDRESSES); i++)
3227 if((psa.psa_univ_mac_addr[0] == MAC_ADDRESSES[i][0]) && 3227 if((psa.psa_univ_mac_addr[0] == MAC_ADDRESSES[i][0]) &&
3228 (psa.psa_univ_mac_addr[1] == MAC_ADDRESSES[i][1]) && 3228 (psa.psa_univ_mac_addr[1] == MAC_ADDRESSES[i][1]) &&
3229 (psa.psa_univ_mac_addr[2] == MAC_ADDRESSES[i][2])) 3229 (psa.psa_univ_mac_addr[2] == MAC_ADDRESSES[i][2]))
3230 break; 3230 break;
3231 3231
3232 /* If we have not found it... */ 3232 /* If we have not found it... */
3233 if(i == (sizeof(MAC_ADDRESSES) / sizeof(char) / 3)) 3233 if(i == ARRAY_SIZE(MAC_ADDRESSES))
3234 { 3234 {
3235#ifdef DEBUG_CONFIG_ERRORS 3235#ifdef DEBUG_CONFIG_ERRORS
3236 printk(KERN_WARNING "%s: wv_mmc_init(): Invalid MAC address: %02X:%02X:%02X:...\n", 3236 printk(KERN_WARNING "%s: wv_mmc_init(): Invalid MAC address: %02X:%02X:%02X:...\n",