IRQ: Maintain regs pointer globally rather than passing to IRQ handlers
[linux-2.6.git] / drivers / atm / lanai.c
index 3622627..8895f02 100644 (file)
@@ -39,7 +39,7 @@
  * o  lanai_change_qos() isn't written yet
  *
  * o  There aren't any ioctl's yet -- I'd like to eventually support
- *    setting loopback and LED modes that way.  (see lanai_ioctl)
+ *    setting loopback and LED modes that way.
  *
  * o  If the segmentation engine or DMA gets shut down we should restart
  *    card as per section 17.0i.  (see lanai_reset)
@@ -1482,16 +1482,10 @@ static inline void vcc_table_deallocate(const struct lanai_dev *lanai)
 static inline struct lanai_vcc *new_lanai_vcc(void)
 {
        struct lanai_vcc *lvcc;
-       lvcc = (struct lanai_vcc *) kmalloc(sizeof(*lvcc), GFP_KERNEL);
+       lvcc =  kzalloc(sizeof(*lvcc), GFP_KERNEL);
        if (likely(lvcc != NULL)) {
-               lvcc->vbase = NULL;
-               lvcc->rx.atmvcc = lvcc->tx.atmvcc = NULL;
-               lvcc->nref = 0;
-               memset(&lvcc->stats, 0, sizeof lvcc->stats);
-               lvcc->rx.buf.start = lvcc->tx.buf.start = NULL;
                skb_queue_head_init(&lvcc->tx.backlog);
 #ifdef DEBUG
-               lvcc->tx.unqueue = NULL;
                lvcc->vci = -1;
 #endif
        }
@@ -1896,12 +1890,12 @@ static inline void lanai_int_1(struct lanai_dev *lanai, u32 reason)
                reg_write(lanai, ack, IntAck_Reg);
 }
 
