diff options
author | Jiri Slaby <xslaby@fi.muni.cz> | 2005-09-07 08:28:33 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2005-09-12 04:47:08 -0400 |
commit | 0dd119f703d50759f0835f342e385f82cbf8b89e (patch) | |
tree | d2b5805f5ae93b44cab1603b9e80fbf163048d8f /sound | |
parent | 8cdfd2519c6c9a1e6057dc5970b2542b35895738 (diff) |
[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>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/core/memalloc.c | 3 | ||||
-rw-r--r-- | sound/pci/ali5451/ali5451.c | 16 | ||||
-rw-r--r-- | sound/pci/au88x0/au88x0.c | 26 | ||||
-rw-r--r-- | sound/pci/cs46xx/cs46xx_lib.c | 13 | ||||
-rw-r--r-- | sound/pci/via82xx.c | 3 |
5 files changed, 38 insertions, 23 deletions
diff --git a/sound/core/memalloc.c b/sound/core/memalloc.c index 39a54a415528..91124ddbdda9 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, | |||
590 | 590 | ||
591 | alloced = 0; | 591 | alloced = 0; |
592 | pci = NULL; | 592 | pci = NULL; |
593 | while ((pci = pci_find_device(vendor, device, pci)) != NULL) { | 593 | while ((pci = pci_get_device(vendor, device, pci)) != NULL) { |
594 | if (mask > 0 && mask < 0xffffffff) { | 594 | if (mask > 0 && mask < 0xffffffff) { |
595 | if (pci_set_dma_mask(pci, mask) < 0 || | 595 | if (pci_set_dma_mask(pci, mask) < 0 || |
596 | pci_set_consistent_dma_mask(pci, mask) < 0) { | 596 | 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, | |||
604 | if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci), | 604 | if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci), |
605 | size, &dmab) < 0) { | 605 | size, &dmab) < 0) { |
606 | printk(KERN_ERR "snd-page-alloc: cannot allocate buffer pages (size = %d)\n", size); | 606 | printk(KERN_ERR "snd-page-alloc: cannot allocate buffer pages (size = %d)\n", size); |
607 | pci_dev_put(pci); | ||
607 | return (int)count; | 608 | return (int)count; |
608 | } | 609 | } |
609 | snd_dma_reserve_buf(&dmab, snd_dma_pci_buf_id(pci)); | 610 | 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 7f835d46dc1c..703770f6a507 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) | |||
318 | static void ali_read_cfg(unsigned int vendor, unsigned deviceid) | 318 | static void ali_read_cfg(unsigned int vendor, unsigned deviceid) |
319 | { | 319 | { |
320 | unsigned int dwVal; | 320 | unsigned int dwVal; |
321 | struct pci_dev *pci_dev = NULL; | 321 | struct pci_dev *pci_dev; |
322 | int i,j; | 322 | int i,j; |
323 | 323 | ||
324 | 324 | pci_dev = pci_get_device(vendor, deviceid, NULL); | |
325 | pci_dev = pci_find_device(vendor, deviceid, pci_dev); | 325 | if (pci_dev == NULL) |
326 | if (pci_dev == NULL) | 326 | return ; |
327 | return ; | ||
328 | 327 | ||
329 | printk("\nM%x PCI CFG\n", deviceid); | 328 | printk("\nM%x PCI CFG\n", deviceid); |
330 | printk(" "); | 329 | printk(" "); |
@@ -341,6 +340,7 @@ static void ali_read_cfg(unsigned int vendor, unsigned deviceid) | |||
341 | } | 340 | } |
342 | printk("\n"); | 341 | printk("\n"); |
343 | } | 342 | } |
343 | pci_dev_put(pci_dev); | ||
344 | } | 344 | } |
345 | static void ali_read_ac97regs(ali_t *codec, int secondary) | 345 | static void ali_read_ac97regs(ali_t *codec, int secondary) |
346 | { | 346 | { |
@@ -2108,6 +2108,8 @@ static int snd_ali_free(ali_t * codec) | |||
2108 | #ifdef CONFIG_PM | 2108 | #ifdef CONFIG_PM |
2109 | kfree(codec->image); | 2109 | kfree(codec->image); |
2110 | #endif | 2110 | #endif |
2111 | pci_dev_put(codec->pci_m1533); | ||
2112 | pci_dev_put(codec->pci_m7101); | ||
2111 | kfree(codec); | 2113 | kfree(codec); |
2112 | return 0; | 2114 | return 0; |
2113 | } | 2115 | } |
@@ -2297,7 +2299,7 @@ static int __devinit snd_ali_create(snd_card_t * card, | |||
2297 | codec->chregs.data.ainten = 0x00; | 2299 | codec->chregs.data.ainten = 0x00; |
2298 | 2300 | ||
2299 | /* M1533: southbridge */ | 2301 | /* M1533: southbridge */ |
2300 | pci_dev = pci_find_device(0x10b9, 0x1533, NULL); | 2302 | pci_dev = pci_get_device(0x10b9, 0x1533, NULL); |
2301 | codec->pci_m1533 = pci_dev; | 2303 | codec->pci_m1533 = pci_dev; |
2302 | if (! codec->pci_m1533) { | 2304 | if (! codec->pci_m1533) { |
2303 | snd_printk(KERN_ERR "ali5451: cannot find ALi 1533 chip.\n"); | 2305 | 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, | |||
2305 | return -ENODEV; | 2307 | return -ENODEV; |
2306 | } | 2308 | } |
2307 | /* M7101: power management */ | 2309 | /* M7101: power management */ |
2308 | pci_dev = pci_find_device(0x10b9, 0x7101, NULL); | 2310 | pci_dev = pci_get_device(0x10b9, 0x7101, NULL); |
2309 | codec->pci_m7101 = pci_dev; | 2311 | codec->pci_m7101 = pci_dev; |
2310 | if (! codec->pci_m7101 && codec->revision == ALI_5451_V02) { | 2312 | if (! codec->pci_m7101 && codec->revision == ALI_5451_V02) { |
2311 | snd_printk(KERN_ERR "ali5451: cannot find ALi 7101 chip.\n"); | 2313 | 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 f6236c63aaaa..0e33e0650cf5 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) | |||
79 | 79 | ||
80 | static void __devinit snd_vortex_workaround(struct pci_dev *vortex, int fix) | 80 | static void __devinit snd_vortex_workaround(struct pci_dev *vortex, int fix) |
81 | { | 81 | { |
82 | struct pci_dev *via; | 82 | struct pci_dev *via = NULL; |
83 | 83 | ||
84 | /* autodetect if workarounds are required */ | 84 | /* autodetect if workarounds are required */ |
85 | if (fix == 255) { | 85 | if (fix == 255) { |
86 | /* VIA KT133 */ | 86 | /* VIA KT133 */ |
87 | via = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8365_1, NULL); | 87 | via = pci_get_device(PCI_VENDOR_ID_VIA, |
88 | PCI_DEVICE_ID_VIA_8365_1, NULL); | ||
88 | /* VIA Apollo */ | 89 | /* VIA Apollo */ |
89 | if (via == NULL) { | 90 | if (via == NULL) { |
90 | via = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C598_1, NULL); | 91 | via = pci_get_device(PCI_VENDOR_ID_VIA, |
91 | } | 92 | PCI_DEVICE_ID_VIA_82C598_1, NULL); |
92 | /* AMD Irongate */ | 93 | /* AMD Irongate */ |
93 | if (via == NULL) { | 94 | if (via == NULL) |
94 | via = pci_find_device(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_FE_GATE_7007, NULL); | 95 | via = pci_get_device(PCI_VENDOR_ID_AMD, |
96 | PCI_DEVICE_ID_AMD_FE_GATE_7007, NULL); | ||
95 | } | 97 | } |
96 | if (via) { | 98 | if (via) { |
97 | printk(KERN_INFO CARD_NAME ": Activating latency workaround...\n"); | 99 | 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) | |||
101 | } else { | 103 | } else { |
102 | if (fix & 0x1) | 104 | if (fix & 0x1) |
103 | vortex_fix_latency(vortex); | 105 | vortex_fix_latency(vortex); |
104 | if ((fix & 0x2) && (via = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8365_1, NULL))) | 106 | if ((fix & 0x2) && (via = pci_get_device(PCI_VENDOR_ID_VIA, |
107 | PCI_DEVICE_ID_VIA_8365_1, NULL))) | ||
105 | vortex_fix_agp_bridge(via); | 108 | vortex_fix_agp_bridge(via); |
106 | if ((fix & 0x4) && (via = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C598_1, NULL))) | 109 | if ((fix & 0x4) && (via = pci_get_device(PCI_VENDOR_ID_VIA, |
110 | PCI_DEVICE_ID_VIA_82C598_1, NULL))) | ||
107 | vortex_fix_agp_bridge(via); | 111 | vortex_fix_agp_bridge(via); |
108 | if ((fix & 0x8) && (via = pci_find_device(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_FE_GATE_7007, NULL))) | 112 | if ((fix & 0x8) && (via = pci_get_device(PCI_VENDOR_ID_AMD, |
113 | PCI_DEVICE_ID_AMD_FE_GATE_7007, NULL))) | ||
109 | vortex_fix_agp_bridge(via); | 114 | vortex_fix_agp_bridge(via); |
110 | } | 115 | } |
116 | pci_dev_put(via); | ||
111 | } | 117 | } |
112 | 118 | ||
113 | // component-destructor | 119 | // component-destructor |
diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c index fd9c82c07b3e..03329a7efb91 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) | |||
3537 | { | 3537 | { |
3538 | u16 control, nval; | 3538 | u16 control, nval; |
3539 | 3539 | ||
3540 | if (chip->acpi_dev == NULL) | 3540 | if (!chip->acpi_port) |
3541 | return; | 3541 | return; |
3542 | 3542 | ||
3543 | chip->amplifier += change; | 3543 | chip->amplifier += change; |
@@ -3560,15 +3560,20 @@ static void clkrun_hack(cs46xx_t *chip, int change) | |||
3560 | */ | 3560 | */ |
3561 | static void clkrun_init(cs46xx_t *chip) | 3561 | static void clkrun_init(cs46xx_t *chip) |
3562 | { | 3562 | { |
3563 | struct pci_dev *pdev; | ||
3563 | u8 pp; | 3564 | u8 pp; |
3564 | 3565 | ||
3565 | chip->acpi_dev = pci_find_device(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_3, NULL); | 3566 | chip->acpi_port = 0; |
3566 | if (chip->acpi_dev == NULL) | 3567 | |
3568 | pdev = pci_get_device(PCI_VENDOR_ID_INTEL, | ||
3569 | PCI_DEVICE_ID_INTEL_82371AB_3, NULL); | ||
3570 | if (pdev == NULL) | ||
3567 | return; /* Not a thinkpad thats for sure */ | 3571 | return; /* Not a thinkpad thats for sure */ |
3568 | 3572 | ||
3569 | /* Find the control port */ | 3573 | /* Find the control port */ |
3570 | pci_read_config_byte(chip->acpi_dev, 0x41, &pp); | 3574 | pci_read_config_byte(pdev, 0x41, &pp); |
3571 | chip->acpi_port = pp << 8; | 3575 | chip->acpi_port = pp << 8; |
3576 | pci_dev_put(pdev); | ||
3572 | } | 3577 | } |
3573 | 3578 | ||
3574 | 3579 | ||
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c index c7bddfb9fb6d..cfd2c9cc9b37 100644 --- a/sound/pci/via82xx.c +++ b/sound/pci/via82xx.c | |||
@@ -1927,11 +1927,12 @@ static int snd_via82xx_chip_init(via82xx_t *chip) | |||
1927 | * DXS channels don't work properly with VRA if MC97 is disabled. | 1927 | * DXS channels don't work properly with VRA if MC97 is disabled. |
1928 | */ | 1928 | */ |
1929 | struct pci_dev *pci; | 1929 | struct pci_dev *pci; |
1930 | pci = pci_find_device(0x1106, 0x3068, NULL); /* MC97 */ | 1930 | pci = pci_get_device(0x1106, 0x3068, NULL); /* MC97 */ |
1931 | if (pci) { | 1931 | if (pci) { |
1932 | unsigned char data; | 1932 | unsigned char data; |
1933 | pci_read_config_byte(pci, 0x44, &data); | 1933 | pci_read_config_byte(pci, 0x44, &data); |
1934 | pci_write_config_byte(pci, 0x44, data | 0x40); | 1934 | pci_write_config_byte(pci, 0x44, data | 0x40); |
1935 | pci_dev_put(pci); | ||
1935 | } | 1936 | } |
1936 | } | 1937 | } |
1937 | 1938 | ||