diff options
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/macb.c | 37 | ||||
-rw-r--r-- | drivers/net/ppp_generic.c | 2 | ||||
-rw-r--r-- | drivers/net/tun.c | 13 | ||||
-rw-r--r-- | drivers/net/wan/cosa.c | 22 | ||||
-rw-r--r-- | drivers/net/xen-netfront.c | 4 |
5 files changed, 66 insertions, 12 deletions
diff --git a/drivers/net/macb.c b/drivers/net/macb.c index 92dccd43bdca..0a5745a854c7 100644 --- a/drivers/net/macb.c +++ b/drivers/net/macb.c | |||
@@ -1277,8 +1277,45 @@ static int __exit macb_remove(struct platform_device *pdev) | |||
1277 | return 0; | 1277 | return 0; |
1278 | } | 1278 | } |
1279 | 1279 | ||
1280 | #ifdef CONFIG_PM | ||
1281 | static int macb_suspend(struct platform_device *pdev, pm_message_t state) | ||
1282 | { | ||
1283 | struct net_device *netdev = platform_get_drvdata(pdev); | ||
1284 | struct macb *bp = netdev_priv(netdev); | ||
1285 | |||
1286 | netif_device_detach(netdev); | ||
1287 | |||
1288 | #ifndef CONFIG_ARCH_AT91 | ||
1289 | clk_disable(bp->hclk); | ||
1290 | #endif | ||
1291 | clk_disable(bp->pclk); | ||
1292 | |||
1293 | return 0; | ||
1294 | } | ||
1295 | |||
1296 | static int macb_resume(struct platform_device *pdev) | ||
1297 | { | ||
1298 | struct net_device *netdev = platform_get_drvdata(pdev); | ||
1299 | struct macb *bp = netdev_priv(netdev); | ||
1300 | |||
1301 | clk_enable(bp->pclk); | ||
1302 | #ifndef CONFIG_ARCH_AT91 | ||
1303 | clk_enable(bp->hclk); | ||
1304 | #endif | ||
1305 | |||
1306 | netif_device_attach(netdev); | ||
1307 | |||
1308 | return 0; | ||
1309 | } | ||
1310 | #else | ||
1311 | #define macb_suspend NULL | ||
1312 | #define macb_resume NULL | ||
1313 | #endif | ||
1314 | |||
1280 | static struct platform_driver macb_driver = { | 1315 | static struct platform_driver macb_driver = { |
1281 | .remove = __exit_p(macb_remove), | 1316 | .remove = __exit_p(macb_remove), |
1317 | .suspend = macb_suspend, | ||
1318 | .resume = macb_resume, | ||
1282 | .driver = { | 1319 | .driver = { |
1283 | .name = "macb", | 1320 | .name = "macb", |
1284 | .owner = THIS_MODULE, | 1321 | .owner = THIS_MODULE, |
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c index 1f4ca2b54a73..83625fdff3dd 100644 --- a/drivers/net/ppp_generic.c +++ b/drivers/net/ppp_generic.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <linux/if_arp.h> | 39 | #include <linux/if_arp.h> |
40 | #include <linux/ip.h> | 40 | #include <linux/ip.h> |
41 | #include <linux/tcp.h> | 41 | #include <linux/tcp.h> |
42 | #include <linux/smp_lock.h> | ||
42 | #include <linux/spinlock.h> | 43 | #include <linux/spinlock.h> |
43 | #include <linux/rwsem.h> | 44 | #include <linux/rwsem.h> |
44 | #include <linux/stddef.h> | 45 | #include <linux/stddef.h> |
@@ -353,6 +354,7 @@ static const int npindex_to_ethertype[NUM_NP] = { | |||
353 | */ | 354 | */ |
354 | static int ppp_open(struct inode *inode, struct file *file) | 355 | static int ppp_open(struct inode *inode, struct file *file) |
355 | { | 356 | { |
357 | cycle_kernel_lock(); | ||
356 | /* | 358 | /* |
357 | * This could (should?) be enforced by the permissions on /dev/ppp. | 359 | * This could (should?) be enforced by the permissions on /dev/ppp. |
358 | */ | 360 | */ |
diff --git a/drivers/net/tun.c b/drivers/net/tun.c index b9018bfa0a97..eba1271b9735 100644 --- a/drivers/net/tun.c +++ b/drivers/net/tun.c | |||
@@ -48,6 +48,7 @@ | |||
48 | #include <linux/kernel.h> | 48 | #include <linux/kernel.h> |
49 | #include <linux/major.h> | 49 | #include <linux/major.h> |
50 | #include <linux/slab.h> | 50 | #include <linux/slab.h> |
51 | #include <linux/smp_lock.h> | ||
51 | #include <linux/poll.h> | 52 | #include <linux/poll.h> |
52 | #include <linux/fcntl.h> | 53 | #include <linux/fcntl.h> |
53 | #include <linux/init.h> | 54 | #include <linux/init.h> |
@@ -802,22 +803,26 @@ static int tun_chr_fasync(int fd, struct file *file, int on) | |||
802 | 803 | ||
803 | DBG(KERN_INFO "%s: tun_chr_fasync %d\n", tun->dev->name, on); | 804 | DBG(KERN_INFO "%s: tun_chr_fasync %d\n", tun->dev->name, on); |
804 | 805 | ||
806 | lock_kernel(); | ||
805 | if ((ret = fasync_helper(fd, file, on, &tun->fasync)) < 0) | 807 | if ((ret = fasync_helper(fd, file, on, &tun->fasync)) < 0) |
806 | return ret; | 808 | goto out; |
807 | 809 | ||
808 | if (on) { | 810 | if (on) { |
809 | ret = __f_setown(file, task_pid(current), PIDTYPE_PID, 0); | 811 | ret = __f_setown(file, task_pid(current), PIDTYPE_PID, 0); |
810 | if (ret) | 812 | if (ret) |
811 | return ret; | 813 | goto out; |
812 | tun->flags |= TUN_FASYNC; | 814 | tun->flags |= TUN_FASYNC; |
813 | } else | 815 | } else |
814 | tun->flags &= ~TUN_FASYNC; | 816 | tun->flags &= ~TUN_FASYNC; |
815 | 817 | ret = 0; | |
816 | return 0; | 818 | out: |
819 | unlock_kernel(); | ||
820 | return ret; | ||
817 | } | 821 | } |
818 | 822 | ||
819 | static int tun_chr_open(struct inode *inode, struct file * file) | 823 | static int tun_chr_open(struct inode *inode, struct file * file) |
820 | { | 824 | { |
825 | cycle_kernel_lock(); | ||
821 | DBG1(KERN_INFO "tunX: tun_chr_open\n"); | 826 | DBG1(KERN_INFO "tunX: tun_chr_open\n"); |
822 | file->private_data = NULL; | 827 | file->private_data = NULL; |
823 | return 0; | 828 | return 0; |
diff --git a/drivers/net/wan/cosa.c b/drivers/net/wan/cosa.c index b0fce1387eaf..5827324e9d9f 100644 --- a/drivers/net/wan/cosa.c +++ b/drivers/net/wan/cosa.c | |||
@@ -92,6 +92,7 @@ | |||
92 | #include <linux/spinlock.h> | 92 | #include <linux/spinlock.h> |
93 | #include <linux/mutex.h> | 93 | #include <linux/mutex.h> |
94 | #include <linux/device.h> | 94 | #include <linux/device.h> |
95 | #include <linux/smp_lock.h> | ||
95 | 96 | ||
96 | #undef COSA_SLOW_IO /* for testing purposes only */ | 97 | #undef COSA_SLOW_IO /* for testing purposes only */ |
97 | 98 | ||
@@ -970,15 +971,21 @@ static int cosa_open(struct inode *inode, struct file *file) | |||
970 | struct channel_data *chan; | 971 | struct channel_data *chan; |
971 | unsigned long flags; | 972 | unsigned long flags; |
972 | int n; | 973 | int n; |
974 | int ret = 0; | ||
973 | 975 | ||
976 | lock_kernel(); | ||
974 | if ((n=iminor(file->f_path.dentry->d_inode)>>CARD_MINOR_BITS) | 977 | if ((n=iminor(file->f_path.dentry->d_inode)>>CARD_MINOR_BITS) |
975 | >= nr_cards) | 978 | >= nr_cards) { |
976 | return -ENODEV; | 979 | ret = -ENODEV; |
980 | goto out; | ||
981 | } | ||
977 | cosa = cosa_cards+n; | 982 | cosa = cosa_cards+n; |
978 | 983 | ||
979 | if ((n=iminor(file->f_path.dentry->d_inode) | 984 | if ((n=iminor(file->f_path.dentry->d_inode) |
980 | & ((1<<CARD_MINOR_BITS)-1)) >= cosa->nchannels) | 985 | & ((1<<CARD_MINOR_BITS)-1)) >= cosa->nchannels) { |
981 | return -ENODEV; | 986 | ret = -ENODEV; |
987 | goto out; | ||
988 | } | ||
982 | chan = cosa->chan + n; | 989 | chan = cosa->chan + n; |
983 | 990 | ||
984 | file->private_data = chan; | 991 | file->private_data = chan; |
@@ -987,7 +994,8 @@ static int cosa_open(struct inode *inode, struct file *file) | |||
987 | 994 | ||
988 | if (chan->usage < 0) { /* in netdev mode */ | 995 | if (chan->usage < 0) { /* in netdev mode */ |
989 | spin_unlock_irqrestore(&cosa->lock, flags); | 996 | spin_unlock_irqrestore(&cosa->lock, flags); |
990 | return -EBUSY; | 997 | ret = -EBUSY; |
998 | goto out; | ||
991 | } | 999 | } |
992 | cosa->usage++; | 1000 | cosa->usage++; |
993 | chan->usage++; | 1001 | chan->usage++; |
@@ -996,7 +1004,9 @@ static int cosa_open(struct inode *inode, struct file *file) | |||
996 | chan->setup_rx = chrdev_setup_rx; | 1004 | chan->setup_rx = chrdev_setup_rx; |
997 | chan->rx_done = chrdev_rx_done; | 1005 | chan->rx_done = chrdev_rx_done; |
998 | spin_unlock_irqrestore(&cosa->lock, flags); | 1006 | spin_unlock_irqrestore(&cosa->lock, flags); |
999 | return 0; | 1007 | out: |
1008 | unlock_kernel(); | ||
1009 | return ret; | ||
1000 | } | 1010 | } |
1001 | 1011 | ||
1002 | static int cosa_release(struct inode *inode, struct file *file) | 1012 | static int cosa_release(struct inode *inode, struct file *file) |
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c index d26f69b0184f..ef671d1a3bf0 100644 --- a/drivers/net/xen-netfront.c +++ b/drivers/net/xen-netfront.c | |||
@@ -1324,7 +1324,7 @@ static int setup_netfront(struct xenbus_device *dev, struct netfront_info *info) | |||
1324 | goto fail; | 1324 | goto fail; |
1325 | } | 1325 | } |
1326 | 1326 | ||
1327 | txs = (struct xen_netif_tx_sring *)get_zeroed_page(GFP_KERNEL); | 1327 | txs = (struct xen_netif_tx_sring *)get_zeroed_page(GFP_NOIO | __GFP_HIGH); |
1328 | if (!txs) { | 1328 | if (!txs) { |
1329 | err = -ENOMEM; | 1329 | err = -ENOMEM; |
1330 | xenbus_dev_fatal(dev, err, "allocating tx ring page"); | 1330 | xenbus_dev_fatal(dev, err, "allocating tx ring page"); |
@@ -1340,7 +1340,7 @@ static int setup_netfront(struct xenbus_device *dev, struct netfront_info *info) | |||
1340 | } | 1340 | } |
1341 | 1341 | ||
1342 | info->tx_ring_ref = err; | 1342 | info->tx_ring_ref = err; |
1343 | rxs = (struct xen_netif_rx_sring *)get_zeroed_page(GFP_KERNEL); | 1343 | rxs = (struct xen_netif_rx_sring *)get_zeroed_page(GFP_NOIO | __GFP_HIGH); |
1344 | if (!rxs) { | 1344 | if (!rxs) { |
1345 | err = -ENOMEM; | 1345 | err = -ENOMEM; |
1346 | xenbus_dev_fatal(dev, err, "allocating rx ring page"); | 1346 | xenbus_dev_fatal(dev, err, "allocating rx ring page"); |