sh: Disable IRQ balancing for timer and IPI IRQs.
[safe/jmp/linux-2.6] / drivers / bluetooth / bt3c_cs.c
index 156edfd..027cb8b 100644 (file)
@@ -60,7 +60,7 @@
 /* ======================== Module parameters ======================== */
 
 
-MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>, Jose Orlando Pereira <jop@di.uminho.pt>");
+MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>");
 MODULE_DESCRIPTION("Bluetooth driver for the 3Com Bluetooth PCMCIA card");
 MODULE_LICENSE("GPL");
 MODULE_FIRMWARE("BT3CPCC.bin");
@@ -343,8 +343,11 @@ static irqreturn_t bt3c_interrupt(int irq, void *dev_inst)
        bt3c_info_t *info = dev_inst;
        unsigned int iobase;
        int iir;
+       irqreturn_t r = IRQ_NONE;
 
-       BUG_ON(!info->hdev);
+       if (!info || !info->hdev)
+               /* our irq handler is shared */
+               return IRQ_NONE;
 
        iobase = info->p_dev->io.BasePort1;
 
@@ -358,9 +361,9 @@ static irqreturn_t bt3c_interrupt(int irq, void *dev_inst)
                        BT_ERR("Very strange (stat=0x%04x)", stat);
                } else if ((stat & 0xff) != 0xff) {
                        if (stat & 0x0020) {
-                               int stat = bt3c_read(iobase, 0x7002) & 0x10;
+                               int status = bt3c_read(iobase, 0x7002) & 0x10;
                                BT_INFO("%s: Antenna %s", info->hdev->name,
-                                                       stat ? "out" : "in");
+                                                       status ? "out" : "in");
                        }
                        if (stat & 0x0001)
                                bt3c_receive(info);
@@ -374,11 +377,12 @@ static irqreturn_t bt3c_interrupt(int irq, void *dev_inst)
 
                        outb(iir, iobase + CONTROL);
                }
+               r = IRQ_HANDLED;
        }
 
        spin_unlock(&(info->lock));
 
-       return IRQ_HANDLED;
+       return r;
 }
 
 
@@ -500,15 +504,15 @@ static int bt3c_load_firmware(bt3c_info_t *info, const unsigned char *firmware,
 
                memset(b, 0, sizeof(b));
                memcpy(b, ptr + 2, 2);
-               size = simple_strtol(b, NULL, 16);
+               size = simple_strtoul(b, NULL, 16);
 
                memset(b, 0, sizeof(b));
                memcpy(b, ptr + 4, 8);
-               addr = simple_strtol(b, NULL, 16);
+               addr = simple_strtoul(b, NULL, 16);
 
                memset(b, 0, sizeof(b));
                memcpy(b, ptr + (size * 2) + 2, 2);
-               fcs = simple_strtol(b, NULL, 16);
+               fcs = simple_strtoul(b, NULL, 16);
 
                memset(b, 0, sizeof(b));
                for (tmp = 0, i = 0; i < size; i++) {
@@ -528,7 +532,7 @@ static int bt3c_load_firmware(bt3c_info_t *info, const unsigned char *firmware,
                        memset(b, 0, sizeof(b));
                        for (i = 0; i < (size - 4) / 2; i++) {
                                memcpy(b, ptr + (i * 4) + 12, 4);
-                               tmp = simple_strtol(b, NULL, 16);
+                               tmp = simple_strtoul(b, NULL, 16);
                                bt3c_put(iobase, tmp);
                        }
                }
@@ -578,7 +582,7 @@ static int bt3c_open(bt3c_info_t *info)
 
        info->hdev = hdev;
 
-       hdev->type = HCI_PCCARD;
+       hdev->bus = HCI_PCCARD;
        hdev->driver_data = info;
        SET_HCIDEV_DEV(hdev, &info->p_dev->dev);
 
@@ -657,11 +661,9 @@ static int bt3c_probe(struct pcmcia_device *link)
 
        link->io.Attributes1 = IO_DATA_PATH_WIDTH_8;
        link->io.NumPorts1 = 8;
-       link->irq.Attributes = IRQ_TYPE_EXCLUSIVE | IRQ_HANDLE_PRESENT;
-       link->irq.IRQInfo1 = IRQ_LEVEL_ID;
+       link->irq.Attributes = IRQ_TYPE_DYNAMIC_SHARING;
 
        link->irq.Handler = bt3c_interrupt;
-       link->irq.Instance = info;
 
        link->conf.Attributes = CONF_ENABLE_IRQ;
        link->conf.IntType = INT_MEMORY_AND_IO;
@@ -738,21 +740,16 @@ static int bt3c_config(struct pcmcia_device *link)
                goto found_port;
 
        BT_ERR("No usable port range found");
-       cs_error(link, RequestIO, -ENODEV);
        goto failed;
 
 found_port:
        i = pcmcia_request_irq(link, &link->irq);
-       if (i != 0) {
-               cs_error(link, RequestIRQ, i);
+       if (i != 0)
                link->irq.AssignedIRQ = 0;
-       }
 
        i = pcmcia_request_configuration(link, &link->conf);
-       if (i != 0) {
-               cs_error(link, RequestConfiguration, i);
+       if (i != 0)
                goto failed;
-       }
 
        if (bt3c_open(info) != 0)
                goto failed;