public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Christoph Schulz <develop@kristov.de>
To: perex@suse.cz
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] cs4236.c, kernel 2.6.11
Date: Wed, 01 Jun 2005 01:33:06 +0200	[thread overview]
Message-ID: <429CF432.6020702@kristov.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 3559 bytes --]

Hello,

please consider attached patch for the cs4236.c driver module, located
in sound/isa/cs423x/ in the Linux 2.6.11 kernel.

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)

I am not a kernel developer, so I cannot guarantee that my observations
are correct. Please feel free to contact me for further information
and/or if I should have missed something. Please cc: to me if possible.


Regards,

Christoph Schulz
E-Mail: develop@kristov.de


[-- Attachment #2: cs4236-irq.patch --]
[-- Type: text/plain, Size: 702 bytes --]

diff -ur linux-2.6.11/sound/isa/cs423x/cs4236.c linux-2.6.11-patched/sound/isa/cs423x/cs4236.c
--- linux-2.6.11/sound/isa/cs423x/cs4236.c	2005-03-02 07:37:48.000000000 +0100
+++ linux-2.6.11-patched/sound/isa/cs423x/cs4236.c	2005-05-31 14:31:07.040130710 +0200
@@ -349,8 +349,7 @@
 		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)

                 reply	other threads:[~2005-05-31 23:34 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=429CF432.6020702@kristov.de \
    --to=develop@kristov.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox