]> rtime.felk.cvut.cz Git - linux-imx.git/commitdiff
ALSA: mpu401: clean up interrupt specification
authorClemens Ladisch <clemens@ladisch.de>
Tue, 13 Sep 2011 09:24:41 +0000 (11:24 +0200)
committerTakashi Iwai <tiwai@suse.de>
Wed, 14 Sep 2011 09:00:51 +0000 (11:00 +0200)
The semantics of snd_mpu401_uart_new()'s interrupt parameters are
somewhat counterintuitive:  To prevent the function from allocating its
own interrupt, either the irq number must be invalid, or the irq_flags
parameter must be zero.  At the same time, the irq parameter being
invalid specifies that the mpu401 code has to work without an interrupt
allocated by the caller.  This implies that, if there is an interrupt
and it is allocated by the caller, the irq parameter must be set to
a valid-looking number which then isn't actually used.

With the removal of IRQF_DISABLED, zero becomes a valid irq_flags value,
which forces us to handle the parameters differently.

This patch introduces a new flag MPU401_INFO_IRQ_HOOK for when the
device interrupt is handled by the caller, and makes the allocation of
the interrupt to depend only on the irq parameter.  As suggested by
Takashi, the irq_flags parameter was dropped because, when used, it had
the constant value IRQF_DISABLED.

Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
38 files changed:
Documentation/DocBook/writing-an-alsa-driver.tmpl
include/sound/mpu401.h
sound/drivers/mpu401/mpu401.c
sound/drivers/mpu401/mpu401_uart.c
sound/isa/ad1816a/ad1816a.c
sound/isa/als100.c
sound/isa/azt2320.c
sound/isa/cmi8330.c
sound/isa/cs423x/cs4231.c
sound/isa/cs423x/cs4236.c
sound/isa/es1688/es1688.c
sound/isa/es18xx.c
sound/isa/galaxy/galaxy.c
sound/isa/gus/gusextreme.c
sound/isa/msnd/msnd_pinnacle.c
sound/isa/opl3sa2.c
sound/isa/opti9xx/miro.c
sound/isa/opti9xx/opti92x-ad1848.c
sound/isa/sb/jazz16.c
sound/isa/sb/sb16.c
sound/isa/sc6000.c
sound/isa/sscape.c
sound/isa/wavefront/wavefront.c
sound/pci/als4000.c
sound/pci/au88x0/au88x0_mpu401.c
sound/pci/azt3328.c
sound/pci/cmipci.c
sound/pci/es1938.c
sound/pci/es1968.c
sound/pci/fm801.c
sound/pci/ice1712/ice1712.c
sound/pci/maestro3.c
sound/pci/oxygen/oxygen_lib.c
sound/pci/riptide/riptide.c
sound/pci/sonicvibes.c
sound/pci/trident/trident.c
sound/pci/via82xx.c
sound/pci/ymfpci/ymfpci.c

index 598c22f3b3ac8f755b1595442698f9fc9294802a..5de23c00707828100ce750260ec71e727567d828 100644 (file)
@@ -4288,7 +4288,7 @@ struct _snd_pcm_runtime {
 <![CDATA[
   struct snd_rawmidi *rmidi;
   snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401, port, info_flags,
-                      irq, irq_flags, &rmidi);
+                      irq, &rmidi);
 ]]>
           </programlisting>
         </informalexample>
@@ -4343,6 +4343,13 @@ struct _snd_pcm_runtime {
        by itself to start processing the output stream in the irq handler.
        </para>
 
+       <para>
+       If the MPU-401 interface shares its interrupt with the other logical
+       devices on the card, set <constant>MPU401_INFO_IRQ_HOOK</constant>
+       (see <link linkend="midi-interface-interrupt-handler"><citetitle>
+       below</citetitle></link>).
+       </para>
+
       <para>
         Usually, the port address corresponds to the command port and
         port + 1 corresponds to the data port. If not, you may change
@@ -4375,14 +4382,12 @@ struct _snd_pcm_runtime {
       </para>
 
       <para>
-        The 6th argument specifies the irq number for UART. If the irq
-      is already allocated, pass 0 to the 7th argument
-      (<parameter>irq_flags</parameter>). Otherwise, pass the flags
-      for irq allocation 
-      (<constant>SA_XXX</constant> bits) to it, and the irq will be
-      reserved by the mpu401-uart layer. If the card doesn't generate
-      UART interrupts, pass -1 as the irq number. Then a timer
-      interrupt will be invoked for polling. 
+       The 6th argument specifies the ISA irq number that will be
+       allocated.  If no interrupt is to be allocated (because your
+       code is already allocating a shared interrupt, or because the
+       device does not use interrupts), pass -1 instead.
+       For a MPU-401 device without an interrupt, a polling timer
+       will be used instead.
       </para>
     </section>
 
@@ -4390,12 +4395,13 @@ struct _snd_pcm_runtime {
       <title>Interrupt Handler</title>
       <para>
         When the interrupt is allocated in
-      <function>snd_mpu401_uart_new()</function>, the private
-      interrupt handler is used, hence you don't have anything else to do
-      than creating the mpu401 stuff. Otherwise, you have to call
-      <function>snd_mpu401_uart_interrupt()</function> explicitly when
-      a UART interrupt is invoked and checked in your own interrupt
-      handler.  
+      <function>snd_mpu401_uart_new()</function>, an exclusive ISA
+      interrupt handler is automatically used, hence you don't have
+      anything else to do than creating the mpu401 stuff.  Otherwise, you
+      have to set <constant>MPU401_INFO_IRQ_HOOK</constant>, and call
+      <function>snd_mpu401_uart_interrupt()</function> explicitly from your
+      own interrupt handler when it has determined that a UART interrupt
+      has occurred.
       </para>
 
       <para>
index 1f1d53f8830b55036dbf241bb38e227d8e121b5f..20230db00ef17095d899de2f9287ba9a5e1ff0e6 100644 (file)
 #define MPU401_INFO_INTEGRATED (1 << 2)        /* integrated h/w port */
 #define MPU401_INFO_MMIO       (1 << 3)        /* MMIO access */
 #define MPU401_INFO_TX_IRQ     (1 << 4)        /* independent TX irq */
+#define MPU401_INFO_IRQ_HOOK   (1 << 5)        /* mpu401 irq handler is called
+                                                  from driver irq handler */
 #define MPU401_INFO_NO_ACK     (1 << 6)        /* No ACK cmd needed */
+#define MPU401_INFO_USE_TIMER  (1 << 15)       /* internal */
 
 #define MPU401_MODE_BIT_INPUT          0
 #define MPU401_MODE_BIT_OUTPUT         1
@@ -73,8 +76,7 @@ struct snd_mpu401 {
        unsigned long port;             /* base port of MPU-401 chip */
        unsigned long cport;            /* port + 1 (usually) */
        struct resource *res;           /* port resource */
-       int irq;                        /* IRQ number of MPU-401 chip (-1 = poll) */
-       int irq_flags;
+       int irq;                        /* IRQ number of MPU-401 chip */
 
        unsigned long mode;             /* MPU401_MODE_XXXX */
        int timer_invoked;
@@ -131,7 +133,6 @@ int snd_mpu401_uart_new(struct snd_card *card,
                        unsigned long port,
                        unsigned int info_flags,
                        int irq,
-                       int irq_flags,
                        struct snd_rawmidi ** rrawmidi);
 
 #endif /* __SOUND_MPU401_H */
index 149d05a8202d58bf381c3eb059e3302f89e2a188..1c02852aceea771f82f9d4a9b424c86bc8e93f83 100644 (file)
@@ -86,8 +86,7 @@ static int snd_mpu401_create(int dev, struct snd_card **rcard)
        }
 
        err = snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401, port[dev], 0,
-                                 irq[dev], irq[dev] >= 0 ? IRQF_DISABLED : 0,
-                                 NULL);
+                                 irq[dev], NULL);
        if (err < 0) {
                printk(KERN_ERR "MPU401 not detected at 0x%lx\n", port[dev]);
                goto _err;
index 2af09996a3d01a39d4b913a23c1d08855ed54f06..9d01c181fecaef44e2fc79ed39a4b2fe5494898f 100644 (file)
@@ -3,7 +3,7 @@
  *  Routines for control of MPU-401 in UART mode
  *
  *  MPU-401 supports UART mode which is not capable generate transmit
- *  interrupts thus output is done via polling. Also, if irq < 0, then
+ *  interrupts thus output is done via polling. Without interrupt,
  *  input is done also via polling. Do not expect good performance.
  *
  *
@@ -374,7 +374,7 @@ snd_mpu401_uart_input_trigger(struct snd_rawmidi_substream *substream, int up)
                        /* first time - flush FIFO */
                        while (max-- > 0)
                                mpu->read(mpu, MPU401D(mpu));
-                       if (mpu->irq < 0)
+                       if (mpu->info_flags & MPU401_INFO_USE_TIMER)
                                snd_mpu401_uart_add_timer(mpu, 1);
                }
                
@@ -383,7 +383,7 @@ snd_mpu401_uart_input_trigger(struct snd_rawmidi_substream *substream, int up)
                snd_mpu401_uart_input_read(mpu);
                spin_unlock_irqrestore(&mpu->input_lock, flags);
        } else {
-               if (mpu->irq < 0)
+               if (mpu->info_flags & MPU401_INFO_USE_TIMER)
                        snd_mpu401_uart_remove_timer(mpu, 1);
                clear_bit(MPU401_MODE_BIT_INPUT_TRIGGER, &mpu->mode);
        }
