]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/net/smc911x.c
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
[linux-2.6-omap-h63xx.git] / drivers / net / smc911x.c
index 2ca4db85f93872827711f960164cb49d51250edb..c5871624f972cd3c662e1ba81d22a6f61aabb003 100644 (file)
@@ -898,11 +898,11 @@ static void smc911x_phy_configure(struct work_struct *work)
         * We should not be called if phy_type is zero.
         */
        if (lp->phy_type == 0)
-                goto smc911x_phy_configure_exit_nolock;
+               return;
 
        if (smc911x_phy_reset(dev, phyaddr)) {
                printk("%s: PHY reset timed out\n", dev->name);
-               goto smc911x_phy_configure_exit_nolock;
+               return;
        }
        spin_lock_irqsave(&lp->lock, flags);
 
@@ -971,8 +971,6 @@ static void smc911x_phy_configure(struct work_struct *work)
 
 smc911x_phy_configure_exit:
        spin_unlock_irqrestore(&lp->lock, flags);
-smc911x_phy_configure_exit_nolock:
-       lp->work_pending = 0;
 }
 
 /*
@@ -1291,11 +1289,8 @@ static void smc911x_timeout(struct net_device *dev)
         * smc911x_phy_configure() calls msleep() which calls schedule_timeout()
         * which calls schedule().       Hence we use a work queue.
         */
-       if (lp->phy_type != 0) {
-               if (schedule_work(&lp->phy_configure)) {
-                       lp->work_pending = 1;
-               }
-       }
+       if (lp->phy_type != 0)
+               schedule_work(&lp->phy_configure);
 
        /* We can accept TX packets again */
        dev->trans_start = jiffies;
@@ -1465,16 +1460,8 @@ static int smc911x_close(struct net_device *dev)
        if (lp->phy_type != 0) {
                /* We need to ensure that no calls to
                 * smc911x_phy_configure are pending.
-
-                * flush_scheduled_work() cannot be called because we
-                * are running with the netlink semaphore held (from
-                * devinet_ioctl()) and the pending work queue
-                * contains linkwatch_event() (scheduled by
-                * netif_carrier_off() above). linkwatch_event() also
-                * wants the netlink semaphore.
                 */
-               while (lp->work_pending)
-                       schedule();
+               cancel_work_sync(&lp->phy_configure);
                smc911x_phy_powerdown(dev, lp->mii.phy_id);
        }
 
@@ -1819,6 +1806,7 @@ static int __init smc911x_probe(struct net_device *dev)
        int i, retval;
        unsigned int val, chip_id, revision;
        const char *version_string;
+       unsigned long irq_flags;
 
        DBG(SMC_DEBUG_FUNC, "%s: --> %s\n", dev->name, __FUNCTION__);
 
@@ -1985,9 +1973,15 @@ static int __init smc911x_probe(struct net_device *dev)
        lp->ctl_rfduplx = 1;
        lp->ctl_rspeed = 100;
 
+#ifdef SMC_DYNAMIC_BUS_CONFIG
+       irq_flags = lp->cfg.irq_flags;
+#else
+       irq_flags = IRQF_SHARED | SMC_IRQ_SENSE;
+#endif
+
        /* Grab the IRQ */
        retval = request_irq(dev->irq, &smc911x_interrupt,
-                       IRQF_SHARED | SMC_IRQ_SENSE, dev->name, dev);
+                            irq_flags, dev->name, dev);
        if (retval)
                goto err_out;
 
@@ -2057,6 +2051,7 @@ err_out:
  */
 static int smc911x_drv_probe(struct platform_device *pdev)
 {
+       struct smc91x_platdata *pd = pdev->dev.platform_data;
        struct net_device *ndev;
        struct resource *res;
        struct smc911x_local *lp;
@@ -2090,6 +2085,13 @@ static int smc911x_drv_probe(struct platform_device *pdev)
        ndev->irq = platform_get_irq(pdev, 0);
        lp = netdev_priv(ndev);
        lp->netdev = ndev;
+#ifdef SMC_DYNAMIC_BUS_CONFIG
+       if (!pd) {
+               ret = -EINVAL;
+               goto release_both;
+       }
+       memcpy(&lp->cfg, pd, sizeof(lp->cfg));
+#endif
 
        addr = ioremap(res->start, SMC911X_IO_EXTENT);
        if (!addr) {