IRQ: Maintain regs pointer globally rather than passing to IRQ handlers
[safe/jmp/linux-2.6] / drivers / net / irda / vlsi_ir.c
index 35fad81..18c6819 100644 (file)
@@ -21,7 +21,6 @@
  *
  ********************************************************************/
 
-#include <linux/config.h>
 #include <linux/module.h>
  
 #define DRIVER_NAME            "vlsi_ir"
@@ -473,8 +472,7 @@ static int vlsi_free_ring(struct vlsi_ring *r)
                rd_set_addr_status(rd, 0, 0);
                if (busaddr)
                        pci_unmap_single(r->pdev, busaddr, r->len, r->dir);
-               if (rd->buf)
-                       kfree(rd->buf);
+               kfree(rd->buf);
        }
        kfree(r);
        return 0;
@@ -960,7 +958,7 @@ static int vlsi_hard_start_xmit(struct sk_buff *skb, struct net_device *ndev)
                            ||  (now.tv_sec==ready.tv_sec && now.tv_usec>=ready.tv_usec))
                                break;
                        udelay(100);
-                       /* must not sleep here - we are called under xmit_lock! */
+                       /* must not sleep here - called under netif_tx_lock! */
                }
        }
 
@@ -1457,8 +1455,7 @@ static int vlsi_ioctl(struct net_device *ndev, struct ifreq *rq, int cmd)
 
 /********************************************************/
 
-static irqreturn_t vlsi_interrupt(int irq, void *dev_instance,
-                                       struct pt_regs *regs)
+static irqreturn_t vlsi_interrupt(int irq, void *dev_instance)
 {
        struct net_device *ndev = dev_instance;
        vlsi_irda_dev_t *idev = ndev->priv;
@@ -1519,7 +1516,7 @@ static int vlsi_open(struct net_device *ndev)
 
        outb(IRINTR_INT_MASK, ndev->base_addr+VLSI_PIO_IRINTR);
 
-       if (request_irq(ndev->irq, vlsi_interrupt, SA_SHIRQ,
+       if (request_irq(ndev->irq, vlsi_interrupt, IRQF_SHARED,
                        drivername, ndev)) {
                IRDA_WARNING("%s: couldn't get IRQ: %d\n",
                             __FUNCTION__, ndev->irq);
@@ -1744,16 +1741,11 @@ static void __devexit vlsi_irda_remove(struct pci_dev *pdev)
  */
 
 
-static int vlsi_irda_suspend(struct pci_dev *pdev, u32 state)
+static int vlsi_irda_suspend(struct pci_dev *pdev, pm_message_t state)
 {
        struct net_device *ndev = pci_get_drvdata(pdev);
        vlsi_irda_dev_t *idev;
 
-       if (state < 1 || state > 3 ) {
-               IRDA_ERROR("%s - %s: invalid pm state request: %u\n",
-                          __FUNCTION__, PCIDEV_NAME(pdev), state);
-               return 0;
-       }
        if (!ndev) {
                IRDA_ERROR("%s - %s: no netdevice \n",
                           __FUNCTION__, PCIDEV_NAME(pdev));
@@ -1762,12 +1754,12 @@ static int vlsi_irda_suspend(struct pci_dev *pdev, u32 state)
        idev = ndev->priv;      
        down(&idev->sem);
        if (pdev->current_state != 0) {                 /* already suspended */
-               if (state > pdev->current_state) {      /* simply go deeper */
-                       pci_set_power_state(pdev,state);
-                       pdev->current_state = state;
+               if (state.event > pdev->current_state) {        /* simply go deeper */
+                       pci_set_power_state(pdev, pci_choose_state(pdev, state));
+                       pdev->current_state = state.event;
                }
                else
-                       IRDA_ERROR("%s - %s: invalid suspend request %u -> %u\n", __FUNCTION__, PCIDEV_NAME(pdev), pdev->current_state, state);
+                       IRDA_ERROR("%s - %s: invalid suspend request %u -> %u\n", __FUNCTION__, PCIDEV_NAME(pdev), pdev->current_state, state.event);
                up(&idev->sem);
                return 0;
        }
@@ -1781,8 +1773,8 @@ static int vlsi_irda_suspend(struct pci_dev *pdev, u32 state)
                        idev->new_baud = idev->baud;
        }
 
-       pci_set_power_state(pdev,state);
-       pdev->current_state = state;
+       pci_set_power_state(pdev, pci_choose_state(pdev, state));
+       pdev->current_state = state.event;
        idev->resume_ok = 1;
        up(&idev->sem);
        return 0;
@@ -1807,8 +1799,8 @@ static int vlsi_irda_resume(struct pci_dev *pdev)
                return 0;
        }
        
-       pci_set_power_state(pdev, 0);
-       pdev->current_state = 0;
+       pci_set_power_state(pdev, PCI_D0);
+       pdev->current_state = PM_EVENT_ON;
 
        if (!idev->resume_ok) {
                /* should be obsolete now - but used to happen due to:
@@ -1880,11 +1872,11 @@ static int __init vlsi_mod_init(void)
 
        sirpulse = !!sirpulse;
 
-       /* create_proc_entry returns NULL if !CONFIG_PROC_FS.
+       /* proc_mkdir returns NULL if !CONFIG_PROC_FS.
         * Failure to create the procfs entry is handled like running
         * without procfs - it's not required for the driver to work.
         */
-       vlsi_proc_root = create_proc_entry(PROC_DIR, S_IFDIR, NULL);
+       vlsi_proc_root = proc_mkdir(PROC_DIR, NULL);
        if (vlsi_proc_root) {
                /* protect registered procdir against module removal.
                 * Because we are in the module init path there's no race
@@ -1893,7 +1885,7 @@ static int __init vlsi_mod_init(void)
                vlsi_proc_root->owner = THIS_MODULE;
        }
 
-       ret = pci_module_init(&vlsi_irda_driver);
+       ret = pci_register_driver(&vlsi_irda_driver);
 
        if (ret && vlsi_proc_root)
                remove_proc_entry(PROC_DIR, NULL);