[PATCH] [UBUNTU:sound/pci/] Fix additional races in the irq handler and ioremap()

crimsun at fungus.sh.nu crimsun at fungus.sh.nu
Tue Jun 6 20:58:35 UTC 2006


Subject: [PATCH] [UBUNTU:sound/pci/] Fix additional races in the irq handler and ioremap()

UpstreamStatus: Added in upstream alsa-kernel hg changeset c11fa10a4838
                http://hg-mirror.alsa-project.org/alsa-kernel?cmd=changeset;node=c11fa10a48388c8a3f693ebeea8b895fbad73336;style=raw

This commit by Takashi Iwai contains additional fixes for races in the
irq handler with respect to ioremap().

Signed-off-by: Daniel T Chen <crimsun at ubuntu.com>

---

 sound/pci/cs4281.c |   14 +++++++-------
 sound/pci/rme32.c  |   12 ++++++------
 sound/pci/rme96.c  |   10 +++++-----
 3 files changed, 18 insertions(+), 18 deletions(-)

342b14ed4999037f03959dfb45af1a8e8e923a61
diff --git a/sound/pci/cs4281.c b/sound/pci/cs4281.c
index 034ff37..268747f 100644
--- a/sound/pci/cs4281.c
+++ b/sound/pci/cs4281.c
@@ -1405,20 +1405,20 @@ static int __devinit snd_cs4281_create(s
 	chip->ba0_addr = pci_resource_start(pci, 0);
 	chip->ba1_addr = pci_resource_start(pci, 1);
 
-	if (request_irq(pci->irq, snd_cs4281_interrupt, SA_INTERRUPT|SA_SHIRQ, "CS4281", (void *)chip)) {
-		snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
+	chip->ba0 = ioremap_nocache(chip->ba0_addr, pci_resource_len(pci, 0));
+	chip->ba1 = ioremap_nocache(chip->ba1_addr, pci_resource_len(pci, 1));
+	if (!chip->ba0 || !chip->ba1) {
 		snd_cs4281_free(chip);
 		return -ENOMEM;
 	}
-	chip->irq = pci->irq;
 
-	chip->ba0 = ioremap_nocache(chip->ba0_addr, pci_resource_len(pci, 0));
-	chip->ba1 = ioremap_nocache(chip->ba1_addr, pci_resource_len(pci, 1));
-	if (!chip->ba0 || !chip->ba1) {
+	if (request_irq(pci->irq, snd_cs4281_interrupt, SA_INTERRUPT|SA_SHIRQ, "CS4281", (void *)chip)) {
+		snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
 		snd_cs4281_free(chip);
 		return -ENOMEM;
 	}
-	
+	chip->irq = pci->irq;
+
 	tmp = snd_cs4281_chip_init(chip);
 	if (tmp) {
 		snd_cs4281_free(chip);
diff --git a/sound/pci/rme32.c b/sound/pci/rme32.c
index 783df76..7cfb2f3 100644
--- a/sound/pci/rme32.c
+++ b/sound/pci/rme32.c
@@ -1368,18 +1368,18 @@ static int __devinit snd_rme32_create(rm
 		return err;
 	rme32->port = pci_resource_start(rme32->pci, 0);
 
-	if (request_irq(pci->irq, snd_rme32_interrupt, SA_INTERRUPT | SA_SHIRQ, "RME32", (void *) rme32)) {
-		snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
-		return -EBUSY;
-	}
-	rme32->irq = pci->irq;
-
 	if ((rme32->iobase = ioremap_nocache(rme32->port, RME32_IO_SIZE)) == 0) {
 		snd_printk(KERN_ERR "unable to remap memory region 0x%lx-0x%lx\n",
 			   rme32->port, rme32->port + RME32_IO_SIZE - 1);
 		return -ENOMEM;
 	}
 
+	if (request_irq(pci->irq, snd_rme32_interrupt, SA_INTERRUPT | SA_SHIRQ, "RME32", (void *) rme32)) {
+		snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
+		return -EBUSY;
+	}
+	rme32->irq = pci->irq;
+
 	/* read the card's revision number */
 	pci_read_config_byte(pci, 8, &rme32->rev);
 
diff --git a/sound/pci/rme96.c b/sound/pci/rme96.c
index 6d422ef..b92a0a8 100644
--- a/sound/pci/rme96.c
+++ b/sound/pci/rme96.c
@@ -1569,17 +1569,17 @@ snd_rme96_create(rme96_t *rme96)
 		return err;
 	rme96->port = pci_resource_start(rme96->pci, 0);
 
+	if ((rme96->iobase = ioremap_nocache(rme96->port, RME96_IO_SIZE)) == 0) {
+		snd_printk(KERN_ERR "unable to remap memory region 0x%lx-0x%lx\n", rme96->port, rme96->port + RME96_IO_SIZE - 1);
+		return -ENOMEM;
+	}
+
 	if (request_irq(pci->irq, snd_rme96_interrupt, SA_INTERRUPT|SA_SHIRQ, "RME96", (void *)rme96)) {
 		snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
 		return -EBUSY;
 	}
 	rme96->irq = pci->irq;
 
-	if ((rme96->iobase = ioremap_nocache(rme96->port, RME96_IO_SIZE)) == 0) {
-		snd_printk(KERN_ERR "unable to remap memory region 0x%lx-0x%lx\n", rme96->port, rme96->port + RME96_IO_SIZE - 1);
-		return -ENOMEM;
-	}
-
 	/* read the card's revision number */
 	pci_read_config_byte(pci, 8, &rme96->rev);	
 	
-- 
1.1.3


-- 
Daniel T. Chen            crimsun at ubuntu.com
GPG key:   www.sh.nu/~crimsun/pubkey.gpg.asc
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <https://lists.ubuntu.com/archives/kernel-team/attachments/20060606/d6b4b54c/attachment.sig>


More information about the kernel-team mailing list