X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fnet%2Fcassini.c;h=6e295fce5c6f08c3a1554ea87c9d9be18e86e4cc;hb=987b0145d94eecf292d8b301228356f44611ab7c;hp=ac48f7543500b7c53d5099383fa26c83c247a45e;hpb=f7ed79d23a47594e7834d66a8f14449796d4f3e6;p=linux-2.6.git diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c index ac48f7543..6e295fce5 100644 --- a/drivers/net/cassini.c +++ b/drivers/net/cassini.c @@ -91,7 +91,6 @@ #include #include #include -#include #include @@ -192,15 +191,12 @@ 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_param(cassini_debug, int, 0); +MODULE_PARM(cassini_debug, "i"); MODULE_PARM_DESC(cassini_debug, "Cassini bitmapped debugging message enable value"); -module_param(link_mode, int, 0); +MODULE_PARM(link_mode, "i"); MODULE_PARM_DESC(link_mode, "default link mode"); /* @@ -212,7 +208,7 @@ MODULE_PARM_DESC(link_mode, "default link mode"); * Value in seconds, for user input. */ static int linkdown_timeout = DEFAULT_LINKDOWN_TIMEOUT; -module_param(linkdown_timeout, int, 0); +MODULE_PARM(linkdown_timeout, "i"); MODULE_PARM_DESC(linkdown_timeout, "min reset interval in sec. for PCS linkdown issue; disabled if not positive"); @@ -224,6 +220,8 @@ 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 */ @@ -3894,7 +3892,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_mutex held. */ +/* Shut down the chip, must be called with pm_sem held. */ static void cas_shutdown(struct cas *cp) { unsigned long flags; @@ -4313,11 +4311,11 @@ static int cas_open(struct net_device *dev) int hw_was_up, err; unsigned long flags; - mutex_lock(&cp->pm_mutex); + down(&cp->pm_sem); hw_was_up = cp->hw_running; - /* The power-management mutex protects the hw_running + /* The power-management semaphore protects the hw_running * etc. state so it is safe to do this bit without cp->lock */ if (!cp->hw_running) { @@ -4366,7 +4364,7 @@ static int cas_open(struct net_device *dev) cas_unlock_all_restore(cp, flags); netif_start_queue(dev); - mutex_unlock(&cp->pm_mutex); + up(&cp->pm_sem); return 0; err_spare: @@ -4374,7 +4372,7 @@ err_spare: cas_free_rxds(cp); err_tx_tiny: cas_tx_tiny_free(cp); - mutex_unlock(&cp->pm_mutex); + up(&cp->pm_sem); return err; } @@ -4384,7 +4382,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 */ - mutex_lock(&cp->pm_mutex); + down(&cp->pm_sem); netif_stop_queue(dev); @@ -4401,7 +4399,7 @@ static int cas_close(struct net_device *dev) cas_spare_free(cp); cas_free_rxds(cp); cas_tx_tiny_free(cp); - mutex_unlock(&cp->pm_mutex); + up(&cp->pm_sem); return 0; } @@ -4836,10 +4834,10 @@ static int cas_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) unsigned long flags; int rc = -EOPNOTSUPP; - /* Hold the PM mutex while doing ioctl's or we may collide + /* Hold the PM semaphore while doing ioctl's or we may collide * with open/close and power management and oops. */ - mutex_lock(&cp->pm_mutex); + down(&cp->pm_sem); switch (cmd) { case SIOCGMIIPHY: /* Get address of MII PHY in use. */ data->phy_id = cp->phy_addr; @@ -4869,7 +4867,7 @@ static int cas_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) break; }; - mutex_unlock(&cp->pm_mutex); + up(&cp->pm_sem); return rc; } @@ -4996,7 +4994,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]); - mutex_init(&cp->pm_mutex); + init_MUTEX(&cp->pm_sem); init_timer(&cp->link_timer); cp->link_timer.function = cas_link_timer; @@ -5118,10 +5116,10 @@ err_out_free_consistent: cp->init_block, cp->block_dvma); err_out_iounmap: - mutex_lock(&cp->pm_mutex); + down(&cp->pm_sem); if (cp->hw_running) cas_shutdown(cp); - mutex_unlock(&cp->pm_mutex); + up(&cp->pm_sem); iounmap(cp->regs); @@ -5154,11 +5152,11 @@ static void __devexit cas_remove_one(struct pci_dev *pdev) cp = netdev_priv(dev); unregister_netdev(dev); - mutex_lock(&cp->pm_mutex); + down(&cp->pm_sem); flush_scheduled_work(); if (cp->hw_running) cas_shutdown(cp); - mutex_unlock(&cp->pm_mutex); + up(&cp->pm_sem); #if 1 if (cp->orig_cacheline_size) { @@ -5185,7 +5183,10 @@ static int cas_suspend(struct pci_dev *pdev, pm_message_t state) struct cas *cp = netdev_priv(dev); unsigned long flags; - mutex_lock(&cp->pm_mutex); + /* We hold the PM semaphore during entire driver + * sleep time + */ + down(&cp->pm_sem); /* If the driver is opened, we stop the DMA */ if (cp->opened) { @@ -5205,7 +5206,6 @@ 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,7 +5217,6 @@ 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; @@ -5230,7 +5229,7 @@ static int cas_resume(struct pci_dev *pdev) netif_device_attach(dev); } - mutex_unlock(&cp->pm_mutex); + up(&cp->pm_sem); return 0; } #endif /* CONFIG_PM */