pcmcia: irq probe can be done without risking an IRQ storm
[firefly-linux-kernel-4.4.55.git] / drivers / pcmcia / pcmcia_resource.c
index 0ce39de834c477785a0b04ba580c80cffc4dd41e..78af59415930ea93830372e78585f4fcf6bb61a4 100644 (file)
@@ -65,23 +65,23 @@ extern int ds_pc_debug;
  * Special stuff for managing IO windows, because they are scarce
  */
 
-static int alloc_io_space(struct pcmcia_socket *s, u_int attr, ioaddr_t *base,
-                         ioaddr_t num, u_int lines)
+static int alloc_io_space(struct pcmcia_socket *s, u_int attr,
+                         unsigned int *base, unsigned int num, u_int lines)
 {
        int i;
-       kio_addr_t try, align;
+       unsigned int try, align;
 
        align = (*base) ? (lines ? 1<<lines : 0) : 1;
        if (align && (align < num)) {
                if (*base) {
-                       ds_dbg(s, 0, "odd IO request: num %#x align %#lx\n",
+                       ds_dbg(s, 0, "odd IO request: num %#x align %#x\n",
                               num, align);
                        align = 0;
                } else
                        while (align && (align < num)) align <<= 1;
        }
        if (*base & ~(align-1)) {
-               ds_dbg(s, 0, "odd IO request: base %#x align %#lx\n",
+               ds_dbg(s, 0, "odd IO request: base %#x align %#x\n",
                       *base, align);
                align = 0;
        }
@@ -132,8 +132,8 @@ static int alloc_io_space(struct pcmcia_socket *s, u_int attr, ioaddr_t *base,
 } /* alloc_io_space */
 
 
-static void release_io_space(struct pcmcia_socket *s, ioaddr_t base,
-                            ioaddr_t num)
+static void release_io_space(struct pcmcia_socket *s, unsigned int base,
+                            unsigned int num)
 {
        int i;
 
@@ -812,6 +812,15 @@ int pcmcia_request_irq(struct pcmcia_device *p_dev, irq_req_t *req)
                type = IRQF_SHARED;
 
 #ifdef CONFIG_PCMCIA_PROBE
+
+#ifdef IRQ_NOAUTOEN
+       /* if the underlying IRQ infrastructure allows for it, only allocate
+        * the IRQ, but do not enable it
+        */
+       if (!(req->Attributes & IRQ_HANDLE_PRESENT))
+               type |= IRQ_NOAUTOEN;
+#endif /* IRQ_NOAUTOEN */
+
        if (s->irq.AssignedIRQ != 0) {
                /* If the interrupt is already assigned, it must be the same */
                irq = s->irq.AssignedIRQ;
@@ -966,7 +975,7 @@ void pcmcia_disable_device(struct pcmcia_device *p_dev) {
        pcmcia_release_configuration(p_dev);
        pcmcia_release_io(p_dev, &p_dev->io);
        pcmcia_release_irq(p_dev, &p_dev->irq);
-       if (&p_dev->win)
+       if (p_dev->win)
                pcmcia_release_window(p_dev->win);
 }
 EXPORT_SYMBOL(pcmcia_disable_device);