Skip to contentSkip to conversation

RFC: ALSA patches for 2.6.16

PATCH Adrian Bunk 2 participants 3 messages Jan 6, 2007 – Jan 8, 2007 Sound

lore
Share & tools
lore
#0 lore raw

The following patches that were added to the -stable 2.6.18 seem to make sense for 2.6.16:

2.6.18.1:
ALSA: Fix initiailization of user-space controls

2.6.18.2:
ALSA: emu10k1: Fix outl() in snd_emu10k1_resume_regs()
ALSA: snd_rtctimer: handle RTC interrupts with a tasklet

For an easier review, I've attached the patches.

Do these patches look OK for 2.6.16, or should I not apply some or all?

Are there any critical patches I missed?

TIA
Adrian

Signature · 4 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed
Quoted 1 line

From [email protected] Mon Sep 25 03:51:05 2006

Date: Mon, 25 Sep 2006 11:49:01 +0200
Message-ID: <s5h7izs8eeq.wl%[email protected]>
From: Takashi Iwai <[email protected]>
To: [email protected]
Subject: ALSA: Fix initiailization of user-space controls

From: Takashi Iwai <[email protected]>

ALSA: Fix initiailization of user-space controls

Fix an assertion when accessing a user-defined control due to lack of initialization (appears only when CONFIG_SND_DEBUg is enabled).

ALSA sound/core/control.c:660: BUG? (info->access == 0)

---
 sound/core/control.c |    1 +
 1 file changed, 1 insertion(+)
