From 655ffee284dfcf9a24ac0343f3e5ee6db85b85c5 Mon Sep 17 00:00:00 2001 From: Jiri Pirko Date: Sat, 27 Feb 2010 07:35:45 +0000 Subject: wireless: convert to use netdev_for_each_mc_addr also added missed locking in rndis_wlan.c Signed-off-by: Jiri Pirko Signed-off-by: David S. Miller --- drivers/net/wireless/orinoco/hw.c | 22 +++++++--------------- drivers/net/wireless/orinoco/hw.h | 2 +- drivers/net/wireless/orinoco/main.c | 3 +-- 3 files changed, 9 insertions(+), 18 deletions(-) (limited to 'drivers/net/wireless/orinoco') diff --git a/drivers/net/wireless/orinoco/hw.c b/drivers/net/wireless/orinoco/hw.c index 404830f47ab2..e6369242e49c 100644 --- a/drivers/net/wireless/orinoco/hw.c +++ b/drivers/net/wireless/orinoco/hw.c @@ -1028,7 +1028,7 @@ int orinoco_clear_tkip_key(struct orinoco_private *priv, int key_idx) } int __orinoco_hw_set_multicast_list(struct orinoco_private *priv, - struct dev_addr_list *mc_list, + struct net_device *dev, int mc_count, int promisc) { hermes_t *hw = &priv->hw; @@ -1049,24 +1049,16 @@ int __orinoco_hw_set_multicast_list(struct orinoco_private *priv, * group address if either we want to multicast, or if we were * multicasting and want to stop */ if (!promisc && (mc_count || priv->mc_count)) { - struct dev_mc_list *p = mc_list; + struct dev_mc_list *p; struct hermes_multicast mclist; - int i; + int i = 0; - for (i = 0; i < mc_count; i++) { - /* paranoia: is list shorter than mc_count? */ - BUG_ON(!p); - /* paranoia: bad address size in list? */ - BUG_ON(p->dmi_addrlen != ETH_ALEN); - - memcpy(mclist.addr[i], p->dmi_addr, ETH_ALEN); - p = p->next; + netdev_for_each_mc_addr(p, dev) { + if (i == mc_count) + break; + memcpy(mclist.addr[i++], p->dmi_addr, ETH_ALEN); } - if (p) - printk(KERN_WARNING "%s: Multicast list is " - "longer than mc_count\n", priv->ndev->name); - err = hermes_write_ltv(hw, USER_BAP, HERMES_RID_CNFGROUPADDRESSES, HERMES_BYTES_TO_RECLEN(mc_count * ETH_ALEN), diff --git a/drivers/net/wireless/orinoco/hw.h b/drivers/net/wireless/orinoco/hw.h index e2f7fdc4d45a..9799a1d14a63 100644 --- a/drivers/net/wireless/orinoco/hw.h +++ b/drivers/net/wireless/orinoco/hw.h @@ -43,7 +43,7 @@ int __orinoco_hw_set_tkip_key(struct orinoco_private *priv, int key_idx, u8 *tsc, size_t tsc_len); int orinoco_clear_tkip_key(struct orinoco_private *priv, int key_idx); int __orinoco_hw_set_multicast_list(struct orinoco_private *priv, - struct dev_addr_list *mc_list, + struct net_device *dev, int mc_count, int promisc); int orinoco_hw_get_essid(struct orinoco_private *priv, int *active, char buf[IW_ESSID_MAX_SIZE+1]); diff --git a/drivers/net/wireless/orinoco/main.c b/drivers/net/wireless/orinoco/main.c index a9e9cea2d767..b42634c614b5 100644 --- a/drivers/net/wireless/orinoco/main.c +++ b/drivers/net/wireless/orinoco/main.c @@ -1676,8 +1676,7 @@ __orinoco_set_multicast_list(struct net_device *dev) mc_count = netdev_mc_count(dev); } - err = __orinoco_hw_set_multicast_list(priv, dev->mc_list, mc_count, - promisc); + err = __orinoco_hw_set_multicast_list(priv, dev, mc_count, promisc); return err; } -- cgit v1.2.2