aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/usb
diff options
context:
space:
mode:
authorJiri Pirko <jpirko@redhat.com>2010-02-07 23:30:35 -0500
committerDavid S. Miller <davem@davemloft.net>2010-02-12 14:38:58 -0500
commit4cd24eaf0c6ee7f0242e34ee77ec899f255e66b5 (patch)
tree99f57f6374a58022e1e5ed1cbc12699288c7eae1 /drivers/net/usb
parent8e5574211d96c0552f84c757718475fdb4021be7 (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/usb')
-rw-r--r--drivers/net/usb/asix.c12
-rw-r--r--drivers/net/usb/catc.c4
-rw-r--r--drivers/net/usb/int51x1.c2
-rw-r--r--drivers/net/usb/kaweth.c2
-rw-r--r--drivers/net/usb/mcs7830.c6
-rw-r--r--drivers/net/usb/pegasus.c2
-rw-r--r--drivers/net/usb/rtl8150.c2
-rw-r--r--drivers/net/usb/smsc95xx.c4
8 files changed, 18 insertions, 16 deletions
diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c
index a516185cbc9f..f02551713b13 100644
--- a/drivers/net/usb/asix.c
+++ b/drivers/net/usb/asix.c
@@ -542,9 +542,9 @@ static void asix_set_multicast(struct net_device *net)
542 if (net->flags & IFF_PROMISC) { 542 if (net->flags & IFF_PROMISC) {
543 rx_ctl |= AX_RX_CTL_PRO; 543 rx_ctl |= AX_RX_CTL_PRO;
544 } else if (net->flags & IFF_ALLMULTI || 544 } else if (net->flags & IFF_ALLMULTI ||
545 net->mc_count > AX_MAX_MCAST) { 545 netdev_mc_count(net) > AX_MAX_MCAST) {
546 rx_ctl |= AX_RX_CTL_AMALL; 546 rx_ctl |= AX_RX_CTL_AMALL;
547 } else if (net->mc_count == 0) { 547 } else if (netdev_mc_empty(net)) {
548 /* just broadcast and directed */ 548 /* just broadcast and directed */
549 } else { 549 } else {
550 /* We use the 20 byte dev->data 550 /* We use the 20 byte dev->data
@@ -558,7 +558,7 @@ static void asix_set_multicast(struct net_device *net)
558 memset(data->multi_filter, 0, AX_MCAST_FILTER_SIZE); 558 memset(data->multi_filter, 0, AX_MCAST_FILTER_SIZE);
559 559
560 /* Build the multicast hash filter. */ 560 /* Build the multicast hash filter. */
561 for (i = 0; i < net->mc_count; i++) { 561 for (i = 0; i < netdev_mc_count(net); i++) {
562 crc_bits = 562 crc_bits =
563 ether_crc(ETH_ALEN, 563 ether_crc(ETH_ALEN,
564 mc_list->dmi_addr) >> 26; 564 mc_list->dmi_addr) >> 26;
@@ -754,9 +754,9 @@ static void ax88172_set_multicast(struct net_device *net)
754 if (net->flags & IFF_PROMISC) { 754 if (net->flags & IFF_PROMISC) {
755 rx_ctl |= 0x01; 755 rx_ctl |= 0x01;
756 } else if (net->flags & IFF_ALLMULTI || 756 } else if (net->flags & IFF_ALLMULTI ||
757 net->mc_count > AX_MAX_MCAST) { 757 netdev_mc_count(net) > AX_MAX_MCAST) {
758 rx_ctl |= 0x02; 758 rx_ctl |= 0x02;
759 } else if (net->mc_count == 0) { 759 } else if (netdev_mc_empty(net)) {
760 /* just broadcast and directed */ 760 /* just broadcast and directed */
761 } else { 761 } else {
762 /* We use the 20 byte dev->data 762 /* We use the 20 byte dev->data
@@ -770,7 +770,7 @@ static void ax88172_set_multicast(struct net_device *net)
770 memset(data->multi_filter, 0, AX_MCAST_FILTER_SIZE); 770 memset(data->multi_filter, 0, AX_MCAST_FILTER_SIZE);
771 771
772 /* Build the multicast hash filter. */ 772 /* Build the multicast hash filter. */
773 for (i = 0; i < net->mc_count; i++) { 773 for (i = 0; i < netdev_mc_count(net); i++) {
774 crc_bits = 774 crc_bits =
775 ether_crc(ETH_ALEN, 775 ether_crc(ETH_ALEN,
776 mc_list->dmi_addr) >> 26; 776 mc_list->dmi_addr) >> 26;
diff --git a/drivers/net/usb/catc.c b/drivers/net/usb/catc.c
index 7d3fa06980c1..5a13660ebd17 100644
--- a/drivers/net/usb/catc.c
+++ b/drivers/net/usb/catc.c
@@ -648,7 +648,9 @@ static void catc_set_multicast_list(struct net_device *netdev)
648 if (netdev->flags & IFF_ALLMULTI) { 648 if (netdev->flags & IFF_ALLMULTI) {
649 memset(catc->multicast, 0xff, 64); 649 memset(catc->multicast, 0xff, 64);
650 } else { 650 } else {
651 for (i = 0, mc = netdev->mc_list; mc && i < netdev->mc_count; i++, mc = mc->next) { 651 for (i = 0, mc = netdev->mc_list;
652 mc && i < netdev_mc_count(netdev);
653 i++, mc = mc->next) {
652 u32 crc = ether_crc_le(6, mc->dmi_addr); 654 u32 crc = ether_crc_le(6, mc->dmi_addr);
653 if (!catc->is_f5u011) { 655 if (!catc->is_f5u011) {
654 catc->multicast[(crc >> 3) & 0x3f] |= 1 << (crc & 7); 656 catc->multicast[(crc >> 3) & 0x3f] |= 1 << (crc & 7);
diff --git a/drivers/net/usb/int51x1.c b/drivers/net/usb/int51x1.c
index 55cf7081de10..9ab5c1983a7d 100644
--- a/drivers/net/usb/int51x1.c
+++ b/drivers/net/usb/int51x1.c
@@ -139,7 +139,7 @@ static void int51x1_set_multicast(struct net_device *netdev)
139 /* do not expect to see traffic of other PLCs */ 139 /* do not expect to see traffic of other PLCs */
140 filter |= PACKET_TYPE_PROMISCUOUS; 140 filter |= PACKET_TYPE_PROMISCUOUS;
141 devinfo(dev, "promiscuous mode enabled"); 141 devinfo(dev, "promiscuous mode enabled");
142 } else if (netdev->mc_count || 142 } else if (!netdev_mc_empty(netdev) ||
143 (netdev->flags & IFF_ALLMULTI)) { 143 (netdev->flags & IFF_ALLMULTI)) {
144 filter |= PACKET_TYPE_ALL_MULTICAST; 144 filter |= PACKET_TYPE_ALL_MULTICAST;
145 devdbg(dev, "receive all multicast enabled"); 145 devdbg(dev, "receive all multicast enabled");
diff --git a/drivers/net/usb/kaweth.c b/drivers/net/usb/kaweth.c
index f1d64ef67efa..52671ea043a7 100644
--- a/drivers/net/usb/kaweth.c
+++ b/drivers/net/usb/kaweth.c
@@ -881,7 +881,7 @@ static void kaweth_set_rx_mode(struct net_device *net)
881 if (net->flags & IFF_PROMISC) { 881 if (net->flags & IFF_PROMISC) {
882 packet_filter_bitmap |= KAWETH_PACKET_FILTER_PROMISCUOUS; 882 packet_filter_bitmap |= KAWETH_PACKET_FILTER_PROMISCUOUS;
883 } 883 }
884 else if ((net->mc_count) || (net->flags & IFF_ALLMULTI)) { 884 else if (!netdev_mc_empty(net) || (net->flags & IFF_ALLMULTI)) {
885 packet_filter_bitmap |= KAWETH_PACKET_FILTER_ALL_MULTICAST; 885 packet_filter_bitmap |= KAWETH_PACKET_FILTER_ALL_MULTICAST;
886 } 886 }
887 887
diff --git a/drivers/net/usb/mcs7830.c b/drivers/net/usb/mcs7830.c
index 6fc098fe9ff7..34665137f2c3 100644
--- a/drivers/net/usb/mcs7830.c
+++ b/drivers/net/usb/mcs7830.c
@@ -443,9 +443,9 @@ static void mcs7830_data_set_multicast(struct net_device *net)
443 if (net->flags & IFF_PROMISC) { 443 if (net->flags & IFF_PROMISC) {
444 data->config |= HIF_REG_CONFIG_PROMISCUOUS; 444 data->config |= HIF_REG_CONFIG_PROMISCUOUS;
445 } else if (net->flags & IFF_ALLMULTI || 445 } else if (net->flags & IFF_ALLMULTI ||
446 net->mc_count > MCS7830_MAX_MCAST) { 446 netdev_mc_count(net) > MCS7830_MAX_MCAST) {
447 data->config |= HIF_REG_CONFIG_ALLMULTICAST; 447 data->config |= HIF_REG_CONFIG_ALLMULTICAST;
448 } else if (net->mc_count == 0) { 448 } else if (netdev_mc_empty(net)) {
449 /* just broadcast and directed */ 449 /* just broadcast and directed */
450 } else { 450 } else {
451 /* We use the 20 byte dev->data 451 /* We use the 20 byte dev->data
@@ -457,7 +457,7 @@ static void mcs7830_data_set_multicast(struct net_device *net)
457 int i; 457 int i;
458 458
459 /* Build the multicast hash filter. */ 459 /* Build the multicast hash filter. */
460 for (i = 0; i < net->mc_count; i++) { 460 for (i = 0; i < netdev_mc_count(net); i++) {
461 crc_bits = ether_crc(ETH_ALEN, mc_list->dmi_addr) >> 26; 461 crc_bits = ether_crc(ETH_ALEN, mc_list->dmi_addr) >> 26;
462 data->multi_filter[crc_bits >> 3] |= 1 << (crc_bits & 7); 462 data->multi_filter[crc_bits >> 3] |= 1 << (crc_bits & 7);
463 mc_list = mc_list->next; 463 mc_list = mc_list->next;
diff --git a/drivers/net/usb/pegasus.c b/drivers/net/usb/pegasus.c
index ed4a508ef262..44ae8f6d3135 100644
--- a/drivers/net/usb/pegasus.c
+++ b/drivers/net/usb/pegasus.c
@@ -1232,7 +1232,7 @@ static void pegasus_set_multicast(struct net_device *net)
1232 pegasus->eth_regs[EthCtrl2] |= RX_PROMISCUOUS; 1232 pegasus->eth_regs[EthCtrl2] |= RX_PROMISCUOUS;
1233 if (netif_msg_link(pegasus)) 1233 if (netif_msg_link(pegasus))
1234 pr_info("%s: Promiscuous mode enabled.\n", net->name); 1234 pr_info("%s: Promiscuous mode enabled.\n", net->name);
1235 } else if (net->mc_count || (net->flags & IFF_ALLMULTI)) { 1235 } else if (!netdev_mc_empty(net) || (net->flags & IFF_ALLMULTI)) {
1236 pegasus->eth_regs[EthCtrl0] |= RX_MULTICAST; 1236 pegasus->eth_regs[EthCtrl0] |= RX_MULTICAST;
1237 pegasus->eth_regs[EthCtrl2] &= ~RX_PROMISCUOUS; 1237 pegasus->eth_regs[EthCtrl2] &= ~RX_PROMISCUOUS;
1238 if (netif_msg_link(pegasus)) 1238 if (netif_msg_link(pegasus))
diff --git a/drivers/net/usb/rtl8150.c b/drivers/net/usb/rtl8150.c
index 21ac103fbb71..e85c89c6706d 100644
--- a/drivers/net/usb/rtl8150.c
+++ b/drivers/net/usb/rtl8150.c
@@ -711,7 +711,7 @@ static void rtl8150_set_multicast(struct net_device *netdev)
711 if (netdev->flags & IFF_PROMISC) { 711 if (netdev->flags & IFF_PROMISC) {
712 dev->rx_creg |= cpu_to_le16(0x0001); 712 dev->rx_creg |= cpu_to_le16(0x0001);
713 dev_info(&netdev->dev, "%s: promiscuous mode\n", netdev->name); 713 dev_info(&netdev->dev, "%s: promiscuous mode\n", netdev->name);
714 } else if (netdev->mc_count || 714 } else if (!netdev_mc_empty(netdev) ||
715 (netdev->flags & IFF_ALLMULTI)) { 715 (netdev->flags & IFF_ALLMULTI)) {
716 dev->rx_creg &= cpu_to_le16(0xfffe); 716 dev->rx_creg &= cpu_to_le16(0xfffe);
717 dev->rx_creg |= cpu_to_le16(0x0002); 717 dev->rx_creg |= cpu_to_le16(0x0002);
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index 0c3c738d7419..48555d0e374d 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -384,7 +384,7 @@ static void smsc95xx_set_multicast(struct net_device *netdev)
384 devdbg(dev, "receive all multicast enabled"); 384 devdbg(dev, "receive all multicast enabled");
385 pdata->mac_cr |= MAC_CR_MCPAS_; 385 pdata->mac_cr |= MAC_CR_MCPAS_;
386 pdata->mac_cr &= ~(MAC_CR_PRMS_ | MAC_CR_HPFILT_); 386 pdata->mac_cr &= ~(MAC_CR_PRMS_ | MAC_CR_HPFILT_);
387 } else if (dev->net->mc_count > 0) { 387 } else if (!netdev_mc_empty(dev->net)) {
388 struct dev_mc_list *mc_list = dev->net->mc_list; 388 struct dev_mc_list *mc_list = dev->net->mc_list;
389 int count = 0; 389 int count = 0;
390 390
@@ -406,7 +406,7 @@ static void smsc95xx_set_multicast(struct net_device *netdev)
406 mc_list = mc_list->next; 406 mc_list = mc_list->next;
407 } 407 }
408 408
409 if (count != ((u32)dev->net->mc_count)) 409 if (count != ((u32) netdev_mc_count(dev->net)))
410 devwarn(dev, "mc_count != dev->mc_count"); 410 devwarn(dev, "mc_count != dev->mc_count");
411 411
412 if (netif_msg_drv(dev)) 412 if (netif_msg_drv(dev))