aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/cassini.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/cassini.c')
-rw-r--r--drivers/net/cassini.c51
1 files changed, 26 insertions, 25 deletions
diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c
index 6e295fce5c6f..ac48f7543500 100644
--- a/drivers/net/cassini.c
+++ b/drivers/net/cassini.c
@@ -91,6 +91,7 @@
#include <linux/mii.h>
#include <linux/ip.h>
#include <linux/tcp.h>
+#include <linux/mutex.h>
#include <net/checksum.h>
@@ -191,12 +192,15 @@
static char version[] __devinitdata =
DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n";
+static int cassini_debug = -1; /* -1 == use CAS_DEF_MSG_ENABLE as value */
+static int link_mode;
+
MODULE_AUTHOR("Adrian Sun (asun@darksunrising.com)");
MODULE_DESCRIPTION("Sun Cassini(+) ethernet driver");
MODULE_LICENSE("GPL");
-MODULE_PARM(cassini_debug, "i");
+module_param(cassini_debug, int, 0);
MODULE_PARM_DESC(cassini_debug, "Cassini bitmapped debugging message enable value");
-MODULE_PARM(link_mode, "i");
+module_param(link_mode, int, 0);
MODULE_PARM_DESC(link_mode, "default link mode");
/*
@@ -208,7 +212,7 @@ MODULE_PARM_DESC(link_mode, "default link mode");
* Value in seconds, for user input.
*/
static int linkdown_timeout = DEFAULT_LINKDOWN_TIMEOUT;
-MODULE_PARM(linkdown_timeout, "i");
+module_param(linkdown_timeout, int, 0);
MODULE_PARM_DESC(linkdown_timeout,
"min reset interval in sec. for PCS linkdown issue; disabled if not positive");
@@ -220,8 +224,6 @@ MODULE_PARM_DESC(linkdown_timeout,
static int link_transition_timeout;
-static int cassini_debug = -1; /* -1 == use CAS_DEF_MSG_ENABLE as value */
-static int link_mode;
static u16 link_modes[] __devinitdata = {
BMCR_ANENABLE, /* 0 : autoneg */
@@ -3892,7 +3894,7 @@ static void cas_reset(struct cas *cp, int blkflag)
spin_unlock(&cp->stat_lock[N_TX_RINGS]);
}
-/* Shut down the chip, must be called with pm_sem held. */
+/* Shut down the chip, must be called with pm_mutex held. */
static void cas_shutdown(struct cas *cp)
{
unsigned long flags;
@@ -4311,11 +4313,11 @@ static int cas_open(struct net_device *dev)
int hw_was_up, err;
unsigned long flags;
- down(&cp->pm_sem);
+ mutex_lock(&cp->pm_mutex);
hw_was_up = cp->hw_running;
- /* The power-management semaphore protects the hw_running
+ /* The power-management mutex protects the hw_running
* etc. state so it is safe to do this bit without cp->lock
*/
if (!cp->hw_running) {
@@ -4364,7 +4366,7 @@ static int cas_open(struct net_device *dev)
cas_unlock_all_restore(cp, flags);
netif_start_queue(dev);
- up(&cp->pm_sem);
+ mutex_unlock(&cp->pm_mutex);
return 0;
err_spare:
@@ -4372,7 +4374,7 @@ err_spare:
cas_free_rxds(cp);
err_tx_tiny:
cas_tx_tiny_free(cp);
- up(&cp->pm_sem);
+ mutex_unlock(&cp->pm_mutex);
return err;
}
@@ -4382,7 +4384,7 @@ static int cas_close(struct net_device *dev)
struct cas *cp = netdev_priv(dev);
/* Make sure we don't get distracted by suspend/resume */
- down(&cp->pm_sem);
+ mutex_lock(&cp->pm_mutex);
netif_stop_queue(dev);
@@ -4399,7 +4401,7 @@ static int cas_close(struct net_device *dev)
cas_spare_free(cp);
cas_free_rxds(cp);
cas_tx_tiny_free(cp);
- up(&cp->pm_sem);
+ mutex_unlock(&cp->pm_mutex);
return 0;
}
@@ -4834,10 +4836,10 @@ static int cas_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
unsigned long flags;
int rc = -EOPNOTSUPP;
- /* Hold the PM semaphore while doing ioctl's or we may collide
+ /* Hold the PM mutex while doing ioctl's or we may collide
* with open/close and power management and oops.
*/
- down(&cp->pm_sem);
+ mutex_lock(&cp->pm_mutex);
switch (cmd) {
case SIOCGMIIPHY: /* Get address of MII PHY in use. */
data->phy_id = cp->phy_addr;
@@ -4867,7 +4869,7 @@ static int cas_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
break;
};
- up(&cp->pm_sem);
+ mutex_unlock(&cp->pm_mutex);
return rc;
}
@@ -4994,7 +4996,7 @@ static int __devinit cas_init_one(struct pci_dev *pdev,
spin_lock_init(&cp->tx_lock[i]);
}
spin_lock_init(&cp->stat_lock[N_TX_RINGS]);
- init_MUTEX(&cp->pm_sem);
+ mutex_init(&cp->pm_mutex);
init_timer(&cp->link_timer);
cp->link_timer.function = cas_link_timer;
@@ -5116,10 +5118,10 @@ err_out_free_consistent:
cp->init_block, cp->block_dvma);
err_out_iounmap:
- down(&cp->pm_sem);
+ mutex_lock(&cp->pm_mutex);
if (cp->hw_running)
cas_shutdown(cp);
- up(&cp->pm_sem);
+ mutex_unlock(&cp->pm_mutex);
iounmap(cp->regs);
@@ -5152,11 +5154,11 @@ static void __devexit cas_remove_one(struct pci_dev *pdev)
cp = netdev_priv(dev);
unregister_netdev(dev);
- down(&cp->pm_sem);
+ mutex_lock(&cp->pm_mutex);
flush_scheduled_work();
if (cp->hw_running)
cas_shutdown(cp);
- up(&cp->pm_sem);
+ mutex_unlock(&cp->pm_mutex);
#if 1
if (cp->orig_cacheline_size) {
@@ -5183,10 +5185,7 @@ static int cas_suspend(struct pci_dev *pdev, pm_message_t state)
struct cas *cp = netdev_priv(dev);
unsigned long flags;
- /* We hold the PM semaphore during entire driver
- * sleep time
- */
- down(&cp->pm_sem);
+ mutex_lock(&cp->pm_mutex);
/* If the driver is opened, we stop the DMA */
if (cp->opened) {
@@ -5206,6 +5205,7 @@ static int cas_suspend(struct pci_dev *pdev, pm_message_t state)
if (cp->hw_running)
cas_shutdown(cp);
+ mutex_unlock(&cp->pm_mutex);
return 0;
}
@@ -5217,6 +5217,7 @@ static int cas_resume(struct pci_dev *pdev)
printk(KERN_INFO "%s: resuming\n", dev->name);
+ mutex_lock(&cp->pm_mutex);
cas_hard_reset(cp);
if (cp->opened) {
unsigned long flags;
@@ -5229,7 +5230,7 @@ static int cas_resume(struct pci_dev *pdev)
netif_device_attach(dev);
}
- up(&cp->pm_sem);
+ mutex_unlock(&cp->pm_mutex);
return 0;
}
#endif /* CONFIG_PM */