@@ -496,7 +496,7 @@ static struct snd_rawmidi_ops snd_mpu401_uart_input =
 static void snd_mpu401_uart_free(struct snd_rawmidi *rmidi)
 {
        struct snd_mpu401 *mpu = rmidi->private_data;
-       if (mpu->irq_flags && mpu->irq >= 0)
+       if (mpu->irq >= 0)
                free_irq(mpu->irq, (void *) mpu);
        release_and_free_resource(mpu->res);
        kfree(mpu);
@@ -509,8 +509,7 @@ static void snd_mpu401_uart_free(struct snd_rawmidi *rmidi)
  * @hardware: the hardware type, MPU401_HW_XXXX
  * @port: the base address of MPU401 port
  * @info_flags: bitflags MPU401_INFO_XXX
- * @irq: the irq number, -1 if no interrupt for mpu
- * @irq_flags: the irq request flags (SA_XXX), 0 if irq was already reserved.
+ * @irq: the ISA irq number, -1 if not to be allocated
  * @rrawmidi: the pointer to store the new rawmidi instance
  *
  * Creates a new MPU-401 instance.
@@ -525,7 +524,7 @@ int snd_mpu401_uart_new(struct snd_card *card, int device,
                        unsigned short hardware,
                        unsigned long port,
                        unsigned int info_flags,
-                       int irq, int irq_flags,
+                       int irq,
                        struct snd_rawmidi ** rrawmidi)
 {
        struct snd_mpu401 *mpu;
@@ -577,8 +576,8 @@ int snd_mpu401_uart_new(struct snd_card *card, int device,
                mpu->cport = port + 2;
        else
                mpu->cport = port + 1;
-       if (irq >= 0 && irq_flags) {
-               if (request_irq(irq, snd_mpu401_uart_interrupt, irq_flags,
+       if (irq >= 0) {
+               if (request_irq(irq, snd_mpu401_uart_interrupt, IRQF_DISABLED,
                                "MPU401 UART", (void *) mpu)) {
                        snd_printk(KERN_ERR "mpu401_uart: "
                                   "unable to grab IRQ %d\n", irq);
@@ -586,9 +585,10 @@ int snd_mpu401_uart_new(struct snd_card *card, int device,
                        return -EBUSY;
                }
        }
+       if (irq < 0 && !(info_flags & MPU401_INFO_IRQ_HOOK))
+               info_flags |= MPU401_INFO_USE_TIMER;
        mpu->info_flags = info_flags;
        mpu->irq = irq;
-       mpu->irq_flags = irq_flags;
        if (card->shortname[0])
                snprintf(rmidi->name, sizeof(rmidi->name), "%s MIDI",
                         card->shortname);
index 3cb75bc9769927a303974783c7667b728eed798b..a87a2b566e19e4fbce67cb0a90aa88c5e53c1968 100644 (file)
@@ -204,7 +204,7 @@ static int __devinit snd_card_ad1816a_probe(int dev, struct pnp_card_link *pcard
 
        if (mpu_port[dev] > 0) {
                if (snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401,
-                                       mpu_port[dev], 0, mpu_irq[dev], IRQF_DISABLED,
+                                       mpu_port[dev], 0, mpu_irq[dev],
                                        NULL) < 0)
                        printk(KERN_ERR PFX "no MPU-401 device at 0x%lx.\n", mpu_port[dev]);
        }
index 20becc89f6f6f45ab35a456591add0b93f89f038..706effd6b3cd8d800c43bc001e7a37ae16894c80 100644 (file)
@@ -256,7 +256,6 @@ static int __devinit snd_card_als100_probe(int dev,
                                        mpu_type,
                                        mpu_port[dev], 0, 
                                        mpu_irq[dev],
-                                       mpu_irq[dev] >= 0 ? IRQF_DISABLED : 0,
                                        NULL) < 0)
                        snd_printk(KERN_ERR PFX "no MPU-401 device at 0x%lx\n", mpu_port[dev]);
        }
index aac8dc15c2fe6eaf0329b780545068789d38ce6c..b7bdbf30774025e3bbc61ef0a01852a68530bf49 100644 (file)
@@ -234,8 +234,7 @@ static int __devinit snd_card_azt2320_probe(int dev,
        if (mpu_port[dev] > 0 && mpu_port[dev] != SNDRV_AUTO_PORT) {
                if (snd_mpu401_uart_new(card, 0, MPU401_HW_AZT2320,
                                mpu_port[dev], 0,
-                               mpu_irq[dev], IRQF_DISABLED,
-                               NULL) < 0)
+                               mpu_irq[dev], NULL) < 0)
                        snd_printk(KERN_ERR PFX "no MPU-401 device at 0x%lx\n", mpu_port[dev]);
        }
 
index fe79a169acb52e794e9e33b74c5851b84659da70..dca69f80305fb8f4ecdd4ec47014dd6de093c61d 100644 (file)
@@ -597,7 +597,7 @@ static int __devinit snd_cmi8330_probe(struct snd_card *card, int dev)
        if (mpuport[dev] != SNDRV_AUTO_PORT) {
                if (snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401,
                                        mpuport[dev], 0, mpuirq[dev],
-                                       IRQF_DISABLED, NULL) < 0)
+                                       NULL) < 0)
                        printk(KERN_ERR PFX "no MPU-401 device at 0x%lx.\n",
                                mpuport[dev]);
        }
index cb9153e75b8228ab75851b42d74900dae4c263e8..409fa0ad7843b17f518b7b75678fed01f794f242 100644 (file)
@@ -131,7 +131,6 @@ static int __devinit snd_cs4231_probe(struct device *dev, unsigned int n)
                        mpu_irq[n] = -1;
                if (snd_mpu401_uart_new(card, 0, MPU401_HW_CS4232,
                                        mpu_port[n], 0, mpu_irq[n],
-                                       mpu_irq[n] >= 0 ? IRQF_DISABLED : 0,
                                        NULL) < 0)
                        dev_warn(dev, "MPU401 not detected\n");
        }
