aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wan
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wan')
-rw-r--r--drivers/net/wan/cosa.c14
-rw-r--r--drivers/net/wan/dlci.c2
-rw-r--r--drivers/net/wan/hdlc.c4
-rw-r--r--drivers/net/wan/lapbether.c4
-rw-r--r--drivers/net/wan/syncppp.c2
5 files changed, 14 insertions, 12 deletions
diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c
index 1d706eae3052..45ddfc9763cc 100644
--- a/drivers/net/wan/cosa.c
+++ b/drivers/net/wan/cosa.c
@@ -90,6 +90,7 @@
90#include <linux/ioport.h> 90#include <linux/ioport.h>
91#include <linux/netdevice.h> 91#include <linux/netdevice.h>
92#include <linux/spinlock.h> 92#include <linux/spinlock.h>
93#include <linux/mutex.h>
93#include <linux/device.h> 94#include <linux/device.h>
94 95
95#undef COSA_SLOW_IO /* for testing purposes only */ 96#undef COSA_SLOW_IO /* for testing purposes only */
@@ -127,7 +128,8 @@ struct channel_data {
127 int (*tx_done)(struct channel_data *channel, int size); 128 int (*tx_done)(struct channel_data *channel, int size);
128 129
129 /* Character device parts */ 130 /* Character device parts */
130 struct semaphore rsem, wsem; 131 struct mutex rlock;
132 struct semaphore wsem;
131 char *rxdata; 133 char *rxdata;
132 int rxsize; 134 int rxsize;
133 wait_queue_head_t txwaitq, rxwaitq; 135 wait_queue_head_t txwaitq, rxwaitq;
@@ -807,7 +809,7 @@ static struct net_device_stats *cosa_net_stats(struct net_device *dev)
807 809
808static void chardev_channel_init(struct channel_data *chan) 810static void chardev_channel_init(struct channel_data *chan)
809{ 811{
810 init_MUTEX(&chan->rsem); 812 mutex_init(&chan->rlock);
811 init_MUTEX(&chan->wsem); 813 init_MUTEX(&chan->wsem);
812} 814}
813 815
@@ -825,12 +827,12 @@ static ssize_t cosa_read(struct file *file,
825 cosa->name, cosa->firmware_status); 827 cosa->name, cosa->firmware_status);
826 return -EPERM; 828 return -EPERM;
827 } 829 }
828 if (down_interruptible(&chan->rsem)) 830 if (mutex_lock_interruptible(&chan->rlock))
829 return -ERESTARTSYS; 831 return -ERESTARTSYS;
830 832
831 if ((chan->rxdata = kmalloc(COSA_MTU, GFP_DMA|GFP_KERNEL)) == NULL) { 833 if ((chan->rxdata = kmalloc(COSA_MTU, GFP_DMA|GFP_KERNEL)) == NULL) {
832 printk(KERN_INFO "%s: cosa_read() - OOM\n", cosa->name); 834 printk(KERN_INFO "%s: cosa_read() - OOM\n", cosa->name);
833 up(&chan->rsem); 835 mutex_unlock(&chan->rlock);
834 return -ENOMEM; 836 return -ENOMEM;
835 } 837 }
836 838
@@ -848,7 +850,7 @@ static ssize_t cosa_read(struct file *file,
848 remove_wait_queue(&chan->rxwaitq, &wait); 850 remove_wait_queue(&chan->rxwaitq, &wait);
849 current->state = TASK_RUNNING; 851 current->state = TASK_RUNNING;
850 spin_unlock_irqrestore(&cosa->lock, flags); 852 spin_unlock_irqrestore(&cosa->lock, flags);
851 up(&chan->rsem); 853 mutex_unlock(&chan->rlock);
852 return -ERESTARTSYS; 854 return -ERESTARTSYS;
853 } 855 }
854 } 856 }
@@ -857,7 +859,7 @@ static ssize_t cosa_read(struct file *file,
857 kbuf = chan->rxdata; 859 kbuf = chan->rxdata;
858 count = chan->rxsize; 860 count = chan->rxsize;
859 spin_unlock_irqrestore(&cosa->lock, flags); 861 spin_unlock_irqrestore(&cosa->lock, flags);
860 up(&chan->rsem); 862 mutex_unlock(&chan->rlock);
861 863
862 if (copy_to_user(buf, kbuf, count)) { 864 if (copy_to_user(buf, kbuf, count)) {
863 kfree(kbuf); 865 kfree(kbuf);
diff --git a/drivers/net/wan/dlci.c b/drivers/net/wan/dlci.c
index 96b232446c0b..b14242768fad 100644
--- a/drivers/net/wan/dlci.c
+++ b/drivers/net/wan/dlci.c
@@ -517,7 +517,7 @@ static int dlci_dev_event(struct notifier_block *unused,
517{ 517{
518 struct net_device *dev = (struct net_device *) ptr; 518 struct net_device *dev = (struct net_device *) ptr;
519 519
520 if (dev->nd_net != &init_net) 520 if (dev_net(dev) != &init_net)
521 return NOTIFY_DONE; 521 return NOTIFY_DONE;
522 522
523 if (event == NETDEV_UNREGISTER) { 523 if (event == NETDEV_UNREGISTER) {
diff --git a/drivers/net/wan/hdlc.c b/drivers/net/wan/hdlc.c
index 39951d0c34d6..9a83c9d5b8cf 100644
--- a/drivers/net/wan/hdlc.c
+++ b/drivers/net/wan/hdlc.c
@@ -68,7 +68,7 @@ static int hdlc_rcv(struct sk_buff *skb, struct net_device *dev,
68{ 68{
69 struct hdlc_device *hdlc = dev_to_hdlc(dev); 69 struct hdlc_device *hdlc = dev_to_hdlc(dev);
70 70
71 if (dev->nd_net != &init_net) { 71 if (dev_net(dev) != &init_net) {
72 kfree_skb(skb); 72 kfree_skb(skb);
73 return 0; 73 return 0;
74 } 74 }
@@ -105,7 +105,7 @@ static int hdlc_device_event(struct notifier_block *this, unsigned long event,
105 unsigned long flags; 105 unsigned long flags;
106 int on; 106 int on;
107 107
108 if (dev->nd_net != &init_net) 108 if (dev_net(dev) != &init_net)
109 return NOTIFY_DONE; 109 return NOTIFY_DONE;
110 110
111 if (dev->get_stats != hdlc_get_stats) 111 if (dev->get_stats != hdlc_get_stats)
diff --git a/drivers/net/wan/lapbether.c b/drivers/net/wan/lapbether.c
index 824df3b5ea49..b5860b97a93e 100644
--- a/drivers/net/wan/lapbether.c
+++ b/drivers/net/wan/lapbether.c
@@ -91,7 +91,7 @@ static int lapbeth_rcv(struct sk_buff *skb, struct net_device *dev, struct packe
91 int len, err; 91 int len, err;
92 struct lapbethdev *lapbeth; 92 struct lapbethdev *lapbeth;
93 93
94 if (dev->nd_net != &init_net) 94 if (dev_net(dev) != &init_net)
95 goto drop; 95 goto drop;
96 96
97 if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) 97 if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL)
@@ -393,7 +393,7 @@ static int lapbeth_device_event(struct notifier_block *this,
393 struct lapbethdev *lapbeth; 393 struct lapbethdev *lapbeth;
394 struct net_device *dev = ptr; 394 struct net_device *dev = ptr;
395 395
396 if (dev->nd_net != &init_net) 396 if (dev_net(dev) != &init_net)
397 return NOTIFY_DONE; 397 return NOTIFY_DONE;
398 398
399 if (!dev_is_ethdev(dev)) 399 if (!dev_is_ethdev(dev))
diff --git a/drivers/net/wan/syncppp.c b/drivers/net/wan/syncppp.c
index 61e24b7a45a3..29b4b94e4947 100644
--- a/drivers/net/wan/syncppp.c
+++ b/drivers/net/wan/syncppp.c
@@ -1444,7 +1444,7 @@ static void sppp_print_bytes (u_char *p, u16 len)
1444 1444
1445static int sppp_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *p, struct net_device *orig_dev) 1445static int sppp_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *p, struct net_device *orig_dev)
1446{ 1446{
1447 if (dev->nd_net != &init_net) { 1447 if (dev_net(dev) != &init_net) {
1448 kfree_skb(skb); 1448 kfree_skb(skb);
1449 return 0; 1449 return 0;
1450 } 1450 }