-static irqreturn_t lanai_int(int irq, void *devid, struct pt_regs *regs)
+static irqreturn_t lanai_int(int irq, void *devid)
 {
        struct lanai_dev *lanai = (struct lanai_dev *) devid;
        u32 reason;
 
-       (void) irq; (void) regs;        /* unused variables */
+       (void) irq;     /* unused variables */
 
 #ifdef USE_POWERDOWN
        /*
@@ -1972,7 +1966,7 @@ static int __devinit lanai_pci_start(struct lanai_dev *lanai)
                    "(itf %d): No suitable DMA available.\n", lanai->number);
                return -EBUSY;
        }
-       if (pci_set_consistent_dma_mask(pci, 0xFFFFFFFF) != 0) {
+       if (pci_set_consistent_dma_mask(pci, DMA_32BIT_MASK) != 0) {
                printk(KERN_WARNING DEV_LABEL
                    "(itf %d): No suitable DMA available.\n", lanai->number);
                return -EBUSY;
@@ -2240,7 +2234,7 @@ static int __devinit lanai_dev_open(struct atm_dev *atmdev)
        conf2_write(lanai);
        reg_write(lanai, TX_FIFO_DEPTH, TxDepth_Reg);
        reg_write(lanai, 0, CBR_ICG_Reg);       /* CBR defaults to no limit */
-       if ((result = request_irq(lanai->pci->irq, lanai_int, SA_SHIRQ,
+       if ((result = request_irq(lanai->pci->irq, lanai_int, IRQF_SHARED,
            DEV_LABEL, lanai)) != 0) {
                printk(KERN_ERR DEV_LABEL ": can't allocate interrupt\n");
                goto error_vcctable;
@@ -2435,93 +2429,6 @@ static int lanai_open(struct atm_vcc *atmvcc)
        return result;
 }
 
-#if 0
-/* ioctl operations for card */
-/* NOTE: these are all DEBUGGING ONLY currently */
-static int lanai_ioctl(struct atm_dev *atmdev, unsigned int cmd, void __user *arg)
-{
-       int result = 0;
-       struct lanai_dev *lanai = (struct lanai_dev *) atmdev->dev_data;
-       switch(cmd) {
-               case 2106275:
-                       shutdown_atm_dev(atmdev);
-                       return 0;
-               case 2200000: {
-                       unsigned long flags;
-                       spin_lock_irqsave(&lanai->servicelock, flags);
-                       run_service(lanai);
-                       spin_unlock_irqrestore(&lanai->servicelock, flags);
-                       return 0; }
-               case 2200002:
-                       get_statistics(lanai);
-                       return 0;
-               case 2200003: {
-                       unsigned int i;
-                       for (i = 0; i <= 0x5C ; i += 4) {
-                               if (i==0x48) /* Write-only butt reg */
-                                       continue;
-                               printk(KERN_CRIT DEV_LABEL "  0x%02X: "
-                                   "0x%08X\n", i,
-                                   (unsigned int) readl(lanai->base + i));
-                               barrier(); mb();
-                               pcistatus_check(lanai, 0);
-                               barrier(); mb();
-                       }
-                       return 0; }
-               case 2200004: {
-                       u8 b;
-                       u16 w;
-                       u32 dw;
-                       struct pci_dev *pci = lanai->pci;
-                       (void) pci_read_config_word(pci, PCI_VENDOR_ID, &w);
-                       DPRINTK("vendor = 0x%X\n", (unsigned int) w);
-                       (void) pci_read_config_word(pci, PCI_DEVICE_ID, &w);
-                       DPRINTK("device = 0x%X\n", (unsigned int) w);
-                       (void) pci_read_config_word(pci, PCI_COMMAND, &w);
-                       DPRINTK("command = 0x%X\n", (unsigned int) w);
-                       (void) pci_read_config_word(pci, PCI_STATUS, &w);
-                       DPRINTK("status = 0x%X\n", (unsigned int) w);
-                       (void) pci_read_config_dword(pci,
-                           PCI_CLASS_REVISION, &dw);
-                       DPRINTK("class/revision = 0x%X\n", (unsigned int) dw);
-                       (void) pci_read_config_byte(pci,
-                           PCI_CACHE_LINE_SIZE, &b);
-                       DPRINTK("cache line size = 0x%X\n", (unsigned int) b);
-                       (void) pci_read_config_byte(pci, PCI_LATENCY_TIMER, &b);
-                       DPRINTK("latency = %d (0x%X)\n",
-                           (int) b, (unsigned int) b);
-                       (void) pci_read_config_byte(pci, PCI_HEADER_TYPE, &b);
-                       DPRINTK("header type = 0x%X\n", (unsigned int) b);
-                       (void) pci_read_config_byte(pci, PCI_BIST, &b);
-                       DPRINTK("bist = 0x%X\n", (unsigned int) b);
-                       /* skipping a few here */
-                       (void) pci_read_config_byte(pci,
-                           PCI_INTERRUPT_LINE, &b);
-                       DPRINTK("pci_int_line = 0x%X\n", (unsigned int) b);
-                       (void) pci_read_config_byte(pci,
-                           PCI_INTERRUPT_PIN, &b);
-                       DPRINTK("pci_int_pin = 0x%X\n", (unsigned int) b);
-                       (void) pci_read_config_byte(pci, PCI_MIN_GNT, &b);
-                       DPRINTK("min_gnt = 0x%X\n", (unsigned int) b);
-                       (void) pci_read_config_byte(pci, PCI_MAX_LAT, &b);
-                       DPRINTK("max_lat = 0x%X\n", (unsigned int) b); }
-                       return 0;
-#ifdef USE_POWERDOWN
-               case 2200005:
-                       DPRINTK("Coming out of powerdown\n");
-                       lanai->conf1 &= ~CONFIG1_POWERDOWN;
-                       conf1_write(lanai);
-                       return 0;
-#endif
-               default:
-                       result = -ENOIOCTLCMD;
-       }
-       return result;
-}
-#else /* !0 */
-#define lanai_ioctl NULL
-#endif /* 0 */
-
 static int lanai_send(struct atm_vcc *atmvcc, struct sk_buff *skb)
 {
        struct lanai_vcc *lvcc = (struct lanai_vcc *) atmvcc->dev_data;
@@ -2679,7 +2586,6 @@ static const struct atmdev_ops ops = {
        .dev_close      = lanai_dev_close,
        .open           = lanai_open,
        .close          = lanai_close,
-       .ioctl          = lanai_ioctl,
        .getsockopt     = NULL,
        .setsockopt     = NULL,
        .send           = lanai_send,
@@ -2761,6 +2667,7 @@ static void __exit lanai_module_exit(void)
         * gone, so there isn't much to do
         */
        DPRINTK("cleanup_module()\n");
+       pci_unregister_driver(&lanai_driver);
 }
 
 module_init(lanai_module_init);