index 999dc1e0fdbd5fb95546ef0403a85b5715162c05..0dbde461e6c1b0050f3884fa76b6f654076fbdb0 100644 (file)
@@ -449,8 +449,7 @@ static int __devinit snd_cs423x_probe(struct snd_card *card, int dev)
                        mpu_irq[dev] = -1;
                if (snd_mpu401_uart_new(card, 0, MPU401_HW_CS4232,
                                        mpu_port[dev], 0,
-                                       mpu_irq[dev],
-                                       mpu_irq[dev] >= 0 ? IRQF_DISABLED : 0, NULL) < 0)
+                                       mpu_irq[dev], NULL) < 0)
                        printk(KERN_WARNING IDENT ": MPU401 not detected\n");
        }
 
index 0cde8131a57544b3c4b7dd6ad745f1b6d0383038..5493e9e4bcd5dc1ed38b327bdfb2668d4cd5f444 100644 (file)
@@ -174,7 +174,7 @@ static int __devinit snd_es1688_probe(struct snd_card *card, unsigned int n)
                        chip->mpu_port > 0) {
                error = snd_mpu401_uart_new(card, 0, MPU401_HW_ES1688,
                                chip->mpu_port, 0,
-                               mpu_irq[n], IRQF_DISABLED, NULL);
+                               mpu_irq[n], NULL);
                if (error < 0)
                        return error;
        }
index fb4d6b34bbca5c3e9dce8caeb7c885efd3f6e256..aeee8f8bf5e99be38711d22c9f0af91da44b155d 100644 (file)
@@ -2160,8 +2160,8 @@ static int __devinit snd_audiodrive_probe(struct snd_card *card, int dev)
 
        if (mpu_port[dev] > 0 && mpu_port[dev] != SNDRV_AUTO_PORT) {
                err = snd_mpu401_uart_new(card, 0, MPU401_HW_ES18XX,
-                                         mpu_port[dev], 0,
-                                         irq[dev], 0, &chip->rmidi);
+                                         mpu_port[dev], MPU401_INFO_IRQ_HOOK,
+                                         -1, &chip->rmidi);
                if (err < 0)
                        return err;
        }
index ee54df082b9c079b667ff192737f1dd30b32818a..e51d3244742af23dc673496dd822f20e7d5cfa73 100644 (file)
@@ -585,8 +585,7 @@ static int __devinit snd_galaxy_probe(struct device *dev, unsigned int n)
 
        if (mpu_port[n] >= 0) {
                err = snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401,
-                                         mpu_port[n], 0, mpu_irq[n],
-                                         IRQF_DISABLED, NULL);
+                                         mpu_port[n], 0, mpu_irq[n], NULL);
                if (err < 0)
                        goto error;
        }
index 008e8e5bfa37ae76e235d1c8b873b5c1f4e3ff4a..c4733c08b60b2d7c3b17e6f2d701ab0355591b89 100644 (file)
@@ -317,8 +317,7 @@ static int __devinit snd_gusextreme_probe(struct device *dev, unsigned int n)
 
        if (es1688->mpu_port >= 0x300) {
                error = snd_mpu401_uart_new(card, 0, MPU401_HW_ES1688,
-                               es1688->mpu_port, 0,
-                               mpu_irq[n], IRQF_DISABLED, NULL);
+                               es1688->mpu_port, 0, mpu_irq[n], NULL);
                if (error < 0)
                        goto out;
        }
index 91d6023a63e57c6b14227e158c171b8edf4b8087..0961e2cf20caa8c0697f4775e0621ad0540af242 100644 (file)
@@ -600,7 +600,7 @@ static int __devinit snd_msnd_attach(struct snd_card *card)
                                          mpu_io[0],
                                          MPU401_MODE_INPUT |
                                          MPU401_MODE_OUTPUT,