sound/core/control.c +1 -0
@@ -997,6 +997,7 @@ static int snd_ctl_elem_add(struct snd_c
 	if (ue == NULL)
 		return -ENOMEM;
 	ue->info = *info;
+	ue->info.access = 0;
 	ue->elem_data = (char *)ue + sizeof(*ue);
 	ue->elem_data_size = private_size;
 	kctl.private_free = snd_ctl_elem_user_free;
Quoted 1 line

From [email protected] Mon Oct 16 05:37:02 2006

Date: Mon, 16 Oct 2006 14:35:57 +0200
Message-ID: <s5hr6x8a15e.wl%[email protected]>
From: Arnaud Patard <[email protected]>
To: [email protected]
MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka")
Subject: ALSA: emu10k1: Fix outl() in snd_emu10k1_resume_regs()
Content-Type: text/plain; charset="us-ascii"

From: Arnaud Patard <[email protected]>

[PATCH] ALSA: emu10k1: Fix outl() in snd_emu10k1_resume_regs()

The emu10k1 driver saves the A_IOCFG and HCFG register on suspend and restores it on resumes. Unfortunately, this doesn't work as the arguments to outl() are reversed.

From: Arnaud Patard <[email protected]>

---
 sound/pci/emu10k1/emu10k1_main.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
sound/pci/emu10k1/emu10k1_main.c +2 -2
@@ -1460,8 +1460,8 @@ void snd_emu10k1_resume_regs(struct snd_
 
 	/* resore for spdif */
 	if (emu->audigy)
-		outl(emu->port + A_IOCFG, emu->saved_a_iocfg);
-	outl(emu->port + HCFG, emu->saved_hcfg);
+		outl(emu->saved_a_iocfg, emu->port + A_IOCFG);
+	outl(emu->saved_hcfg, emu->port + HCFG);
 
 	val = emu->saved_ptr;
 	for (reg = saved_regs; *reg != 0xff; reg++)
Quoted 1 line

From [email protected] Fri Oct 27 05:18:49 2006

Message-Id: <[email protected]>
From: "Clemens Ladisch" <[email protected]>
To: [email protected]
Content-Disposition: inline
MIME-Version: 1.0
Date: Fri, 27 Oct 2006 14:15:35 +0200
Subject: ALSA: snd_rtctimer: handle RTC interrupts with a tasklet
Content-Type: text/plain; charset="us-ascii"

The calls to rtc_control() from inside the interrupt handler can deadlock the RTC code, so move our interrupt handling code to a tasklet.

---
 sound/core/rtctimer.c |   17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
sound/core/rtctimer.c +14 -3
@@ -50,7 +50,9 @@ static int rtctimer_stop(struct snd_time
  * The hardware dependent description for this timer.
  */
 static struct snd_timer_hardware rtc_hw = {
-	.flags =	SNDRV_TIMER_HW_FIRST|SNDRV_TIMER_HW_AUTO,
+	.flags =	SNDRV_TIMER_HW_AUTO |
+			SNDRV_TIMER_HW_FIRST |
+			SNDRV_TIMER_HW_TASKLET,
 	.ticks =	100000000L,		/* FIXME: XXX */
 	.open =		rtctimer_open,
 	.close =	rtctimer_close,
@@ -60,6 +62,7 @@ static struct snd_timer_hardware rtc_hw 
 
 static int rtctimer_freq = RTC_FREQ;		/* frequency */
 static struct snd_timer *rtctimer;
+static struct tasklet_struct rtc_tasklet;
 static rtc_task_t rtc_task;
 
 
@@ -81,6 +84,7 @@ rtctimer_close(struct snd_timer *t)
 	rtc_task_t *rtc = t->private_data;
 	if (rtc) {
 		rtc_unregister(rtc);
+		tasklet_kill(&rtc_tasklet);
 		t->private_data = NULL;
 	}
 	return 0;
@@ -105,12 +109,17 @@ rtctimer_stop(struct snd_timer *timer)
 	return 0;
 }
 
+static void rtctimer_tasklet(unsigned long data)
+{
+	snd_timer_interrupt((struct snd_timer *)data, 1);
+}
+
 /*
  * interrupt
  */
 static void rtctimer_interrupt(void *private_data)
 {
-	snd_timer_interrupt(private_data, 1);
+	tasklet_hi_schedule(private_data);
 }
 
 
@@ -139,9 +148,11 @@ static int __init rtctimer_init(void)
 	timer->hw = rtc_hw;
 	timer->hw.resolution = NANO_SEC / rtctimer_freq;
 
+	tasklet_init(&rtc_tasklet, rtctimer_tasklet, (unsigned long)timer);
+
 	/* set up RTC callback */
 	rtc_task.func = rtctimer_interrupt;
-	rtc_task.private_data = timer;
+	rtc_task.private_data = &rtc_tasklet;
 
 	err = snd_timer_global_register(timer);
 	if (err < 0) {

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

_______________________________________________
Alsa-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/alsa-devel

#1 lore raw

At Sat, 6 Jan 2007 04:59:13 +0100,

Quoted 7 lines · Adrian Bunk

The following patches that were added to the -stable 2.6.18 seem to make sense for 2.6.16:

2.6.18.1:
ALSA: Fix initiailization of user-space controls

Quoted 7 lines

2.6.18.2:
ALSA: emu10k1: Fix outl() in snd_emu10k1_resume_regs()
ALSA: snd_rtctimer: handle RTC interrupts with a tasklet

For an easier review, I've attached the patches.

Do these patches look OK for 2.6.16, or should I not apply some or all?

Yes, all these patches are fine. Please apply.

Quoted 1 line

Are there any critical patches I missed?

There are some fixes in SUSE SP1 kernel. I'll check whether they are included in the latest 2.6.16.x tree.

thanks,

Takashi

Quoted 158 lines

TIA
Adrian

Signature · 6 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed

[2 2.6.18.1-alsa-fix-initiailization-of-user-space-controls.patch <text/x-diff; us-ascii (7bit)>]
Quoted 1 line

From [email protected] Mon Sep 25 03:51:05 2006

Date: Mon, 25 Sep 2006 11:49:01 +0200
Message-ID: <s5h7izs8eeq.wl%[email protected]>
From: Takashi Iwai <[email protected]>
To: [email protected]
Subject: ALSA: Fix initiailization of user-space controls

From: Takashi Iwai <[email protected]>

ALSA: Fix initiailization of user-space controls

Fix an assertion when accessing a user-defined control due to lack of initialization (appears only when CONFIG_SND_DEBUg is enabled).

ALSA sound/core/control.c:660: BUG? (info->access == 0)

---
 sound/core/control.c |    1 +
 1 file changed, 1 insertion(+)
sound/core/control.c +1 -0
@@ -997,6 +997,7 @@ static int snd_ctl_elem_add(struct snd_c
 	if (ue == NULL)
 		return -ENOMEM;
 	ue->info = *info;
+	ue->info.access = 0;
 	ue->elem_data = (char *)ue + sizeof(*ue);
 	ue->elem_data_size = private_size;
 	kctl.private_free = snd_ctl_elem_user_free;

[3 2.6.18.2-alsa-emu10k1-fix-outl-in-snd_emu10k1_resume_regs.patch <text/x-diff; us-ascii (7bit)>]

Quoted 1 line

From [email protected] Mon Oct 16 05:37:02 2006

Date: Mon, 16 Oct 2006 14:35:57 +0200
Message-ID: <s5hr6x8a15e.wl%[email protected]>
From: Arnaud Patard <[email protected]>
To: [email protected]
MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka")
Subject: ALSA: emu10k1: Fix outl() in snd_emu10k1_resume_regs()
Content-Type: text/plain; charset="us-ascii"

From: Arnaud Patard <[email protected]>

[PATCH] ALSA: emu10k1: Fix outl() in snd_emu10k1_resume_regs()

The emu10k1 driver saves the A_IOCFG and HCFG register on suspend and restores it on resumes. Unfortunately, this doesn't work as the arguments to outl() are reversed.

From: Arnaud Patard <[email protected]>

---
 sound/pci/emu10k1/emu10k1_main.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
sound/pci/emu10k1/emu10k1_main.c +2 -2
@@ -1460,8 +1460,8 @@ void snd_emu10k1_resume_regs(struct snd_
 
 	/* resore for spdif */
 	if (emu->audigy)
-		outl(emu->port + A_IOCFG, emu->saved_a_iocfg);
-	outl(emu->port + HCFG, emu->saved_hcfg);
+		outl(emu->saved_a_iocfg, emu->port + A_IOCFG);
+	outl(emu->saved_hcfg, emu->port + HCFG);
 
 	val = emu->saved_ptr;
 	for (reg = saved_regs; *reg != 0xff; reg++)

[4 2.6.18.2-alsa-snd_rtctimer-handle-rtc-interrupts-with-a-tasklet.patch <text/x-diff; us-ascii (7bit)>]

Quoted 1 line

From [email protected] Fri Oct 27 05:18:49 2006

Message-Id: <[email protected]>
From: "Clemens Ladisch" <[email protected]>
To: [email protected]
Content-Disposition: inline
MIME-Version: 1.0
Date: Fri, 27 Oct 2006 14:15:35 +0200
Subject: ALSA: snd_rtctimer: handle RTC interrupts with a tasklet
Content-Type: text/plain; charset="us-ascii"

The calls to rtc_control() from inside the interrupt handler can deadlock the RTC code, so move our interrupt handling code to a tasklet.

---
 sound/core/rtctimer.c |   17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
sound/core/rtctimer.c +11 -2
@@ -50,7 +50,9 @@ static int rtctimer_stop(struct snd_time
  * The hardware dependent description for this timer.
  */
 static struct snd_timer_hardware rtc_hw = {
-	.flags =	SNDRV_TIMER_HW_FIRST|SNDRV_TIMER_HW_AUTO,
+	.flags =	SNDRV_TIMER_HW_AUTO |
+			SNDRV_TIMER_HW_FIRST |
+			SNDRV_TIMER_HW_TASKLET,
 	.ticks =	100000000L,		/* FIXME: XXX */
 	.open =		rtctimer_open,
 	.close =	rtctimer_close,
@@ -60,6 +62,7 @@ static struct snd_timer_hardware rtc_hw 
 
 static int rtctimer_freq = RTC_FREQ;		/* frequency */
 static struct snd_timer *rtctimer;
+static struct tasklet_struct rtc_tasklet;
 static rtc_task_t rtc_task;
 
 
@@ -81,6 +84,7 @@ rtctimer_close(struct snd_timer *t)
 	rtc_task_t *rtc = t->private_data;
 	if (rtc) {
 		rtc_unregister(rtc);
+		tasklet_kill(&rtc_tasklet);
 		t->private_data = NULL;
 	}
 	return 0;
@@ -105,12 +109,17 @@ rtctimer_stop(struct snd_timer *timer)
 	return 0;
 }
 
+static void rtctimer_tasklet(unsigned long data)
+{
+	snd_timer_interrupt((struct snd_timer *)data, 1);
+}
+
 /*
  * interrupt
  */
 static void rtctimer_interrupt(void *private_data)
 {
-	snd_timer_interrupt(private_data, 1);
+	tasklet_hi_schedule(private_data);
 }
 
 
@@ -139,9 +148,11 @@ static int __init rtctimer_init(void)
 	timer->hw = rtc_hw;
 	timer->hw.resolution = NANO_SEC / rtctimer_freq;

sound/core/rtctimer.c static int __init rtctimer_init(void) · line 158

Quoted 10 lines
sound/core/rtctimer.c +3 -1
 
+	tasklet_init(&rtc_tasklet, rtctimer_tasklet, (unsigned long)timer);
+
 	/* set up RTC callback */
 	rtc_task.func = rtctimer_interrupt;
-	rtc_task.private_data = timer;
+	rtc_task.private_data = &rtc_tasklet;
 
 	err = snd_timer_global_register(timer);
 	if (err < 0) {

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV

#2 lore raw
Quoted 13 lines · Takashi Iwai

At Sat, 6 Jan 2007 04:59:13 +0100,

Quoted 11 lines · Adrian Bunk

The following patches that were added to the -stable 2.6.18 seem to make sense for 2.6.16:

2.6.18.1:
ALSA: Fix initiailization of user-space controls

2.6.18.2:
ALSA: emu10k1: Fix outl() in snd_emu10k1_resume_regs()
ALSA: snd_rtctimer: handle RTC interrupts with a tasklet

Quoted 5 lines
Quoted 3 lines

For an easier review, I've attached the patches.

Do these patches look OK for 2.6.16, or should I not apply some or all?

Yes, all these patches are fine. Please apply.

Thanks, I've applied them.

Quoted 4 lines
Quoted 1 line

Are there any critical patches I missed?

There are some fixes in SUSE SP1 kernel. I'll check whether they are included in the latest 2.6.16.x tree.

Thanks a lot!

Quoted 3 lines

thanks,

Takashi

cu
Adrian

Signature · 11 lines
       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV