aboutsummaryrefslogtreecommitdiffstats
path: root/sound/isa
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2011-09-13 05:24:41 -0400
committerTakashi Iwai <tiwai@suse.de>2011-09-14 05:00:51 -0400
commitdba8b46992c55946d3b092934f581a343403118f (patch)
tree7ea5af971bc5cc8ecf4c8af1e0547fa11291ba86 /sound/isa
parent47124373b59e43fd07cbf7b44d9288f19c1d5a93 (diff)
ALSA: mpu401: clean up interrupt specification
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>
Diffstat (limited to 'sound/isa')
-rw-r--r--sound/isa/ad1816a/ad1816a.c2
-rw-r--r--sound/isa/als100.c1
-rw-r--r--sound/isa/azt2320.c3
-rw-r--r--sound/isa/cmi8330.c2
-rw-r--r--sound/isa/cs423x/cs4231.c1
-rw-r--r--sound/isa/cs423x/cs4236.c3
-rw-r--r--sound/isa/es1688/es1688.c2
-rw-r--r--sound/isa/es18xx.c4
-rw-r--r--sound/isa/galaxy/galaxy.c3
-rw-r--r--sound/isa/gus/gusextreme.c3
-rw-r--r--sound/isa/msnd/msnd_pinnacle.c2
-rw-r--r--sound/isa/opl3sa2.c5
-rw-r--r--sound/isa/opti9xx/miro.c3
-rw-r--r--sound/isa/opti9xx/opti92x-ad1848.c2
-rw-r--r--sound/isa/sb/jazz16.c1
-rw-r--r--sound/isa/sb/sb16.c5
-rw-r--r--sound/isa/sc6000.c3
-rw-r--r--sound/isa/sscape.c3
-rw-r--r--sound/isa/wavefront/wavefront.c3
19 files changed, 21 insertions, 30 deletions
diff --git a/sound/isa/ad1816a/ad1816a.c b/sound/isa/ad1816a/ad1816a.c
index 3cb75bc97699..a87a2b566e19 100644
--- a/sound/isa/ad1816a/ad1816a.c
+++ b/sound/isa/ad1816a/ad1816a.c
@@ -204,7 +204,7 @@ static int __devinit snd_card_ad1816a_probe(int dev, struct pnp_card_link *pcard
204 204
205 if (mpu_port[dev] > 0) { 205 if (mpu_port[dev] > 0) {
206 if (snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401, 206 if (snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401,
207 mpu_port[dev], 0, mpu_irq[dev], IRQF_DISABLED, 207 mpu_port[dev], 0, mpu_irq[dev],
208 NULL) < 0) 208 NULL) < 0)
209 printk(KERN_ERR PFX "no MPU-401 device at 0x%lx.\n", mpu_port[dev]); 209 printk(KERN_ERR PFX "no MPU-401 device at 0x%lx.\n", mpu_port[dev]);
210 } 210 }
diff --git a/sound/isa/als100.c b/sound/isa/als100.c
index 20becc89f6f6..706effd6b3cd 100644
--- a/sound/isa/als100.c
+++ b/sound/isa/als100.c
@@ -256,7 +256,6 @@ static int __devinit snd_card_als100_probe(int dev,
256 mpu_type, 256 mpu_type,
257 mpu_port[dev], 0, 257 mpu_port[dev], 0,
258 mpu_irq[dev], 258 mpu_irq[dev],
259 mpu_irq[dev] >= 0 ? IRQF_DISABLED : 0,
260 NULL) < 0) 259 NULL) < 0)
261 snd_printk(KERN_ERR PFX "no MPU-401 device at 0x%lx\n", mpu_port[dev]); 260 snd_printk(KERN_ERR PFX "no MPU-401 device at 0x%lx\n", mpu_port[dev]);
262 } 261 }
diff --git a/sound/isa/azt2320.c b/sound/isa/azt2320.c
index aac8dc15c2fe..b7bdbf307740 100644
--- a/sound/isa/azt2320.c
+++ b/sound/isa/azt2320.c
@@ -234,8 +234,7 @@ static int __devinit snd_card_azt2320_probe(int dev,
234 if (mpu_port[dev] > 0 && mpu_port[dev] != SNDRV_AUTO_PORT) { 234 if (mpu_port[dev] > 0 && mpu_port[dev] != SNDRV_AUTO_PORT) {
235 if (snd_mpu401_uart_new(card, 0, MPU401_HW_AZT2320, 235 if (snd_mpu401_uart_new(card, 0, MPU401_HW_AZT2320,
236 mpu_port[dev], 0, 236 mpu_port[dev], 0,
237 mpu_irq[dev], IRQF_DISABLED, 237 mpu_irq[dev], NULL) < 0)
238 NULL) < 0)
239 snd_printk(KERN_ERR PFX "no MPU-401 device at 0x%lx\n", mpu_port[dev]); 238 snd_printk(KERN_ERR PFX "no MPU-401 device at 0x%lx\n", mpu_port[dev]);
240 } 239 }
241 240
diff --git a/sound/isa/cmi8330.c b/sound/isa/cmi8330.c
index fe79a169acb5..dca69f80305f 100644
--- a/sound/isa/cmi8330.c
+++ b/sound/isa/cmi8330.c
@@ -597,7 +597,7 @@ static int __devinit snd_cmi8330_probe(struct snd_card *card, int dev)
597 if (mpuport[dev] != SNDRV_AUTO_PORT) { 597 if (mpuport[dev] != SNDRV_AUTO_PORT) {
598 if (snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401, 598 if (snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401,
599 mpuport[dev], 0, mpuirq[dev], 599 mpuport[dev], 0, mpuirq[dev],
600 IRQF_DISABLED, NULL) < 0) 600 NULL) < 0)
601 printk(KERN_ERR PFX "no MPU-401 device at 0x%lx.\n", 601 printk(KERN_ERR PFX "no MPU-401 device at 0x%lx.\n",
602 mpuport[dev]); 602 mpuport[dev]);
603 } 603 }
diff --git a/sound/isa/cs423x/cs4231.c b/sound/isa/cs423x/cs4231.c
index cb9153e75b82..409fa0ad7843 100644
--- a/sound/isa/cs423x/cs4231.c
+++ b/sound/isa/cs423x/cs4231.c
@@ -131,7 +131,6 @@ static int __devinit snd_cs4231_probe(struct device *dev, unsigned int n)
131 mpu_irq[n] = -1; 131 mpu_irq[n] = -1;
132 if (snd_mpu401_uart_new(card, 0, MPU401_HW_CS4232, 132 if (snd_mpu401_uart_new(card, 0, MPU401_HW_CS4232,
133 mpu_port[n], 0, mpu_irq[n], 133 mpu_port[n], 0, mpu_irq[n],
134 mpu_irq[n] >= 0 ? IRQF_DISABLED : 0,
135 NULL) < 0) 134 NULL) < 0)
136 dev_warn(dev, "MPU401 not detected\n"); 135 dev_warn(dev, "MPU401 not detected\n");
137 } 136 }
diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c
index 999dc1e0fdbd..0dbde461e6c1 100644
--- a/sound/isa/cs423x/cs4236.c
+++ b/sound/isa/cs423x/cs4236.c
@@ -449,8 +449,7 @@ static int __devinit snd_cs423x_probe(struct snd_card *card, int dev)
449 mpu_irq[dev] = -1; 449 mpu_irq[dev] = -1;
450 if (snd_mpu401_uart_new(card, 0, MPU401_HW_CS4232, 450 if (snd_mpu401_uart_new(card, 0, MPU401_HW_CS4232,
451 mpu_port[dev], 0, 451 mpu_port[dev], 0,
452 mpu_irq[dev], 452 mpu_irq[dev], NULL) < 0)
453 mpu_irq[dev] >= 0 ? IRQF_DISABLED : 0, NULL) < 0)
454 printk(KERN_WARNING IDENT ": MPU401 not detected\n"); 453 printk(KERN_WARNING IDENT ": MPU401 not detected\n");
455 } 454 }
456 455
diff --git a/sound/isa/es1688/es1688.c b/sound/isa/es1688/es1688.c
index 0cde8131a575..5493e9e4bcd5 100644
--- a/sound/isa/es1688/es1688.c
+++ b/sound/isa/es1688/es1688.c
@@ -174,7 +174,7 @@ static int __devinit snd_es1688_probe(struct snd_card *card, unsigned int n)
174 chip->mpu_port > 0) { 174 chip->mpu_port > 0) {
175 error = snd_mpu401_uart_new(card, 0, MPU401_HW_ES1688, 175 error = snd_mpu401_uart_new(card, 0, MPU401_HW_ES1688,
176 chip->mpu_port, 0, 176 chip->mpu_port, 0,
177 mpu_irq[n], IRQF_DISABLED, NULL); 177 mpu_irq[n], NULL);
178 if (error < 0) 178 if (error < 0)
179 return error; 179 return error;
180 } 180 }
diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c
index fb4d6b34bbca..aeee8f8bf5e9 100644
--- a/sound/isa/es18xx.c
+++ b/sound/isa/es18xx.c
@@ -2160,8 +2160,8 @@ static int __devinit snd_audiodrive_probe(struct snd_card *card, int dev)
2160 2160
2161 if (mpu_port[dev] > 0 && mpu_port[dev] != SNDRV_AUTO_PORT) { 2161 if (mpu_port[dev] > 0 && mpu_port[dev] != SNDRV_AUTO_PORT) {
2162 err = snd_mpu401_uart_new(card, 0, MPU401_HW_ES18XX, 2162 err = snd_mpu401_uart_new(card, 0, MPU401_HW_ES18XX,
2163 mpu_port[dev], 0, 2163 mpu_port[dev], MPU401_INFO_IRQ_HOOK,
2164 irq[dev], 0, &chip->rmidi); 2164 -1, &chip->rmidi);
2165 if (err < 0) 2165 if (err < 0)
2166 return err; 2166 return err;
2167 } 2167 }
diff --git a/sound/isa/galaxy/galaxy.c b/sound/isa/galaxy/galaxy.c
index ee54df082b9c..e51d3244742a 100644
--- a/sound/isa/galaxy/galaxy.c
+++ b/sound/isa/galaxy/galaxy.c
@@ -585,8 +585,7 @@ static int __devinit snd_galaxy_probe(struct device *dev, unsigned int n)
585 585
586 if (mpu_port[n] >= 0) { 586 if (mpu_port[n] >= 0) {
587 err = snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401, 587 err = snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401,
588 mpu_port[n], 0, mpu_irq[n], 588 mpu_port[n], 0, mpu_irq[n], NULL);
589 IRQF_DISABLED, NULL);
590 if (err < 0) 589 if (err < 0)
591 goto error; 590 goto error;
592 } 591 }
diff --git a/sound/isa/gus/gusextreme.c b/sound/isa/gus/gusextreme.c
index 008e8e5bfa37..c4733c08b60b 100644
--- a/sound/isa/gus/gusextreme.c
+++ b/sound/isa/gus/gusextreme.c
@@ -317,8 +317,7 @@ static int __devinit snd_gusextreme_probe(struct device *dev, unsigned int n)
317 317
318 if (es1688->mpu_port >= 0x300) { 318 if (es1688->mpu_port >= 0x300) {
319 error = snd_mpu401_uart_new(card, 0, MPU401_HW_ES1688, 319 error = snd_mpu401_uart_new(card, 0, MPU401_HW_ES1688,
320 es1688->mpu_port, 0, 320 es1688->mpu_port, 0, mpu_irq[n], NULL);
321 mpu_irq[n], IRQF_DISABLED, NULL);
322 if (error < 0) 321 if (error < 0)
323 goto out; 322 goto out;
324 } 323 }
diff --git a/sound/isa/msnd/msnd_pinnacle.c b/sound/isa/msnd/msnd_pinnacle.c
index 91d6023a63e5..0961e2cf20ca 100644
--- a/sound/isa/msnd/msnd_pinnacle.c
+++ b/sound/isa/msnd/msnd_pinnacle.c
@@ -600,7 +600,7 @@ static int __devinit snd_msnd_attach(struct snd_card *card)
600 mpu_io[0], 600 mpu_io[0],
601 MPU401_MODE_INPUT | 601 MPU401_MODE_INPUT |
602 MPU401_MODE_OUTPUT, 602 MPU401_MODE_OUTPUT,
603 mpu_irq[0], IRQF_DISABLED, 603 mpu_irq[0],
604 &chip->rmidi); 604 &chip->rmidi);
605 if (err < 0) { 605 if (err < 0) {
606 printk(KERN_ERR LOGNAME 606 printk(KERN_ERR LOGNAME
diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c
index 9b915e27b5bd..de99f47770bf 100644
--- a/sound/isa/opl3sa2.c
+++ b/sound/isa/opl3sa2.c
@@ -707,8 +707,9 @@ static int __devinit snd_opl3sa2_probe(struct snd_card *card, int dev)
707 } 707 }
708 if (midi_port[dev] >= 0x300 && midi_port[dev] < 0x340) { 708 if (midi_port[dev] >= 0x300 && midi_port[dev] < 0x340) {
709 if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_OPL3SA2, 709 if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_OPL3SA2,
710 midi_port[dev], 0, 710 midi_port[dev],
711 xirq, 0, &chip->rmidi)) < 0) 711 MPU401_INFO_IRQ_HOOK, -1,
712 &chip->rmidi)) < 0)
712 return err; 713 return err;
713 } 714 }
714 sprintf(card->longname, "%s at 0x%lx, irq %d, dma %d", 715 sprintf(card->longname, "%s at 0x%lx, irq %d, dma %d",
diff --git a/sound/isa/opti9xx/miro.c b/sound/isa/opti9xx/miro.c
index 8c24102d0d93..d94d0f35cb76 100644
--- a/sound/isa/opti9xx/miro.c
+++ b/sound/isa/opti9xx/miro.c
@@ -1377,8 +1377,7 @@ static int __devinit snd_miro_probe(struct snd_card *card)
1377 rmidi = NULL; 1377 rmidi = NULL;
1378 else { 1378 else {
1379 error = snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401, 1379 error = snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401,
1380 mpu_port, 0, miro->mpu_irq, IRQF_DISABLED, 1380 mpu_port, 0, miro->mpu_irq, &rmidi);
1381 &rmidi);
1382 if (error < 0) 1381 if (error < 0)
1383 snd_printk(KERN_WARNING "no MPU-401 device at 0x%lx?\n", 1382 snd_printk(KERN_WARNING "no MPU-401 device at 0x%lx?\n",
1384 mpu_port); 1383 mpu_port);
diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c
index c35dc68930dc..346e12baa98e 100644
--- a/sound/isa/opti9xx/opti92x-ad1848.c
+++ b/sound/isa/opti9xx/opti92x-ad1848.c
@@ -914,7 +914,7 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card)
914 rmidi = NULL; 914 rmidi = NULL;
915 else { 915 else {
916 error = snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401, 916 error = snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401,
917 mpu_port, 0, mpu_irq, IRQF_DISABLED, &rmidi); 917 mpu_port, 0, mpu_irq, &rmidi);
918 if (error) 918 if (error)
919 snd_printk(KERN_WARNING "no MPU-401 device at 0x%lx?\n", 919 snd_printk(KERN_WARNING "no MPU-401 device at 0x%lx?\n",
920 mpu_port); 920 mpu_port);
diff --git a/sound/isa/sb/jazz16.c b/sound/isa/sb/jazz16.c
index 8ccbcddf08e1..54e3c2c18060 100644
--- a/sound/isa/sb/jazz16.c
+++ b/sound/isa/sb/jazz16.c
@@ -322,7 +322,6 @@ static int __devinit snd_jazz16_probe(struct device *devptr, unsigned int dev)
322 MPU401_HW_MPU401, 322 MPU401_HW_MPU401,
323 mpu_port[dev], 0, 323 mpu_port[dev], 0,
324 mpu_irq[dev], 324 mpu_irq[dev],
325 mpu_irq[dev] >= 0 ? IRQF_DISABLED : 0,
326 NULL) < 0) 325 NULL) < 0)
327 snd_printk(KERN_ERR "no MPU-401 device at 0x%lx\n", 326 snd_printk(KERN_ERR "no MPU-401 device at 0x%lx\n",
328 mpu_port[dev]); 327 mpu_port[dev]);
diff --git a/sound/isa/sb/sb16.c b/sound/isa/sb/sb16.c
index 4d1c5a300ff8..237f8bd7fbe4 100644
--- a/sound/isa/sb/sb16.c
+++ b/sound/isa/sb/sb16.c
@@ -394,8 +394,9 @@ static int __devinit snd_sb16_probe(struct snd_card *card, int dev)
394 394
395 if (chip->mpu_port > 0 && chip->mpu_port != SNDRV_AUTO_PORT) { 395 if (chip->mpu_port > 0 && chip->mpu_port != SNDRV_AUTO_PORT) {
396 if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_SB, 396 if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_SB,
397 chip->mpu_port, 0, 397 chip->mpu_port,
398 xirq, 0, &chip->rmidi)) < 0) 398 MPU401_INFO_IRQ_HOOK, -1,
399 &chip->rmidi)) < 0)
399 return err; 400 return err;
400 chip->rmidi_callback = snd_mpu401_uart_interrupt; 401 chip->rmidi_callback = snd_mpu401_uart_interrupt;
401 } 402 }
diff --git a/sound/isa/sc6000.c b/sound/isa/sc6000.c
index 9a8bbf6dd62a..207c161f100c 100644
--- a/sound/isa/sc6000.c
+++ b/sound/isa/sc6000.c
@@ -658,8 +658,7 @@ static int __devinit snd_sc6000_probe(struct device *devptr, unsigned int dev)
658 if (snd_mpu401_uart_new(card, 0, 658 if (snd_mpu401_uart_new(card, 0,
659 MPU401_HW_MPU401, 659 MPU401_HW_MPU401,
660 mpu_port[dev], 0, 660 mpu_port[dev], 0,
661 mpu_irq[dev], IRQF_DISABLED, 661 mpu_irq[dev], NULL) < 0)
662 NULL) < 0)
663 snd_printk(KERN_ERR "no MPU-401 device at 0x%lx ?\n", 662 snd_printk(KERN_ERR "no MPU-401 device at 0x%lx ?\n",
664 mpu_port[dev]); 663 mpu_port[dev]);
665 } 664 }
diff --git a/sound/isa/sscape.c b/sound/isa/sscape.c
index e2d5d2d3ed96..f2379e102b63 100644
--- a/sound/isa/sscape.c
+++ b/sound/isa/sscape.c
@@ -825,8 +825,7 @@ static int __devinit create_mpu401(struct snd_card *card, int devnum,
825 int err; 825 int err;
826 826
827 err = snd_mpu401_uart_new(card, devnum, MPU401_HW_MPU401, port, 827 err = snd_mpu401_uart_new(card, devnum, MPU401_HW_MPU401, port,
828 MPU401_INFO_INTEGRATED, irq, IRQF_DISABLED, 828 MPU401_INFO_INTEGRATED, irq, &rawmidi);
829 &rawmidi);
830 if (err == 0) { 829 if (err == 0) {
831 struct snd_mpu401 *mpu = rawmidi->private_data; 830 struct snd_mpu401 *mpu = rawmidi->private_data;
832 mpu->open_input = mpu401_open; 831 mpu->open_input = mpu401_open;
diff --git a/sound/isa/wavefront/wavefront.c b/sound/isa/wavefront/wavefront.c
index 711670e4a425..83f291d89a95 100644
--- a/sound/isa/wavefront/wavefront.c
+++ b/sound/isa/wavefront/wavefront.c
@@ -449,8 +449,7 @@ snd_wavefront_probe (struct snd_card *card, int dev)
449 if (cs4232_mpu_port[dev] > 0 && cs4232_mpu_port[dev] != SNDRV_AUTO_PORT) { 449 if (cs4232_mpu_port[dev] > 0 && cs4232_mpu_port[dev] != SNDRV_AUTO_PORT) {
450 err = snd_mpu401_uart_new(card, midi_dev, MPU401_HW_CS4232, 450 err = snd_mpu401_uart_new(card, midi_dev, MPU401_HW_CS4232,
451 cs4232_mpu_port[dev], 0, 451 cs4232_mpu_port[dev], 0,
452 cs4232_mpu_irq[dev], IRQF_DISABLED, 452 cs4232_mpu_irq[dev], NULL);
453 NULL);
454 if (err < 0) { 453 if (err < 0) {
455 snd_printk (KERN_ERR "can't allocate CS4232 MPU-401 device\n"); 454 snd_printk (KERN_ERR "can't allocate CS4232 MPU-401 device\n");
456 return err; 455 return err;