summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Slaby <xslaby@fi.muni.cz>2005-09-07 14:28:33 +0200
committerJaroslav Kysela <perex@suse.cz>2005-09-12 10:47:08 +0200
commit0dd119f703d50759f0835f342e385f82cbf8b89e (patch)
treed2b5805f5ae93b44cab1603b9e80fbf163048d8f
parent8cdfd2519c6c9a1e6057dc5970b2542b35895738 (diff)
downloadop-kernel-dev-0dd119f703d50759f0835f342e385f82cbf8b89e.zip
op-kernel-dev-0dd119f703d50759f0835f342e385f82cbf8b89e.tar.gz
[ALSA] pci_find_device remove
Memalloc module,CS46xx driver,VIA82xx driver,ALI5451 driver au88x0 driver Replace pci_find_device() with pci_get_device() and pci_dev_put(). Signed-off-by: Jiri Slaby <xslaby@fi.muni.cz> Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--include/sound/cs46xx.h1
-rw-r--r--sound/core/memalloc.c3
-rw-r--r--sound/pci/ali5451/ali5451.c16
-rw-r--r--sound/pci/au88x0/au88x0.c26
-rw-r--r--sound/pci/cs46xx/cs46xx_lib.c13
-rw-r--r--sound/pci/via82xx.c3
6 files changed, 38 insertions, 24 deletions
diff --git a/include/sound/cs46xx.h b/include/sound/cs46xx.h
index 5821db8..b0c0e19 100644
--- a/include/sound/cs46xx.h
+++ b/include/sound/cs46xx.h
@@ -1702,7 +1702,6 @@ struct _snd_cs46xx {
void (*active_ctrl)(cs46xx_t *, int);
void (*mixer_init)(cs46xx_t *);
- struct pci_dev *acpi_dev;
int acpi_port;
snd_kcontrol_t *eapd_switch; /* for amplifier hack */
int accept_valid; /* accept mmap valid (for OSS) */
diff --git a/sound/core/memalloc.c b/sound/core/memalloc.c
index 39a54a4..91124dd 100644
--- a/sound/core/memalloc.c
+++ b/sound/core/memalloc.c
@@ -590,7 +590,7 @@ static int snd_mem_proc_write(struct file *file, const char __user *buffer,
alloced = 0;
pci = NULL;
- while ((pci = pci_find_device(vendor, device, pci)) != NULL) {
+ while ((pci = pci_get_device(vendor, device, pci)) != NULL) {
if (mask > 0 && mask < 0xffffffff) {
if (pci_set_dma_mask(pci, mask) < 0 ||
pci_set_consistent_dma_mask(pci, mask) < 0) {
@@ -604,6 +604,7 @@ static int snd_mem_proc_write(struct file *file, const char __user *buffer,
if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci),
size, &dmab) < 0) {
printk(KERN_ERR "snd-page-alloc: cannot allocate buffer pages (size = %d)\n", size);
+ pci_dev_put(pci);
return (int)count;
}
snd_dma_reserve_buf(&dmab, snd_dma_pci_buf_id(pci));
diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c
index 7f835d4..703770f 100644
--- a/sound/pci/ali5451/ali5451.c
+++ b/sound/pci/ali5451/ali5451.c
@@ -318,13 +318,12 @@ static void ali_read_regs(ali_t *codec, int channel)
static void ali_read_cfg(unsigned int vendor, unsigned deviceid)
{
unsigned int dwVal;
- struct pci_dev *pci_dev = NULL;
+ struct pci_dev *pci_dev;
int i,j;
-
- pci_dev = pci_find_device(vendor, deviceid, pci_dev);
- if (pci_dev == NULL)
- return ;
+ pci_dev = pci_get_device(vendor, deviceid, NULL);
+ if (pci_dev == NULL)
+ return ;
printk("\nM%x PCI CFG\n", deviceid);
printk(" ");
@@ -341,6 +340,7 @@ static void ali_read_cfg(unsigned int vendor, unsigned deviceid)
}
printk("\n");
}
+ pci_dev_put(pci_dev);
}
static void ali_read_ac97regs(ali_t *codec, int secondary)
{
@@ -2108,6 +2108,8 @@ static int snd_ali_free(ali_t * codec)
#ifdef CONFIG_PM
kfree(codec->image);
#endif
+ pci_dev_put(codec->pci_m1533);
+ pci_dev_put(codec->pci_m7101);
kfree(codec);
return 0;
}
@@ -2297,7 +2299,7 @@ static int __devinit snd_ali_create(snd_card_t * card,
codec->chregs.data.ainten = 0x00;
/* M1533: southbridge */
- pci_dev = pci_find_device(0x10b9, 0x1533, NULL);
+ pci_dev = pci_get_device(0x10b9, 0x1533, NULL);
codec->pci_m1533 = pci_dev;
if (! codec->pci_m1533) {
snd_printk(KERN_ERR "ali5451: cannot find ALi 1533 chip.\n");
@@ -2305,7 +2307,7 @@ static int __devinit snd_ali_create(snd_card_t * card,
return -ENODEV;
}
/* M7101: power management */
- pci_dev = pci_find_device(0x10b9, 0x7101, NULL);
+ pci_dev = pci_get_device(0x10b9, 0x7101, NULL);
codec->pci_m7101 = pci_dev;
if (! codec->pci_m7101 && codec->revision == ALI_5451_V02) {
snd_printk(KERN_ERR "ali5451: cannot find ALi 7101 chip.\n");
diff --git a/sound/pci/au88x0/au88x0.c b/sound/pci/au88x0/au88x0.c
index f6236c6..0e33e06 100644
--- a/sound/pci/au88x0/au88x0.c
+++ b/sound/pci/au88x0/au88x0.c
@@ -79,19 +79,21 @@ static void vortex_fix_agp_bridge(struct pci_dev *via)
static void __devinit snd_vortex_workaround(struct pci_dev *vortex, int fix)
{
- struct pci_dev *via;
+ struct pci_dev *via = NULL;
/* autodetect if workarounds are required */
if (fix == 255) {
/* VIA KT133 */
- via = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8365_1, NULL);
+ via = pci_get_device(PCI_VENDOR_ID_VIA,
+ PCI_DEVICE_ID_VIA_8365_1, NULL);
/* VIA Apollo */
if (via == NULL) {
- via = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C598_1, NULL);
- }
- /* AMD Irongate */
- if (via == NULL) {
- via = pci_find_device(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_FE_GATE_7007, NULL);
+ via = pci_get_device(PCI_VENDOR_ID_VIA,
+ PCI_DEVICE_ID_VIA_82C598_1, NULL);
+ /* AMD Irongate */
+ if (via == NULL)
+ via = pci_get_device(PCI_VENDOR_ID_AMD,
+ PCI_DEVICE_ID_AMD_FE_GATE_7007, NULL);
}
if (via) {
printk(KERN_INFO CARD_NAME ": Activating latency workaround...\n");
@@ -101,13 +103,17 @@ static void __devinit snd_vortex_workaround(struct pci_dev *vortex, int fix)
} else {
if (fix & 0x1)
vortex_fix_latency(vortex);
- if ((fix & 0x2) && (via = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8365_1, NULL)))
+ if ((fix & 0x2) && (via = pci_get_device(PCI_VENDOR_ID_VIA,
+ PCI_DEVICE_ID_VIA_8365_1, NULL)))
vortex_fix_agp_bridge(via);
- if ((fix & 0x4) && (via = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C598_1, NULL)))
+ if ((fix & 0x4) && (via = pci_get_device(PCI_VENDOR_ID_VIA,
+ PCI_DEVICE_ID_VIA_82C598_1, NULL)))
vortex_fix_agp_bridge(via);
- if ((fix & 0x8) && (via = pci_find_device(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_FE_GATE_7007, NULL)))
+ if ((fix & 0x8) && (via = pci_get_device(PCI_VENDOR_ID_AMD,
+ PCI_DEVICE_ID_AMD_FE_GATE_7007, NULL)))
vortex_fix_agp_bridge(via);
}
+ pci_dev_put(via);
}
// component-destructor
diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c
index fd9c82c..03329a7 100644
--- a/sound/pci/cs46xx/cs46xx_lib.c
+++ b/sound/pci/cs46xx/cs46xx_lib.c
@@ -3537,7 +3537,7 @@ static void clkrun_hack(cs46xx_t *chip, int change)
{
u16 control, nval;
- if (chip->acpi_dev == NULL)
+ if (!chip->acpi_port)
return;
chip->amplifier += change;
@@ -3560,15 +3560,20 @@ static void clkrun_hack(cs46xx_t *chip, int change)
*/
static void clkrun_init(cs46xx_t *chip)
{
+ struct pci_dev *pdev;
u8 pp;
- chip->acpi_dev = pci_find_device(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_3, NULL);
- if (chip->acpi_dev == NULL)
+ chip->acpi_port = 0;
+
+ pdev = pci_get_device(PCI_VENDOR_ID_INTEL,
+ PCI_DEVICE_ID_INTEL_82371AB_3, NULL);
+ if (pdev == NULL)
return; /* Not a thinkpad thats for sure */
/* Find the control port */
- pci_read_config_byte(chip->acpi_dev, 0x41, &pp);
+ pci_read_config_byte(pdev, 0x41, &pp);
chip->acpi_port = pp << 8;
+ pci_dev_put(pdev);
}
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c
index c7bddfb..cfd2c9c 100644
--- a/sound/pci/via82xx.c
+++ b/sound/pci/via82xx.c
@@ -1927,11 +1927,12 @@ static int snd_via82xx_chip_init(via82xx_t *chip)
* DXS channels don't work properly with VRA if MC97 is disabled.
*/
struct pci_dev *pci;
- pci = pci_find_device(0x1106, 0x3068, NULL); /* MC97 */
+ pci = pci_get_device(0x1106, 0x3068, NULL); /* MC97 */
if (pci) {
unsigned char data;
pci_read_config_byte(pci, 0x44, &data);
pci_write_config_byte(pci, 0x44, data | 0x40);
+ pci_dev_put(pci);
}
}
OpenPOWER on IntegriCloud