diff options
Diffstat (limited to 'driver/aim-network/networking.c')
-rw-r--r-- | driver/aim-network/networking.c | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/driver/aim-network/networking.c b/driver/aim-network/networking.c index 2f42de4..844259e 100644 --- a/driver/aim-network/networking.c +++ b/driver/aim-network/networking.c @@ -298,15 +298,16 @@ static struct net_dev_context *get_net_dev_context( struct most_interface *iface) { struct net_dev_context *nd, *tmp; + unsigned long flags; - spin_lock(&list_lock); + spin_lock_irqsave(&list_lock, flags); list_for_each_entry_safe(nd, tmp, &net_devices, list) { if (nd->iface == iface) { - spin_unlock(&list_lock); + spin_unlock_irqrestore(&list_lock, flags); return nd; } } - spin_unlock(&list_lock); + spin_unlock_irqrestore(&list_lock, flags); return NULL; } @@ -316,6 +317,7 @@ static int aim_probe_channel(struct most_interface *iface, int channel_idx, { struct net_dev_context *nd; struct net_dev_channel *ch; + unsigned long flags; if (!iface) return -EINVAL; @@ -332,9 +334,9 @@ static int aim_probe_channel(struct most_interface *iface, int channel_idx, nd->iface = iface; - spin_lock(&list_lock); + spin_lock_irqsave(&list_lock, flags); list_add(&nd->list, &net_devices); - spin_unlock(&list_lock); + spin_unlock_irqrestore(&list_lock, flags); } ch = ccfg->direction == MOST_CH_TX ? &nd->tx : &nd->rx; @@ -345,8 +347,7 @@ static int aim_probe_channel(struct most_interface *iface, int channel_idx, if (nd->tx.linked || nd->rx.linked) { struct net_device *dev = - alloc_netdev(0, "meth%d", NET_NAME_UNKNOWN, - most_nd_setup); + alloc_netdev(0, "meth%d", most_nd_setup); if (!dev) { pr_err("no memory for net_device\n"); @@ -377,6 +378,7 @@ static int aim_disconnect_channel(struct most_interface *iface, { struct net_dev_context *nd; struct net_dev_channel *ch; + unsigned long flags; nd = get_net_dev_context(iface); if (!nd) @@ -398,9 +400,9 @@ static int aim_disconnect_channel(struct most_interface *iface, most_net_rm_netdev_safe(nd); if (!nd->rx.linked && !nd->tx.linked) { - spin_lock(&list_lock); + spin_lock_irqsave(&list_lock, flags); list_del(&nd->list); - spin_unlock(&list_lock); + spin_unlock_irqrestore(&list_lock, flags); kfree(nd); } @@ -465,7 +467,7 @@ static int aim_rx_data(struct mbo *mbo) if (nd->is_mamac) { /* dest */ - ether_addr_copy(skb_put(skb, ETH_ALEN), dev->dev_addr); + memcpy(skb_put(skb, ETH_ALEN), dev->dev_addr, ETH_ALEN); /* src */ memcpy(skb_put(skb, 4), &zero, 4); @@ -514,20 +516,21 @@ static int __init most_net_init(void) static void __exit most_net_exit(void) { struct net_dev_context *nd, *tmp; + unsigned long flags; - spin_lock(&list_lock); + spin_lock_irqsave(&list_lock, flags); list_for_each_entry_safe(nd, tmp, &net_devices, list) { list_del(&nd->list); - spin_unlock(&list_lock); + spin_unlock_irqrestore(&list_lock, flags); /* * do not call most_stop_channel() here, because channels are * going to be closed in ndo_stop() after unregister_netdev() */ most_net_rm_netdev_safe(nd); kfree(nd); - spin_lock(&list_lock); + spin_lock_irqsave(&list_lock, flags); } - spin_unlock(&list_lock); + spin_unlock_irqrestore(&list_lock, flags); most_deregister_aim(&aim); pr_info("most_net_exit()\n"); @@ -556,7 +559,7 @@ void most_deliver_netinfo(struct most_interface *iface, return; if (mac_addr) - ether_addr_copy(dev->dev_addr, mac_addr); + memcpy(dev->dev_addr, mac_addr, ETH_ALEN); if (nd->link_stat != link_stat) { nd->link_stat = link_stat; |