pcmcia: rsrc_nonstatic io memory probe improvements
[safe/jmp/linux-2.6] / drivers / bluetooth / bt3c_cs.c
index 794a5ef..d814a27 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,6 +343,7 @@ 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);
 
@@ -358,9 +359,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 +375,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 +502,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 +530,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);
                        }
                }
@@ -657,11 +659,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;
@@ -681,6 +681,7 @@ static void bt3c_detach(struct pcmcia_device *link)
 static int bt3c_check_config(struct pcmcia_device *p_dev,
                             cistpl_cftable_entry_t *cf,
                             cistpl_cftable_entry_t *dflt,
+                            unsigned int vcc,
                             void *priv_data)
 {
        unsigned long try = (unsigned long) priv_data;
@@ -701,6 +702,7 @@ static int bt3c_check_config(struct pcmcia_device *p_dev,
 static int bt3c_check_config_notpicky(struct pcmcia_device *p_dev,
                                      cistpl_cftable_entry_t *cf,
                                      cistpl_cftable_entry_t *dflt,
+                                     unsigned int vcc,
                                      void *priv_data)
 {
        static unsigned int base[5] = { 0x3f8, 0x2f8, 0x3e8, 0x2e8, 0x0 };
@@ -736,21 +738,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 != CS_SUCCESS) {
-               cs_error(link, RequestIRQ, i);
+       if (i != 0)
                link->irq.AssignedIRQ = 0;
-       }
 
        i = pcmcia_request_configuration(link, &link->conf);
-       if (i != CS_SUCCESS) {
-               cs_error(link, RequestConfiguration, i);
+       if (i != 0)
                goto failed;
-       }
 
        if (bt3c_open(info) != 0)
                goto failed;