-                                         mpu_irq[0], IRQF_DISABLED,
+                                         mpu_irq[0],
                                          &chip->rmidi);
                if (err < 0) {
                        printk(KERN_ERR LOGNAME
index 9b915e27b5bd7d422e3b9defd39b3c921795e5cf..de99f47770bfb896b62e807c7a12eabb42617b04 100644 (file)
@@ -707,8 +707,9 @@ static int __devinit snd_opl3sa2_probe(struct snd_card *card, int dev)
        }
        if (midi_port[dev] >= 0x300 && midi_port[dev] < 0x340) {
                if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_OPL3SA2,
-                                              midi_port[dev], 0,
-                                              xirq, 0, &chip->rmidi)) < 0)
+                                              midi_port[dev],
+                                              MPU401_INFO_IRQ_HOOK, -1,
+                                              &chip->rmidi)) < 0)
                        return err;
        }
        sprintf(card->longname, "%s at 0x%lx, irq %d, dma %d",
index 8c24102d0d9389aeca007de307f38fe836e38b53..d94d0f35cb765c92ff503f2d9547ee4a6020a45e 100644 (file)
@@ -1377,8 +1377,7 @@ static int __devinit snd_miro_probe(struct snd_card *card)
                rmidi = NULL;
        else {
                error = snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401,
-                               mpu_port, 0, miro->mpu_irq, IRQF_DISABLED,
-                               &rmidi);
+                               mpu_port, 0, miro->mpu_irq, &rmidi);
                if (error < 0)
                        snd_printk(KERN_WARNING "no MPU-401 device at 0x%lx?\n",
                                   mpu_port);
index c35dc68930dc52ddd3ca0990aa2870995f84e753..346e12baa98e980fd0dff80467c311eb177f8d7c 100644 (file)
@@ -914,7 +914,7 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card)
                rmidi = NULL;
        else {
                error = snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401,
-                               mpu_port, 0, mpu_irq, IRQF_DISABLED, &rmidi);
+                               mpu_port, 0, mpu_irq, &rmidi);
                if (error)
                        snd_printk(KERN_WARNING "no MPU-401 device at 0x%lx?\n",
                                   mpu_port);
index 8ccbcddf08e19d11b153684caba68eeb72da6fac..54e3c2c1806075689609c9ab9076e799504a24ee 100644 (file)
@@ -322,7 +322,6 @@ static int __devinit snd_jazz16_probe(struct device *devptr, unsigned int dev)
                                        MPU401_HW_MPU401,
                                        mpu_port[dev], 0,
                                        mpu_irq[dev],
-                                       mpu_irq[dev] >= 0 ? IRQF_DISABLED : 0,
                                        NULL) < 0)
                        snd_printk(KERN_ERR "no MPU-401 device at 0x%lx\n",
                                        mpu_port[dev]);
index 4d1c5a300ff84de4e75854dcfd17d2540ed4b453..237f8bd7fbe422f6676402e9632b278289f7b223 100644 (file)
@@ -394,8 +394,9 @@ static int __devinit snd_sb16_probe(struct snd_card *card, int dev)
 
        if (chip->mpu_port > 0 && chip->mpu_port != SNDRV_AUTO_PORT) {
                if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_SB,
-                                              chip->mpu_port, 0,
-                                              xirq, 0, &chip->rmidi)) < 0)
+                                              chip->mpu_port,
+                                              MPU401_INFO_IRQ_HOOK, -1,
+                                              &chip->rmidi)) < 0)
                        return err;
                chip->rmidi_callback = snd_mpu401_uart_interrupt;
        }
index 9a8bbf6dd62aeaecc1f51ee28d1b66db3d819f4c..207c161f100c5bd06f416fe5c11bfaa08757a2db 100644 (file)
@@ -658,8 +658,7 @@ static int __devinit snd_sc6000_probe(struct device *devptr, unsigned int dev)
                if (snd_mpu401_uart_new(card, 0,
                                        MPU401_HW_MPU401,
                                        mpu_port[dev], 0,
-                                       mpu_irq[dev], IRQF_DISABLED,
-                                       NULL) < 0)
+                                       mpu_irq[dev], NULL) < 0)
                        snd_printk(KERN_ERR "no MPU-401 device at 0x%lx ?\n",
                                        mpu_port[dev]);
        }
