Skip to contentSkip to conversation

Releasing IRQs in older kernels

DISCUSSION Risto Suominen 2 participants 4 messages Apr 14, 2008 – Apr 16, 2008

lore
Share & tools
lore
#0 lore raw

I'd like to bring up a problem with using alsa-driver on older kernels. I already made a bug report regarding snd-powermac:
https://bugtrack.alsa-project.org/alsa-bug/view.php?id=3883. It's possible that other drivers suffer from this, too.

If I've understood it right, 1.0.16 should be usable on 2.2 kernels and newer. Well, it woudn't compile on 2.6.15-26-powerpc (Ubuntu 6.06.1 Dapper) without some patching.

However, the real problem began, when I tried to unload the module. It seems that something has changed (when?) in the kernel's IRQ interface, and ALSA tries to make old code compatible with it by introducing snd_request/free_irq, to be used with older kernels. The idea is to distuingish between IRQs by the last parameter, usually chip's address. This leads to trouble when several IRQs come from the same chip, as is the case with snd-powermac.

My conclusion: the drivers suffering from this should be identified, and some alternative way of handling IRQs correctly on different kernel versions should be developed.

Risto

#1 lore raw

At Mon, 14 Apr 2008 23:48:15 +0300,

Quoted 18 lines · Risto Suominen

I'd like to bring up a problem with using alsa-driver on older kernels. I already made a bug report regarding snd-powermac:
https://bugtrack.alsa-project.org/alsa-bug/view.php?id=3883. It's possible that other drivers suffer from this, too.

If I've understood it right, 1.0.16 should be usable on 2.2 kernels and newer. Well, it woudn't compile on 2.6.15-26-powerpc (Ubuntu 6.06.1 Dapper) without some patching.

However, the real problem began, when I tried to unload the module. It seems that something has changed (when?) in the kernel's IRQ interface, and ALSA tries to make old code compatible with it by introducing snd_request/free_irq, to be used with older kernels. The idea is to distuingish between IRQs by the last parameter, usually chip's address. This leads to trouble when several IRQs come from the same chip, as is the case with snd-powermac.

Quoted 3 lines

My conclusion: the drivers suffering from this should be identified, and some alternative way of handling IRQs correctly on different kernel versions should be developed.

Does the patch below work?

Takashi

---

acore/wrappers.c +3 -1
diff -r 9bd27001c3e6 acore/wrappers.c
@@ -250,6 +250,7 @@ typedef int (*snd_irq_handler_t)(int, vo
 typedef int (*snd_irq_handler_t)(int, void *);
 struct irq_list {
 	snd_irq_handler_t handler;
+	int irq;
 	void *data;
 	struct list_head list;
 };
@@ -289,6 +290,7 @@ int snd_request_irq(unsigned int irq, sn
 	if (!list)
 		return -ENOMEM;
 	list->handler = handler;
+	list->irq = irq;
 	list->data = data;
 	err = request_irq(irq, irq_redirect, irq_flags, str, list);
 	if (err) {
@@ -309,7 +311,7 @@ void snd_free_irq(unsigned int irq, void
 	mutex_lock(&irq_list_mutex);
 	list_for_each(p, &irq_list_head) {
 		struct irq_list *list = list_entry(p, struct irq_list, list);
-		if (list->data == data) {
+		if (list->irq == irq && list->data == data) {
 			free_irq(irq, list);
 			list_del(p);
 			kfree(list);
#2 lore raw

2008/4/15, Takashi Iwai <[email protected]>:

Quoted 3 lines

Does the patch below work?

That was fast. And so simple. Thank you. It works :)

Risto

ps. There are still warnings about 2nd argument's types in ppc/pmac_old.c lines 1248, 1256 , and 1263. Maybe this is the right way to get rid of them:

pmac_old.c renamed from pmac_old.c.orig +3 -3
@@ -725,7 +725,7 @@ void snd_pmac_beep_dma_stop(struct snd_p
  * interrupt handlers
  */
 static irqreturn_t
-snd_pmac_tx_intr(int irq, void *devid, struct pt_regs *regs)
+snd_pmac_tx_intr(int irq, void *devid)
 {
 	struct snd_pmac *chip = devid;
 	snd_pmac_pcm_update(chip, &chip->playback);
@@ -734,7 +734,7 @@ snd_pmac_tx_intr(int irq, void *devid, s
 
 
 static irqreturn_t
-snd_pmac_rx_intr(int irq, void *devid, struct pt_regs *regs)
+snd_pmac_rx_intr(int irq, void *devid)
 {
 	struct snd_pmac *chip = devid;
 	snd_pmac_pcm_update(chip, &chip->capture);
@@ -743,7 +743,7 @@ snd_pmac_rx_intr(int irq, void *devid, s
 
 
 static irqreturn_t
-snd_pmac_ctrl_intr(int irq, void *devid, struct pt_regs *regs)
+snd_pmac_ctrl_intr(int irq, void *devid)
 {
 	struct snd_pmac *chip = devid;
 	int ctrl = in_le32(&chip->awacs->control);
#3 lore raw

At Tue, 15 Apr 2008 20:36:04 +0300,

Quoted 6 lines · Risto Suominen

2008/4/15, Takashi Iwai <[email protected]>:

Quoted 3 lines

Does the patch below work?

Quoted 7 lines

That was fast. And so simple. Thank you. It works :)

Risto

ps. There are still warnings about 2nd argument's types in ppc/pmac_old.c lines 1248, 1256 , and 1263. Maybe this is the right way to get rid of them:

Oh yes, thanks, fixed on HG tree now.

Takashi

Quoted 31 lines
pmac_old.c renamed from pmac_old.c.orig +3 -3
@@ -725,7 +725,7 @@ void snd_pmac_beep_dma_stop(struct snd_p
  * interrupt handlers
  */
 static irqreturn_t
-snd_pmac_tx_intr(int irq, void *devid, struct pt_regs *regs)
+snd_pmac_tx_intr(int irq, void *devid)
 {
 	struct snd_pmac *chip = devid;
 	snd_pmac_pcm_update(chip, &chip->playback);
@@ -734,7 +734,7 @@ snd_pmac_tx_intr(int irq, void *devid, s
 
 
 static irqreturn_t
-snd_pmac_rx_intr(int irq, void *devid, struct pt_regs *regs)
+snd_pmac_rx_intr(int irq, void *devid)
 {
 	struct snd_pmac *chip = devid;
 	snd_pmac_pcm_update(chip, &chip->capture);
@@ -743,7 +743,7 @@ snd_pmac_rx_intr(int irq, void *devid, s
 
 
 static irqreturn_t
-snd_pmac_ctrl_intr(int irq, void *devid, struct pt_regs *regs)
+snd_pmac_ctrl_intr(int irq, void *devid)
 {
 	struct snd_pmac *chip = devid;
 	int ctrl = in_le32(&chip->awacs->control);