aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/cassini.c40
-rw-r--r--drivers/net/cassini.h2
2 files changed, 21 insertions, 21 deletions
diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c
index 6e295fce5c6f..8f1573e658a5 100644
--- a/drivers/net/cassini.c
+++ b/drivers/net/cassini.c
@@ -91,6 +91,7 @@
91#include <linux/mii.h> 91#include <linux/mii.h>
92#include <linux/ip.h> 92#include <linux/ip.h>
93#include <linux/tcp.h> 93#include <linux/tcp.h>
94#include <linux/mutex.h>
94 95
95#include <net/checksum.h> 96#include <net/checksum.h>
96 97
@@ -3892,7 +3893,7 @@ static void cas_reset(struct cas *cp, int blkflag)
3892 spin_unlock(&cp->stat_lock[N_TX_RINGS]); 3893 spin_unlock(&cp->stat_lock[N_TX_RINGS]);
3893} 3894}
3894 3895
3895/* Shut down the chip, must be called with pm_sem held. */ 3896/* Shut down the chip, must be called with pm_mutex held. */
3896static void cas_shutdown(struct cas *cp) 3897static void cas_shutdown(struct cas *cp)
3897{ 3898{
3898 unsigned long flags; 3899 unsigned long flags;
@@ -4311,11 +4312,11 @@ static int cas_open(struct net_device *dev)
4311 int hw_was_up, err; 4312 int hw_was_up, err;
4312 unsigned long flags; 4313 unsigned long flags;
4313 4314
4314 down(&cp->pm_sem); 4315 mutex_lock(&cp->pm_mutex);
4315 4316
4316 hw_was_up = cp->hw_running; 4317 hw_was_up = cp->hw_running;
4317 4318
4318 /* The power-management semaphore protects the hw_running 4319 /* The power-management mutex protects the hw_running
4319 * etc. state so it is safe to do this bit without cp->lock 4320 * etc. state so it is safe to do this bit without cp->lock
4320 */ 4321 */
4321 if (!cp->hw_running) { 4322 if (!cp->hw_running) {
@@ -4364,7 +4365,7 @@ static int cas_open(struct net_device *dev)
4364 cas_unlock_all_restore(cp, flags); 4365 cas_unlock_all_restore(cp, flags);
4365 4366
4366 netif_start_queue(dev); 4367 netif_start_queue(dev);
4367 up(&cp->pm_sem); 4368 mutex_unlock(&cp->pm_mutex);
4368 return 0; 4369 return 0;
4369 4370
4370err_spare: 4371err_spare:
@@ -4372,7 +4373,7 @@ err_spare:
4372 cas_free_rxds(cp); 4373 cas_free_rxds(cp);
4373err_tx_tiny: 4374err_tx_tiny:
4374 cas_tx_tiny_free(cp); 4375 cas_tx_tiny_free(cp);
4375 up(&cp->pm_sem); 4376 mutex_unlock(&cp->pm_mutex);
4376 return err; 4377 return err;
4377} 4378}
4378 4379
@@ -4382,7 +4383,7 @@ static int cas_close(struct net_device *dev)
4382 struct cas *cp = netdev_priv(dev); 4383 struct cas *cp = netdev_priv(dev);
4383 4384
4384 /* Make sure we don't get distracted by suspend/resume */ 4385 /* Make sure we don't get distracted by suspend/resume */
4385 down(&cp->pm_sem); 4386 mutex_lock(&cp->pm_mutex);
4386 4387
4387 netif_stop_queue(dev); 4388 netif_stop_queue(dev);
4388 4389
@@ -4399,7 +4400,7 @@ static int cas_close(struct net_device *dev)
4399 cas_spare_free(cp); 4400 cas_spare_free(cp);
4400 cas_free_rxds(cp); 4401 cas_free_rxds(cp);
4401 cas_tx_tiny_free(cp); 4402 cas_tx_tiny_free(cp);
4402 up(&cp->pm_sem); 4403 mutex_unlock(&cp->pm_mutex);
4403 return 0; 4404 return 0;
4404} 4405}
4405 4406
@@ -4834,10 +4835,10 @@ static int cas_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
4834 unsigned long flags; 4835 unsigned long flags;
4835 int rc = -EOPNOTSUPP; 4836 int rc = -EOPNOTSUPP;
4836 4837
4837 /* Hold the PM semaphore while doing ioctl's or we may collide 4838 /* Hold the PM mutex while doing ioctl's or we may collide
4838 * with open/close and power management and oops. 4839 * with open/close and power management and oops.
4839 */ 4840 */
4840 down(&cp->pm_sem); 4841 mutex_lock(&cp->pm_mutex);
4841 switch (cmd) { 4842 switch (cmd) {
4842 case SIOCGMIIPHY: /* Get address of MII PHY in use. */ 4843 case SIOCGMIIPHY: /* Get address of MII PHY in use. */
4843 data->phy_id = cp->phy_addr; 4844 data->phy_id = cp->phy_addr;
@@ -4867,7 +4868,7 @@ static int cas_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
4867 break; 4868 break;
4868 }; 4869 };
4869 4870
4870 up(&cp->pm_sem); 4871 mutex_unlock(&cp->pm_mutex);
4871 return rc; 4872 return rc;
4872} 4873}
4873 4874
@@ -4994,7 +4995,7 @@ static int __devinit cas_init_one(struct pci_dev *pdev,
4994 spin_lock_init(&cp->tx_lock[i]); 4995 spin_lock_init(&cp->tx_lock[i]);
4995 } 4996 }
4996 spin_lock_init(&cp->stat_lock[N_TX_RINGS]); 4997 spin_lock_init(&cp->stat_lock[N_TX_RINGS]);
4997 init_MUTEX(&cp->pm_sem); 4998 mutex_init(&cp->pm_mutex);
4998 4999
4999 init_timer(&cp->link_timer); 5000 init_timer(&cp->link_timer);
5000 cp->link_timer.function = cas_link_timer; 5001 cp->link_timer.function = cas_link_timer;
@@ -5116,10 +5117,10 @@ err_out_free_consistent:
5116 cp->init_block, cp->block_dvma); 5117 cp->init_block, cp->block_dvma);
5117 5118
5118err_out_iounmap: 5119err_out_iounmap:
5119 down(&cp->pm_sem); 5120 mutex_lock(&cp->pm_mutex);
5120 if (cp->hw_running) 5121 if (cp->hw_running)
5121 cas_shutdown(cp); 5122 cas_shutdown(cp);
5122 up(&cp->pm_sem); 5123 mutex_unlock(&cp->pm_mutex);
5123 5124
5124 iounmap(cp->regs); 5125 iounmap(cp->regs);
5125 5126
@@ -5152,11 +5153,11 @@ static void __devexit cas_remove_one(struct pci_dev *pdev)
5152 cp = netdev_priv(dev); 5153 cp = netdev_priv(dev);
5153 unregister_netdev(dev); 5154 unregister_netdev(dev);
5154 5155
5155 down(&cp->pm_sem); 5156 mutex_lock(&cp->pm_mutex);
5156 flush_scheduled_work(); 5157 flush_scheduled_work();
5157 if (cp->hw_running) 5158 if (cp->hw_running)
5158 cas_shutdown(cp); 5159 cas_shutdown(cp);
5159 up(&cp->pm_sem); 5160 mutex_unlock(&cp->pm_mutex);
5160 5161
5161#if 1 5162#if 1
5162 if (cp->orig_cacheline_size) { 5163 if (cp->orig_cacheline_size) {
@@ -5183,10 +5184,7 @@ static int cas_suspend(struct pci_dev *pdev, pm_message_t state)
5183 struct cas *cp = netdev_priv(dev); 5184 struct cas *cp = netdev_priv(dev);
5184 unsigned long flags; 5185 unsigned long flags;
5185 5186
5186 /* We hold the PM semaphore during entire driver 5187 mutex_lock(&cp->pm_mutex);
5187 * sleep time
5188 */
5189 down(&cp->pm_sem);
5190 5188
5191 /* If the driver is opened, we stop the DMA */ 5189 /* If the driver is opened, we stop the DMA */
5192 if (cp->opened) { 5190 if (cp->opened) {
@@ -5206,6 +5204,7 @@ static int cas_suspend(struct pci_dev *pdev, pm_message_t state)
5206 5204
5207 if (cp->hw_running) 5205 if (cp->hw_running)
5208 cas_shutdown(cp); 5206 cas_shutdown(cp);
5207 mutex_unlock(&cp->pm_mutex);
5209 5208
5210 return 0; 5209 return 0;
5211} 5210}
@@ -5217,6 +5216,7 @@ static int cas_resume(struct pci_dev *pdev)
5217 5216
5218 printk(KERN_INFO "%s: resuming\n", dev->name); 5217 printk(KERN_INFO "%s: resuming\n", dev->name);
5219 5218
5219 mutex_lock(&cp->pm_mutex);
5220 cas_hard_reset(cp); 5220 cas_hard_reset(cp);
5221 if (cp->opened) { 5221 if (cp->opened) {
5222 unsigned long flags; 5222 unsigned long flags;
@@ -5229,7 +5229,7 @@ static int cas_resume(struct pci_dev *pdev)
5229 5229
5230 netif_device_attach(dev); 5230 netif_device_attach(dev);
5231 } 5231 }
5232 up(&cp->pm_sem); 5232 mutex_unlock(&cp->pm_mutex);
5233 return 0; 5233 return 0;
5234} 5234}
5235#endif /* CONFIG_PM */ 5235#endif /* CONFIG_PM */
diff --git a/drivers/net/cassini.h b/drivers/net/cassini.h
index 88063ef16cf6..ab55c7ee1012 100644
--- a/drivers/net/cassini.h
+++ b/drivers/net/cassini.h
@@ -4284,7 +4284,7 @@ struct cas {
4284 * (ie. not power managed) */ 4284 * (ie. not power managed) */
4285 int hw_running; 4285 int hw_running;
4286 int opened; 4286 int opened;
4287 struct semaphore pm_sem; /* open/close/suspend/resume */ 4287 struct mutex pm_mutex; /* open/close/suspend/resume */
4288 4288
4289 struct cas_init_block *init_block; 4289 struct cas_init_block *init_block;
4290 struct cas_tx_desc *init_txds[MAX_TX_RINGS]; 4290 struct cas_tx_desc *init_txds[MAX_TX_RINGS];