Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Rolf Eike Beer <eike-kernel@sf-tec.de>
To: perex@perex.cz
Cc: alsa-devel@alsa-project.org
Subject: [PATCH] port pcxhr driver do devres
Date: Sun, 21 Sep 2008 17:31:39 +0200	[thread overview]
Message-ID: <200809211731.58934.eike-kernel@sf-tec.de> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 2661 bytes --]

Signed-off-by: Rolf Eike Beer <eike-kernel@sf-tec.de>

---
I was a bit bored and ported the pcxhr driver to use devres to manage it's
IRQ and PCI resources. This is completely untested as I don't have such a
card but you might find it useful nevertheless.

commit e7df0303a1517bdd0d2f0af5fbdf91acc0b7f426
tree 45fbf9c75c8ea51ae89f0409ed02138380b71624
parent 9824b8f11373b0df806c135a342da9319ef1d893
author Rolf Eike Beer <eike-kernel@sf-tec.de> Sun, 21 Sep 2008 17:26:28 +0200
committer Rolf Eike Beer <eike-kernel@sf-tec.de> Sun, 21 Sep 2008 17:26:28 +0200

 sound/pci/pcxhr/pcxhr.c |   14 ++------------
 1 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/sound/pci/pcxhr/pcxhr.c b/sound/pci/pcxhr/pcxhr.c
index 2c7e253..676389e 100644
--- a/sound/pci/pcxhr/pcxhr.c
+++ b/sound/pci/pcxhr/pcxhr.c
@@ -1171,12 +1171,6 @@ static int pcxhr_free(struct pcxhr_mgr *mgr)
 		snd_printdd("reset pcxhr !\n");
 	}
 
-	/* release irq  */
-	if (mgr->irq >= 0)
-		free_irq(mgr->irq, mgr);
-
-	pci_release_regions(mgr->pci);
-
 	/* free hostport purgebuffer */
 	if (mgr->hostport.area) {
 		snd_dma_free_pages(&mgr->hostport);
@@ -1185,7 +1179,6 @@ static int pcxhr_free(struct pcxhr_mgr *mgr)
 
 	kfree(mgr->prmh);
 
-	pci_disable_device(mgr->pci);
 	kfree(mgr);
 	return 0;
 }
@@ -1210,21 +1203,19 @@ static int __devinit pcxhr_probe(struct pci_dev *pci, const struct pci_device_id
 	}
 
 	/* enable PCI device */
-	if ((err = pci_enable_device(pci)) < 0)
+	if ((err = pcim_enable_device(pci)) < 0)
 		return err;
 	pci_set_master(pci);
 
 	/* check if we can restrict PCI DMA transfers to 32 bits */
 	if (pci_set_dma_mask(pci, DMA_32BIT_MASK) < 0) {
 		snd_printk(KERN_ERR "architecture does not support 32bit PCI busmaster DMA\n");
-		pci_disable_device(pci);
 		return -ENXIO;
 	}
 
 	/* alloc card manager */
 	mgr = kzalloc(sizeof(*mgr), GFP_KERNEL);
 	if (! mgr) {
-		pci_disable_device(pci);
 		return -ENOMEM;
 	}
 
@@ -1238,7 +1229,6 @@ static int __devinit pcxhr_probe(struct pci_dev *pci, const struct pci_device_id
 	/* resource assignment */
 	if ((err = pci_request_regions(pci, card_name)) < 0) {
 		kfree(mgr);
-		pci_disable_device(pci);
 		return err;
 	}
 	for (i = 0; i < 3; i++)
@@ -1247,7 +1237,7 @@ static int __devinit pcxhr_probe(struct pci_dev *pci, const struct pci_device_id
 	mgr->pci = pci;
 	mgr->irq = -1;
 
-	if (request_irq(pci->irq, pcxhr_interrupt, IRQF_SHARED,
+	if (devm_request_irq(&pci->dev, pci->irq, pcxhr_interrupt, IRQF_SHARED,
 			card_name, mgr)) {
 		snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
 		pcxhr_free(mgr);

[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

[-- Attachment #2: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

             reply	other threads:[~2008-09-22  7:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-09-21 15:31 Rolf Eike Beer [this message]
2008-09-23 11:35 ` [PATCH] port pcxhr driver do devres Takashi Iwai
2008-10-15 21:33   ` Rolf Eike Beer

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=200809211731.58934.eike-kernel@sf-tec.de \
    --to=eike-kernel@sf-tec.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=perex@perex.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