diff options
author | Jiri Pirko <jpirko@redhat.com> | 2010-02-07 23:30:35 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-02-12 14:38:58 -0500 |
commit | 4cd24eaf0c6ee7f0242e34ee77ec899f255e66b5 (patch) | |
tree | 99f57f6374a58022e1e5ed1cbc12699288c7eae1 /drivers/net/pcmcia | |
parent | 8e5574211d96c0552f84c757718475fdb4021be7 (diff) |
net: use netdev_mc_count and netdev_mc_empty when appropriate
This patch replaces dev->mc_count in all drivers (hopefully I didn't miss
anything). Used spatch and did small tweaks and conding style changes when
it was suitable.
Jirka
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/pcmcia')
-rw-r--r-- | drivers/net/pcmcia/3c574_cs.c | 2 | ||||
-rw-r--r-- | drivers/net/pcmcia/3c589_cs.c | 2 | ||||
-rw-r--r-- | drivers/net/pcmcia/fmvj18x_cs.c | 6 | ||||
-rw-r--r-- | drivers/net/pcmcia/nmclan_cs.c | 14 | ||||
-rw-r--r-- | drivers/net/pcmcia/smc91c92_cs.c | 4 | ||||
-rw-r--r-- | drivers/net/pcmcia/xirc2ps_cs.c | 8 |
6 files changed, 18 insertions, 18 deletions
diff --git a/drivers/net/pcmcia/3c574_cs.c b/drivers/net/pcmcia/3c574_cs.c index 98938ea9e0bd..3d1d3a7b7ed3 100644 --- a/drivers/net/pcmcia/3c574_cs.c +++ b/drivers/net/pcmcia/3c574_cs.c | |||
@@ -1148,7 +1148,7 @@ static void set_rx_mode(struct net_device *dev) | |||
1148 | if (dev->flags & IFF_PROMISC) | 1148 | if (dev->flags & IFF_PROMISC) |
1149 | outw(SetRxFilter | RxStation | RxMulticast | RxBroadcast | RxProm, | 1149 | outw(SetRxFilter | RxStation | RxMulticast | RxBroadcast | RxProm, |
1150 | ioaddr + EL3_CMD); | 1150 | ioaddr + EL3_CMD); |
1151 | else if (dev->mc_count || (dev->flags & IFF_ALLMULTI)) | 1151 | else if (!netdev_mc_empty(dev) || (dev->flags & IFF_ALLMULTI)) |
1152 | outw(SetRxFilter|RxStation|RxMulticast|RxBroadcast, ioaddr + EL3_CMD); | 1152 | outw(SetRxFilter|RxStation|RxMulticast|RxBroadcast, ioaddr + EL3_CMD); |
1153 | else | 1153 | else |
1154 | outw(SetRxFilter | RxStation | RxBroadcast, ioaddr + EL3_CMD); | 1154 | outw(SetRxFilter | RxStation | RxBroadcast, ioaddr + EL3_CMD); |
diff --git a/drivers/net/pcmcia/3c589_cs.c b/drivers/net/pcmcia/3c589_cs.c index 322e11df0097..091e0b00043e 100644 --- a/drivers/net/pcmcia/3c589_cs.c +++ b/drivers/net/pcmcia/3c589_cs.c | |||
@@ -886,7 +886,7 @@ static void set_rx_mode(struct net_device *dev) | |||
886 | 886 | ||
887 | if (dev->flags & IFF_PROMISC) | 887 | if (dev->flags & IFF_PROMISC) |
888 | opts |= RxMulticast | RxProm; | 888 | opts |= RxMulticast | RxProm; |
889 | else if (dev->mc_count || (dev->flags & IFF_ALLMULTI)) | 889 | else if (!netdev_mc_empty(dev) || (dev->flags & IFF_ALLMULTI)) |
890 | opts |= RxMulticast; | 890 | opts |= RxMulticast; |
891 | outw(opts, ioaddr + EL3_CMD); | 891 | outw(opts, ioaddr + EL3_CMD); |
892 | } | 892 | } |
diff --git a/drivers/net/pcmcia/fmvj18x_cs.c b/drivers/net/pcmcia/fmvj18x_cs.c index 7b17404d0858..3d573ed5f7c5 100644 --- a/drivers/net/pcmcia/fmvj18x_cs.c +++ b/drivers/net/pcmcia/fmvj18x_cs.c | |||
@@ -1187,19 +1187,19 @@ static void set_rx_mode(struct net_device *dev) | |||
1187 | if (dev->flags & IFF_PROMISC) { | 1187 | if (dev->flags & IFF_PROMISC) { |
1188 | memset(mc_filter, 0xff, sizeof(mc_filter)); | 1188 | memset(mc_filter, 0xff, sizeof(mc_filter)); |
1189 | outb(3, ioaddr + RX_MODE); /* Enable promiscuous mode */ | 1189 | outb(3, ioaddr + RX_MODE); /* Enable promiscuous mode */ |
1190 | } else if (dev->mc_count > MC_FILTERBREAK || | 1190 | } else if (netdev_mc_count(dev) > MC_FILTERBREAK || |
1191 | (dev->flags & IFF_ALLMULTI)) { | 1191 | (dev->flags & IFF_ALLMULTI)) { |
1192 | /* Too many to filter perfectly -- accept all multicasts. */ | 1192 | /* Too many to filter perfectly -- accept all multicasts. */ |
1193 | memset(mc_filter, 0xff, sizeof(mc_filter)); | 1193 | memset(mc_filter, 0xff, sizeof(mc_filter)); |
1194 | outb(2, ioaddr + RX_MODE); /* Use normal mode. */ | 1194 | outb(2, ioaddr + RX_MODE); /* Use normal mode. */ |
1195 | } else if (dev->mc_count == 0) { | 1195 | } else if (netdev_mc_empty(dev)) { |
1196 | memset(mc_filter, 0x00, sizeof(mc_filter)); | 1196 | memset(mc_filter, 0x00, sizeof(mc_filter)); |
1197 | outb(1, ioaddr + RX_MODE); /* Ignore almost all multicasts. */ | 1197 | outb(1, ioaddr + RX_MODE); /* Ignore almost all multicasts. */ |
1198 | } else { | 1198 | } else { |
1199 | struct dev_mc_list *mclist; | 1199 | struct dev_mc_list *mclist; |
1200 | 1200 | ||
1201 | memset(mc_filter, 0, sizeof(mc_filter)); | 1201 | memset(mc_filter, 0, sizeof(mc_filter)); |
1202 | for (i = 0, mclist = dev->mc_list; mclist && i < dev->mc_count; | 1202 | for (i = 0, mclist = dev->mc_list; mclist && i < netdev_mc_count(dev); |
1203 | i++, mclist = mclist->next) { | 1203 | i++, mclist = mclist->next) { |
1204 | unsigned int bit = | 1204 | unsigned int bit = |
1205 | ether_crc_le(ETH_ALEN, mclist->dmi_addr) >> 26; | 1205 | ether_crc_le(ETH_ALEN, mclist->dmi_addr) >> 26; |
diff --git a/drivers/net/pcmcia/nmclan_cs.c b/drivers/net/pcmcia/nmclan_cs.c index 12e3233868e9..c42a31a97fa3 100644 --- a/drivers/net/pcmcia/nmclan_cs.c +++ b/drivers/net/pcmcia/nmclan_cs.c | |||
@@ -1481,8 +1481,8 @@ static void set_multicast_list(struct net_device *dev) | |||
1481 | #ifdef PCMCIA_DEBUG | 1481 | #ifdef PCMCIA_DEBUG |
1482 | { | 1482 | { |
1483 | static int old; | 1483 | static int old; |
1484 | if (dev->mc_count != old) { | 1484 | if (netdev_mc_count(dev) != old) { |
1485 | old = dev->mc_count; | 1485 | old = netdev_mc_count(dev); |
1486 | pr_debug("%s: setting Rx mode to %d addresses.\n", | 1486 | pr_debug("%s: setting Rx mode to %d addresses.\n", |
1487 | dev->name, old); | 1487 | dev->name, old); |
1488 | } | 1488 | } |
@@ -1490,13 +1490,13 @@ static void set_multicast_list(struct net_device *dev) | |||
1490 | #endif | 1490 | #endif |
1491 | 1491 | ||
1492 | /* Set multicast_num_addrs. */ | 1492 | /* Set multicast_num_addrs. */ |
1493 | lp->multicast_num_addrs = dev->mc_count; | 1493 | lp->multicast_num_addrs = netdev_mc_count(dev); |
1494 | 1494 | ||
1495 | /* Set multicast_ladrf. */ | 1495 | /* Set multicast_ladrf. */ |
1496 | if (num_addrs > 0) { | 1496 | if (num_addrs > 0) { |
1497 | /* Calculate multicast logical address filter */ | 1497 | /* Calculate multicast logical address filter */ |
1498 | memset(lp->multicast_ladrf, 0, MACE_LADRF_LEN); | 1498 | memset(lp->multicast_ladrf, 0, MACE_LADRF_LEN); |
1499 | for (i = 0; i < dev->mc_count; i++) { | 1499 | for (i = 0; i < netdev_mc_count(dev); i++) { |
1500 | memcpy(adr, dmi->dmi_addr, ETHER_ADDR_LEN); | 1500 | memcpy(adr, dmi->dmi_addr, ETHER_ADDR_LEN); |
1501 | dmi = dmi->next; | 1501 | dmi = dmi->next; |
1502 | BuildLAF(lp->multicast_ladrf, adr); | 1502 | BuildLAF(lp->multicast_ladrf, adr); |
@@ -1537,15 +1537,15 @@ static void set_multicast_list(struct net_device *dev) | |||
1537 | #ifdef PCMCIA_DEBUG | 1537 | #ifdef PCMCIA_DEBUG |
1538 | { | 1538 | { |
1539 | static int old; | 1539 | static int old; |
1540 | if (dev->mc_count != old) { | 1540 | if (netdev_mc_count(dev) != old) { |
1541 | old = dev->mc_count; | 1541 | old = netdev_mc_count(dev); |
1542 | pr_debug("%s: setting Rx mode to %d addresses.\n", | 1542 | pr_debug("%s: setting Rx mode to %d addresses.\n", |
1543 | dev->name, old); | 1543 | dev->name, old); |
1544 | } | 1544 | } |
1545 | } | 1545 | } |
1546 | #endif | 1546 | #endif |
1547 | 1547 | ||
1548 | lp->multicast_num_addrs = dev->mc_count; | 1548 | lp->multicast_num_addrs = netdev_mc_count(dev); |
1549 | restore_multicast_list(dev); | 1549 | restore_multicast_list(dev); |
1550 | 1550 | ||
1551 | } /* set_multicast_list */ | 1551 | } /* set_multicast_list */ |
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c index 6dd486d2977b..d2e86b8887c8 100644 --- a/drivers/net/pcmcia/smc91c92_cs.c +++ b/drivers/net/pcmcia/smc91c92_cs.c | |||
@@ -1638,8 +1638,8 @@ static void set_rx_mode(struct net_device *dev) | |||
1638 | } else if (dev->flags & IFF_ALLMULTI) | 1638 | } else if (dev->flags & IFF_ALLMULTI) |
1639 | rx_cfg_setting = RxStripCRC | RxEnable | RxAllMulti; | 1639 | rx_cfg_setting = RxStripCRC | RxEnable | RxAllMulti; |
1640 | else { | 1640 | else { |
1641 | if (dev->mc_count) { | 1641 | if (!netdev_mc_empty(dev)) { |
1642 | fill_multicast_tbl(dev->mc_count, dev->mc_list, | 1642 | fill_multicast_tbl(netdev_mc_count(dev), dev->mc_list, |
1643 | (u_char *)multicast_table); | 1643 | (u_char *)multicast_table); |
1644 | } | 1644 | } |
1645 | rx_cfg_setting = RxStripCRC | RxEnable; | 1645 | rx_cfg_setting = RxStripCRC | RxEnable; |
diff --git a/drivers/net/pcmcia/xirc2ps_cs.c b/drivers/net/pcmcia/xirc2ps_cs.c index 466fc72698c0..4ace18a71152 100644 --- a/drivers/net/pcmcia/xirc2ps_cs.c +++ b/drivers/net/pcmcia/xirc2ps_cs.c | |||
@@ -1384,7 +1384,7 @@ set_addresses(struct net_device *dev) | |||
1384 | if (++n > 9) | 1384 | if (++n > 9) |
1385 | break; | 1385 | break; |
1386 | i = 0; | 1386 | i = 0; |
1387 | if (n > 1 && n <= dev->mc_count && dmi) { | 1387 | if (n > 1 && n <= netdev_mc_count(dev) && dmi) { |
1388 | dmi = dmi->next; | 1388 | dmi = dmi->next; |
1389 | } | 1389 | } |
1390 | } | 1390 | } |
@@ -1394,7 +1394,7 @@ set_addresses(struct net_device *dev) | |||
1394 | SelectPage(k); | 1394 | SelectPage(k); |
1395 | } | 1395 | } |
1396 | 1396 | ||
1397 | if (n && n <= dev->mc_count && dmi) | 1397 | if (n && n <= netdev_mc_count(dev) && dmi) |
1398 | addr = dmi->dmi_addr; | 1398 | addr = dmi->dmi_addr; |
1399 | else | 1399 | else |
1400 | addr = dev->dev_addr; | 1400 | addr = dev->dev_addr; |
@@ -1424,9 +1424,9 @@ set_multicast_list(struct net_device *dev) | |||
1424 | 1424 | ||
1425 | if (dev->flags & IFF_PROMISC) { /* snoop */ | 1425 | if (dev->flags & IFF_PROMISC) { /* snoop */ |
1426 | PutByte(XIRCREG42_SWC1, value | 0x06); /* set MPE and PME */ | 1426 | PutByte(XIRCREG42_SWC1, value | 0x06); /* set MPE and PME */ |
1427 | } else if (dev->mc_count > 9 || (dev->flags & IFF_ALLMULTI)) { | 1427 | } else if (netdev_mc_count(dev) > 9 || (dev->flags & IFF_ALLMULTI)) { |
1428 | PutByte(XIRCREG42_SWC1, value | 0x02); /* set MPE */ | 1428 | PutByte(XIRCREG42_SWC1, value | 0x02); /* set MPE */ |
1429 | } else if (dev->mc_count) { | 1429 | } else if (!netdev_mc_empty(dev)) { |
1430 | /* the chip can filter 9 addresses perfectly */ | 1430 | /* the chip can filter 9 addresses perfectly */ |
1431 | PutByte(XIRCREG42_SWC1, value | 0x01); | 1431 | PutByte(XIRCREG42_SWC1, value | 0x01); |
1432 | SelectPage(0x40); | 1432 | SelectPage(0x40); |