From: Christoph Schulz <develop@kristov.de>

Background: The card/chipset supports an external MIDI interrupt.  By
default, this interrupt isn't used (because the isapnp mechanism chooses a
configuration without an assigned interrupt).  If the user wishes to
explicitly select an interrupt via the mpu_irq parameter for such a
configured device, it doesn't work: The driver always shows:

isapnp MPU: port=0x330, irq=-1

(note the "irq=-1")

Problem: The driver only allows to set the irq if pnp_irq_valid returns
true for this particular pnp device.  This, however, is only true if an
interrupt has already been assigned (pnp_valid_irq returns true if the flag
IORESOURCE_IRQ is set and IORESOURCE_UNSET is not set).  If no interrupt
has been assigned so far, IORESOURCE_UNSET is set and pnp_irq_valid returns
false, thereby inhibiting the selection of a valid irq.

Solution: Don't check for a valid (= already assigned) irq at the point of
calling pnp_resource_change.

Tested successfully on Linux 2.6.11.

Before applying the patch:

May 30 10:50:15 fenrir kernel: pnp: Device 01:01.00 activated.
May 30 10:50:15 fenrir kernel: ALSA sound/isa/cs423x/cs4236.c:325:
isapnp WSS: wss port=0x534, fm port=0x388, sb port=0x220
May 30 10:50:15 fenrir kernel: ALSA sound/isa/cs423x/cs4236.c:327:
isapnp WSS: irq=5, dma1=1, dma2=3
May 30 10:50:15 fenrir kernel: pnp: Device 01:01.02 activated.
May 30 10:50:15 fenrir kernel: ALSA sound/isa/cs423x/cs4236.c:344:
isapnp CTRL: control port=0x120
May 30 10:50:15 fenrir kernel: pnp: Device 01:01.03 activated.
May 30 10:50:15 fenrir kernel: ALSA sound/isa/cs423x/cs4236.c:372:
isapnp MPU: port=0x330, irq=-1
May 30 10:50:15 fenrir kernel: ALSA sound/isa/cs423x/cs4231_lib.c:1053:
cs4231: port = 0x534, id = 0xa
May 30 10:50:15 fenrir kernel: ALSA sound/isa/cs423x/cs4231_lib.c:1059:
CS4231: VERSION (I25) = 0x3
May 30 10:50:15 fenrir kernel: ALSA sound/isa/cs423x/cs4231_lib.c:1128:
CS4231: ext version; rev = 0xeb, id = 0xeb
May 30 10:50:15 fenrir kernel: ALSA sound/isa/cs423x/cs4236_lib.c:300:
CS4236: [0x120] C1 (version) = 0xeb, ext = 0xeb

After applying the patch:

May 30 12:06:46 fenrir kernel: pnp: Device 01:01.00 activated.
May 30 12:06:46 fenrir kernel: ALSA sound/isa/cs423x/cs4236.c:325:
isapnp WSS: wss port=0x534, fm port=0x388, sb port=0x220
May 30 12:06:46 fenrir kernel: ALSA sound/isa/cs423x/cs4236.c:327:
isapnp WSS: irq=5, dma1=1, dma2=3
May 30 12:06:46 fenrir kernel: pnp: Device 01:01.02 activated.
May 30 12:06:46 fenrir kernel: ALSA sound/isa/cs423x/cs4236.c:344:
isapnp CTRL: control port=0x120
May 30 12:06:46 fenrir kernel: pnp: Device 01:01.03 activated.
May 30 12:06:46 fenrir kernel: ALSA sound/isa/cs423x/cs4236.c:371:
isapnp MPU: port=0x330, irq=11
May 30 12:06:46 fenrir kernel: ALSA sound/isa/cs423x/cs4231_lib.c:1053:
cs4231: port = 0x534, id = 0xa
May 30 12:06:46 fenrir kernel: ALSA sound/isa/cs423x/cs4231_lib.c:1059:
CS4231: VERSION (I25) = 0x3
May 30 12:06:46 fenrir kernel: ALSA sound/isa/cs423x/cs4231_lib.c:1128:
CS4231: ext version; rev = 0xeb, id = 0xeb
May 30 12:06:46 fenrir kernel: ALSA sound/isa/cs423x/cs4236_lib.c:300:
CS4236: [0x120] C1 (version) = 0xeb, ext = 0xeb

(note the "irq=11" after applying the patch)

Cc: Jaroslav Kysela <perex@suse.cz>
Cc: Takashi Iwai <tiwai@suse.de>
Cc: Adam Belay <ambx1@neo.rr.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 sound/isa/cs423x/cs4236.c |    3 +--
 1 files changed, 1 insertion(+), 2 deletions(-)

diff -puN sound/isa/cs423x/cs4236.c~cs4236-irq-handling-fix sound/isa/cs423x/cs4236.c
--- 25/sound/isa/cs423x/cs4236.c~cs4236-irq-handling-fix	Thu Jun  2 14:21:04 2005
+++ 25-akpm/sound/isa/cs423x/cs4236.c	Thu Jun  2 14:21:04 2005
@@ -349,8 +349,7 @@ static int __devinit snd_card_cs4236_pnp
 		pnp_init_resource_table(cfg);
 		if (mpu_port[dev] != SNDRV_AUTO_PORT)
 			pnp_resource_change(&cfg->port_resource[0], mpu_port[dev], 2);
-		if (mpu_irq[dev] != SNDRV_AUTO_IRQ && mpu_irq[dev] >= 0 &&
-		    pnp_irq_valid(pdev, 0))
+		if (mpu_irq[dev] != SNDRV_AUTO_IRQ && mpu_irq[dev] >= 0)
 			pnp_resource_change(&cfg->irq_resource[0], mpu_irq[dev], 1);
 		err = pnp_manual_config_dev(pdev, cfg, 0);
 		if (err < 0)
_