index e2d5d2d3ed96472c30a09c302e4a65442624d4f6..f2379e102b63e6a29503a3c1df24c4d96a3cd456 100644 (file)
@@ -825,8 +825,7 @@ static int __devinit create_mpu401(struct snd_card *card, int devnum,
        int err;
 
        err = snd_mpu401_uart_new(card, devnum, MPU401_HW_MPU401, port,
-                                 MPU401_INFO_INTEGRATED, irq, IRQF_DISABLED,
-                                 &rawmidi);
+                                 MPU401_INFO_INTEGRATED, irq, &rawmidi);
        if (err == 0) {
                struct snd_mpu401 *mpu = rawmidi->private_data;
                mpu->open_input = mpu401_open;
index 711670e4a4251e9cdc91a3b48350ec81a6c03a5c..83f291d89a95ce6dc102f0f8a08eff3f9e6f8e46 100644 (file)
@@ -449,8 +449,7 @@ snd_wavefront_probe (struct snd_card *card, int dev)
        if (cs4232_mpu_port[dev] > 0 && cs4232_mpu_port[dev] != SNDRV_AUTO_PORT) {
                err = snd_mpu401_uart_new(card, midi_dev, MPU401_HW_CS4232,
                                          cs4232_mpu_port[dev], 0,
-                                         cs4232_mpu_irq[dev], IRQF_DISABLED,
-                                         NULL);
+                                         cs4232_mpu_irq[dev], NULL);
                if (err < 0) {
                        snd_printk (KERN_ERR "can't allocate CS4232 MPU-401 device\n");
                        return err;
index a9c1af33f276623931f826b91971a1a6a5937152..04628696eb082adadcef4b6d2b40c21d5195b304 100644 (file)
@@ -931,8 +931,9 @@ static int __devinit snd_card_als4000_probe(struct pci_dev *pci,
 
        if ((err = snd_mpu401_uart_new( card, 0, MPU401_HW_ALS4000,
                                        iobase + ALS4K_IOB_30_MIDI_DATA,
-                                       MPU401_INFO_INTEGRATED,
-                                       pci->irq, 0, &chip->rmidi)) < 0) {
+                                       MPU401_INFO_INTEGRATED |
+                                       MPU401_INFO_IRQ_HOOK,
+                                       -1, &chip->rmidi)) < 0) {
                printk(KERN_ERR "als4000: no MPU-401 device at 0x%lx?\n",
                                iobase + ALS4K_IOB_30_MIDI_DATA);
                goto out_err;
index 0dc8d259d1ed09a708ad8affe38a29dfead7a27f..e6c6a0febb752ab75c951a16dd08e1be01a2dd2a 100644 (file)
@@ -84,7 +84,7 @@ static int __devinit snd_vortex_midi(vortex_t * vortex)
 #ifdef VORTEX_MPU401_LEGACY
        if ((temp =
             snd_mpu401_uart_new(vortex->card, 0, MPU401_HW_MPU401, 0x330,
-                                0, 0, 0, &rmidi)) != 0) {
+                                MPU401_INFO_IRQ_HOOK, -1, &rmidi)) != 0) {
                hwwrite(vortex->mmio, VORTEX_CTRL,
                        (hwread(vortex->mmio, VORTEX_CTRL) &
                         ~CTRL_MIDI_PORT) & ~CTRL_MIDI_EN);
@@ -94,8 +94,8 @@ static int __devinit snd_vortex_midi(vortex_t * vortex)
        port = (unsigned long)(vortex->mmio + VORTEX_MIDI_DATA);
        if ((temp =
             snd_mpu401_uart_new(vortex->card, 0, MPU401_HW_AUREAL, port,
-                                MPU401_INFO_INTEGRATED | MPU401_INFO_MMIO,
-                                0, 0, &rmidi)) != 0) {
+                                MPU401_INFO_INTEGRATED | MPU401_INFO_MMIO |
+                                MPU401_INFO_IRQ_HOOK, -1, &rmidi)) != 0) {
                hwwrite(vortex->mmio, VORTEX_CTRL,
                        (hwread(vortex->mmio, VORTEX_CTRL) &
                         ~CTRL_MIDI_PORT) & ~CTRL_MIDI_EN);
index 579fc0dce12850e8e7cf604039def20abd54b025..d24fe425e87f4500c87059c56557a962ad1e8192 100644 (file)
@@ -2652,8 +2652,9 @@ snd_azf3328_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
           since our hardware ought to be similar, thus use same ID. */
        err = snd_mpu401_uart_new(
                card, 0,
-               MPU401_HW_AZT2320, chip->mpu_io, MPU401_INFO_INTEGRATED,
-               pci->irq, 0, &chip->rmidi
+               MPU401_HW_AZT2320, chip->mpu_io,
+               MPU401_INFO_INTEGRATED | MPU401_INFO_IRQ_HOOK,
+               -1, &chip->rmidi
        );
        if (err < 0) {
                snd_printk(KERN_ERR "azf3328: no MPU-401 device at 0x%lx?\n",
index 9cf99fb7eb9c5b872ab100615f24ff7ca4ce1c72..da9c73211eca7cabe78aee41bb0d5abc3584716f 100644 (file)
@@ -3228,8 +3228,9 @@ static int __devinit snd_cmipci_create(struct snd_card *card, struct pci_dev *pc
                if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_CMIPCI,
                                               iomidi,
                                               (integrated_midi ?
-                                               MPU401_INFO_INTEGRATED : 0),
-                                              cm->irq, 0, &cm->rmidi)) < 0) {
+                                               MPU401_INFO_INTEGRATED : 0) |
+                                              MPU401_INFO_IRQ_HOOK,
+                                              -1, &cm->rmidi)) < 0) {
                        printk(KERN_ERR "cmipci: no UART401 device at 0x%lx\n", iomidi);
                }
        }
index 26a5a2f25d4bc890a6ff42c96580edfd4b5b70ec..718a2643474e5bbb8249b639be2d55d6b7218752 100644 (file)
@@ -1854,8 +1854,9 @@ static int __devinit snd_es1938_probe(struct pci_dev *pci,
                }
        }
        if (snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401,
-                               chip->mpu_port, MPU401_INFO_INTEGRATED,
-                               chip->irq, 0, &chip->rmidi) < 0) {
+                               chip->mpu_port,
+                               MPU401_INFO_INTEGRATED | MPU401_INFO_IRQ_HOOK,
+                               -1, &chip->rmidi) < 0) {
                printk(KERN_ERR "es1938: unable to initialize MPU-401\n");
        } else {
                // this line is vital for MIDI interrupt handling on ess-solo1
index 99ea9320c6b5592ac22ca11cdce0a9347ca37f37..407e4abc43568ee4e728f77b72ee39a645ebee23 100644 (file)
@@ -2843,8 +2843,9 @@ static int __devinit snd_es1968_probe(struct pci_dev *pci,
        if (enable_mpu[dev]) {
                if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401,
                                               chip->io_port + ESM_MPU401_PORT,
-                                              MPU401_INFO_INTEGRATED,
-                                              chip->irq, 0, &chip->rmidi)) < 0) {
+                                              MPU401_INFO_INTEGRATED |
+                                              MPU401_INFO_IRQ_HOOK,
+                                              -1, &chip->rmidi)) < 0) {
                        printk(KERN_WARNING "es1968: skipping MPU-401 MIDI support..\n");
                }
        }
index f9123f09e83e7922aa5a518081d8d711d231e9a9..c55b1b319b747e7a67544e2dada783dc2f59ec23 100644 (file)
@@ -1306,8 +1306,9 @@ static int __devinit snd_card_fm801_probe(struct pci_dev *pci,
        }
        if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_FM801,
                                       FM801_REG(chip, MPU401_DATA),
-                                      MPU401_INFO_INTEGRATED,
-                                      chip->irq, 0, &chip->rmidi)) < 0) {
+                                      MPU401_INFO_INTEGRATED |
+                                      MPU401_INFO_IRQ_HOOK,
+                                      -1, &chip->rmidi)) < 0) {
                snd_card_free(card);
                return err;
        }
index 0ccc0eb75775dd3f6ab4215f6098fb1f3311d2f5..8531b983f3aff90bbc3e76ee5527b01e0bb53629 100644 (file)
@@ -2748,8 +2748,9 @@ static int __devinit snd_ice1712_probe(struct pci_dev *pci,
        if (!c->no_mpu401) {
                err = snd_mpu401_uart_new(card, 0, MPU401_HW_ICE1712,
                        ICEREG(ice, MPU1_CTRL),
-                       (c->mpu401_1_info_flags | MPU401_INFO_INTEGRATED),
-                       ice->irq, 0, &ice->rmidi[0]);
+                       c->mpu401_1_info_flags |
+                       MPU401_INFO_INTEGRATED | MPU401_INFO_IRQ_HOOK,
+                       -1, &ice->rmidi[0]);
                if (err < 0) {
                        snd_card_free(card);
                        return err;
@@ -2764,8 +2765,9 @@ static int __devinit snd_ice1712_probe(struct pci_dev *pci,
                        /*  2nd port used  */
                        err = snd_mpu401_uart_new(card, 1, MPU401_HW_ICE1712,
                                ICEREG(ice, MPU2_CTRL),
-                               (c->mpu401_2_info_flags | MPU401_INFO_INTEGRATED),
-                               ice->irq, 0, &ice->rmidi[1]);
+                               c->mpu401_2_info_flags |
+                               MPU401_INFO_INTEGRATED | MPU401_INFO_IRQ_HOOK,
+                               -1, &ice->rmidi[1]);
 
                        if (err < 0) {
                                snd_card_free(card);
index 0378126e6272b2b5e59d725d26bb627452abb364..2fd4bf2d6653dbba8015a440de385c198afe8a7f 100644 (file)
@@ -2820,8 +2820,8 @@ snd_m3_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
        /* TODO enable MIDI IRQ and I/O */
        err = snd_mpu401_uart_new(chip->card, 0, MPU401_HW_MPU401,
                                  chip->iobase + MPU401_DATA_PORT,
-                                 MPU401_INFO_INTEGRATED,
-                                 chip->irq, 0, &chip->rmidi);
+                                 MPU401_INFO_INTEGRATED | MPU401_INFO_IRQ_HOOK,
+                                 -1, &chip->rmidi);
        if (err < 0)
                printk(KERN_WARNING "maestro3: no MIDI support.\n");
 #endif
index 82311fcb86f6d37e80e6c03e3c7b2503f5a03bba..53e5508abcbf58a69cd345af5d3b6dd113708ec1 100644 (file)
@@ -678,15 +678,15 @@ int oxygen_pci_probe(struct pci_dev *pci, int index, char *id,
                goto err_card;
 
        if (chip->model.device_config & (MIDI_OUTPUT | MIDI_INPUT)) {
-               unsigned int info_flags = MPU401_INFO_INTEGRATED;
+               unsigned int info_flags =
+                               MPU401_INFO_INTEGRATED | MPU401_INFO_IRQ_HOOK;
                if (chip->model.device_config & MIDI_OUTPUT)
                        info_flags |= MPU401_INFO_OUTPUT;
                if (chip->model.device_config & MIDI_INPUT)
                        info_flags |= MPU401_INFO_INPUT;
                err = snd_mpu401_uart_new(card, 0, MPU401_HW_CMIPCI,
                                          chip->addr + OXYGEN_MPU401,
-                                         info_flags, 0, 0,
-                                         &chip->midi);
+                                         info_flags, -1, &chip->midi);
                if (err < 0)
                        goto err_card;
        }
index e34ae14908b312df02b4c5708c924415b09d7cf5..88cc776aa38b1bb7d41c2c35d8f6c91d3c50b290 100644 (file)
@@ -2109,7 +2109,7 @@ snd_card_riptide_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
                val = mpu_port[dev];
                pci_write_config_word(chip->pci, PCI_EXT_MPU_Base, val);
                err = snd_mpu401_uart_new(card, 0, MPU401_HW_RIPTIDE,
-                                         val, 0, chip->irq, 0,
+                                         val, MPU401_INFO_IRQ_HOOK, -1,
                                          &chip->rmidi);
                if (err < 0)
                        snd_printk(KERN_WARNING
index 2571a67b389a1488d83c78ce1d200c343b0aa57a..c5008166cf1f0d67fe0623c07f9e3950639a44a0 100644 (file)
@@ -1493,9 +1493,10 @@ static int __devinit snd_sonic_probe(struct pci_dev *pci,
                return err;
        }
        if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_SONICVIBES,
-                                      sonic->midi_port, MPU401_INFO_INTEGRATED,
-                                      sonic->irq, 0,
-                                      &midi_uart)) < 0) {
+                                      sonic->midi_port,
+                                      MPU401_INFO_INTEGRATED |
+                                      MPU401_INFO_IRQ_HOOK,
+                                      -1, &midi_uart)) < 0) {
                snd_card_free(card);
                return err;
        }
index d8a128f6fc0269e8ecbf4760879547179651b441..5e707effdc7cac127d30db367e7228469b526170 100644 (file)
@@ -148,8 +148,9 @@ static int __devinit snd_trident_probe(struct pci_dev *pci,
        if (trident->device != TRIDENT_DEVICE_ID_SI7018 &&
            (err = snd_mpu401_uart_new(card, 0, MPU401_HW_TRID4DWAVE,
                                       trident->midi_port,
-                                      MPU401_INFO_INTEGRATED,
-                                      trident->irq, 0, &trident->rmidi)) < 0) {
+                                      MPU401_INFO_INTEGRATED |
+                                      MPU401_INFO_IRQ_HOOK,
+                                      -1, &trident->rmidi)) < 0) {
                snd_card_free(card);
                return err;
        }
index f03fd620a2a0760b1f028529dd5ad17c654dbc27..35d5f4313d99bac9d46f043f882a92891b5835dc 100644 (file)
@@ -2068,8 +2068,9 @@ static int __devinit snd_via686_init_misc(struct via82xx *chip)
        pci_write_config_byte(chip->pci, VIA_PNP_CONTROL, legacy_cfg);
        if (chip->mpu_res) {
                if (snd_mpu401_uart_new(chip->card, 0, MPU401_HW_VIA686A,
-                                       mpu_port, MPU401_INFO_INTEGRATED,
-                                       chip->irq, 0, &chip->rmidi) < 0) {
+                                       mpu_port, MPU401_INFO_INTEGRATED |
+                                       MPU401_INFO_IRQ_HOOK, -1,
+                                       &chip->rmidi) < 0) {
                        printk(KERN_WARNING "unable to initialize MPU-401"
                               " at 0x%lx, skipping\n", mpu_port);
                        legacy &= ~VIA_FUNC_ENABLE_MIDI;
index 511d5765312495bb71b8ed2d37cb7cf284a725de..3253b04da18449ecd7a2a0dfad911b9c2c065b64 100644 (file)
@@ -305,8 +305,9 @@ static int __devinit snd_card_ymfpci_probe(struct pci_dev *pci,
        if (chip->mpu_res) {
                if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_YMFPCI,
                                               mpu_port[dev],
-                                              MPU401_INFO_INTEGRATED,
-                                              pci->irq, 0, &chip->rawmidi)) < 0) {
+                                              MPU401_INFO_INTEGRATED |
+                                              MPU401_INFO_IRQ_HOOK,
+                                              -1, &chip->rawmidi)) < 0) {
                        printk(KERN_WARNING "ymfpci: cannot initialize MPU401 at 0x%lx, skipping...\n", mpu_port[dev]);
                        legacy_ctrl &= ~YMFPCI_LEGACY_MIEN; /* disable MPU401 irq */
                        pci_write_config_word(pci, PCIR_DSXG_LEGACY, legacy_ctrl);