X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=drivers%2Fatm%2Fiphase.c;h=139fce6968a6382637df695af6899321a429dd9f;hb=a01cc6570326c01e70619bf6540fb32139947c33;hp=670c093ed25f7ce93e0b03ed1d21f124f64d96fc;hpb=4adeaaf51ebcc3f629f5512b96aebb5089388bca;p=linux-2.6 diff --git a/drivers/atm/iphase.c b/drivers/atm/iphase.c index 670c093ed2..139fce6968 100644 --- a/drivers/atm/iphase.c +++ b/drivers/atm/iphase.c @@ -60,7 +60,8 @@ #include #include #include -#include +#include +#include #include "iphase.h" #include "suni.h" #define swap(x) (((x & 0xff) << 8) | ((x & 0xff00) >> 8)) @@ -189,7 +190,7 @@ static u16 get_desc (IADEV *dev, struct ia_vcc *iavcc) { int ltimeout; ia_hack_tcq (dev); - if(((jiffies - timer)>50)||((dev->ffL.tcq_rd==dev->host_tcq_wr))){ + if((time_after(jiffies,timer+50)) || ((dev->ffL.tcq_rd==dev->host_tcq_wr))) { timer = jiffies; i=0; while (i < dev->num_tx_desc) { @@ -1225,7 +1226,7 @@ static void rx_intr(struct atm_dev *dev) iadev->rx_tmp_jif = jiffies; iadev->rxing = 0; } - else if (((jiffies - iadev->rx_tmp_jif) > 50) && + else if ((time_after(jiffies, iadev->rx_tmp_jif + 50)) && ((iadev->rx_pkt_cnt - iadev->rx_tmp_cnt) == 0)) { for (i = 1; i <= iadev->num_rx_desc; i++) free_desc(dev, i); @@ -2561,17 +2562,11 @@ static int __devinit ia_start(struct atm_dev *dev) error = suni_init(dev); if (error) goto err_free_rx; - /* - * Enable interrupt on loss of signal - * SUNI_RSOP_CIE - 0x10 - * SUNI_RSOP_CIE_LOSE - 0x04 - */ - ia_phy_put(dev, ia_phy_get(dev, 0x10) | 0x04, 0x10); -#ifndef MODULE - error = dev->phy->start(dev); - if (error) - goto err_free_rx; -#endif + if (dev->phy->start) { + error = dev->phy->start(dev); + if (error) + goto err_free_rx; + } /* Get iadev->carrier_detect status */ IaFrontEndIntr(iadev); } @@ -3197,6 +3192,8 @@ static int __devinit ia_init_one(struct pci_dev *pdev, IF_INIT(printk("dev_id = 0x%x iadev->LineRate = %d \n", (u32)dev, iadev->LineRate);) + pci_set_drvdata(pdev, dev); + ia_dev[iadev_count] = iadev; _ia_dev[iadev_count] = dev; iadev_count++; @@ -3218,8 +3215,6 @@ static int __devinit ia_init_one(struct pci_dev *pdev, iadev->next_board = ia_boards; ia_boards = dev; - pci_set_drvdata(pdev, dev); - return 0; err_out_deregister_dev: @@ -3237,9 +3232,14 @@ static void __devexit ia_remove_one(struct pci_dev *pdev) struct atm_dev *dev = pci_get_drvdata(pdev); IADEV *iadev = INPH_IA_DEV(dev); - ia_phy_put(dev, ia_phy_get(dev,0x10) & ~(0x4), 0x10); + /* Disable phy interrupts */ + ia_phy_put(dev, ia_phy_get(dev, SUNI_RSOP_CIE) & ~(SUNI_RSOP_CIE_LOSE), + SUNI_RSOP_CIE); udelay(1); + if (dev->phy && dev->phy->stop) + dev->phy->stop(dev); + /* De-register device */ free_irq(iadev->irq, dev); iadev_count--;