aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-10-10 05:56:31 -0400
committerJaroslav Kysela <perex@suse.cz>2005-11-04 07:18:00 -0500
commitb1d5776d865951c213a1caaab5d8bf5de7615dbd (patch)
treef999dca30f6e2d03a9176b86c613ae8f4531a6d6 /sound/pci
parent93f2e37840a9a7c3693ca6961fe6ad46b250f3b9 (diff)
[ALSA] Remove vmalloc wrapper, kfree_nocheck()
- Remove vmalloc wrapper - Add release_and_free_resource() to remove kfree_nocheck() from each driver and simplify the code Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/als4000.c6
-rw-r--r--sound/pci/azt3328.c6
-rw-r--r--sound/pci/ca0106/ca0106_main.c6
-rw-r--r--sound/pci/cmipci.c6
-rw-r--r--sound/pci/cs46xx/cs46xx_lib.c5
-rw-r--r--sound/pci/emu10k1/emu10k1x.c6
-rw-r--r--sound/pci/es1968.c6
-rw-r--r--sound/pci/nm256/nm256.c10
-rw-r--r--sound/pci/sonicvibes.c10
-rw-r--r--sound/pci/via82xx.c11
-rw-r--r--sound/pci/ymfpci/ymfpci.c16
-rw-r--r--sound/pci/ymfpci/ymfpci_main.c15
12 files changed, 27 insertions, 76 deletions
diff --git a/sound/pci/als4000.c b/sound/pci/als4000.c
index 196ec1c61bb4..8a32cd92f62a 100644
--- a/sound/pci/als4000.c
+++ b/sound/pci/als4000.c
@@ -594,8 +594,7 @@ static int __devinit snd_als4000_create_gameport(snd_card_als4000_t *acard, int
594 acard->gameport = gp = gameport_allocate_port(); 594 acard->gameport = gp = gameport_allocate_port();
595 if (!gp) { 595 if (!gp) {
596 printk(KERN_ERR "als4000: cannot allocate memory for gameport\n"); 596 printk(KERN_ERR "als4000: cannot allocate memory for gameport\n");
597 release_resource(r); 597 release_and_free_resource(r);
598 kfree_nocheck(r);
599 return -ENOMEM; 598 return -ENOMEM;
600 } 599 }
601 600
@@ -622,8 +621,7 @@ static void snd_als4000_free_gameport(snd_card_als4000_t *acard)
622 acard->gameport = NULL; 621 acard->gameport = NULL;
623 622
624 snd_als4000_set_addr(acard->gcr, 0, 0, 0, 0); /* disable joystick */ 623 snd_als4000_set_addr(acard->gcr, 0, 0, 0, 0); /* disable joystick */
625 release_resource(r); 624 release_and_free_resource(r);
626 kfree_nocheck(r);
627 } 625 }
628} 626}
629#else 627#else
diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c
index d5261bdec583..dc638f395c02 100644
--- a/sound/pci/azt3328.c
+++ b/sound/pci/azt3328.c
@@ -1238,8 +1238,7 @@ static int __devinit snd_azf3328_config_joystick(azf3328_t *chip, int dev)
1238 chip->gameport = gp = gameport_allocate_port(); 1238 chip->gameport = gp = gameport_allocate_port();
1239 if (!gp) { 1239 if (!gp) {
1240 printk(KERN_ERR "azt3328: cannot allocate memory for gameport\n"); 1240 printk(KERN_ERR "azt3328: cannot allocate memory for gameport\n");
1241 release_resource(r); 1241 release_and_free_resource(r);
1242 kfree_nocheck(r);
1243 return -ENOMEM; 1242 return -ENOMEM;
1244 } 1243 }
1245 1244
@@ -1267,8 +1266,7 @@ static void snd_azf3328_free_joystick(azf3328_t *chip)
1267 /* disable gameport */ 1266 /* disable gameport */
1268 snd_azf3328_io2_write(chip, IDX_IO2_LEGACY_ADDR, 1267 snd_azf3328_io2_write(chip, IDX_IO2_LEGACY_ADDR,
1269 snd_azf3328_io2_read(chip, IDX_IO2_LEGACY_ADDR) & ~LEGACY_JOY); 1268 snd_azf3328_io2_read(chip, IDX_IO2_LEGACY_ADDR) & ~LEGACY_JOY);
1270 release_resource(r); 1269 release_and_free_resource(r);
1271 kfree_nocheck(r);
1272 } 1270 }
1273} 1271}
1274#else 1272#else
diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c
index ba07960921d8..0d9d8923fbbb 100644
--- a/sound/pci/ca0106/ca0106_main.c
+++ b/sound/pci/ca0106/ca0106_main.c
@@ -969,10 +969,8 @@ static int snd_ca0106_free(ca0106_t *chip)
969#endif 969#endif
970 970
971 // release the i/o port 971 // release the i/o port
972 if (chip->res_port) { 972 release_and_free_resource(chip->res_port);
973 release_resource(chip->res_port); 973
974 kfree_nocheck(chip->res_port);
975 }
976 // release the irq 974 // release the irq
977 if (chip->irq >= 0) 975 if (chip->irq >= 0)
978 free_irq(chip->irq, (void *)chip); 976 free_irq(chip->irq, (void *)chip);
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c
index 316afb78488d..db093bca2cd0 100644
--- a/sound/pci/cmipci.c
+++ b/sound/pci/cmipci.c
@@ -2683,8 +2683,7 @@ static int __devinit snd_cmipci_create_gameport(cmipci_t *cm, int dev)
2683 cm->gameport = gp = gameport_allocate_port(); 2683 cm->gameport = gp = gameport_allocate_port();
2684 if (!gp) { 2684 if (!gp) {
2685 printk(KERN_ERR "cmipci: cannot allocate memory for gameport\n"); 2685 printk(KERN_ERR "cmipci: cannot allocate memory for gameport\n");
2686 release_resource(r); 2686 release_and_free_resource(r);
2687 kfree_nocheck(r);
2688 return -ENOMEM; 2687 return -ENOMEM;
2689 } 2688 }
2690 gameport_set_name(gp, "C-Media Gameport"); 2689 gameport_set_name(gp, "C-Media Gameport");
@@ -2709,8 +2708,7 @@ static void snd_cmipci_free_gameport(cmipci_t *cm)
2709 cm->gameport = NULL; 2708 cm->gameport = NULL;
2710 2709
2711 snd_cmipci_clear_bit(cm, CM_REG_FUNCTRL1, CM_JYSTK_EN); 2710 snd_cmipci_clear_bit(cm, CM_REG_FUNCTRL1, CM_JYSTK_EN);
2712 release_resource(r); 2711 release_and_free_resource(r);
2713 kfree_nocheck(r);
2714 } 2712 }
2715} 2713}
2716#else 2714#else
diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c
index 6e3855b8b33d..147836f09dcf 100644
--- a/sound/pci/cs46xx/cs46xx_lib.c
+++ b/sound/pci/cs46xx/cs46xx_lib.c
@@ -2906,10 +2906,7 @@ static int snd_cs46xx_free(cs46xx_t *chip)
2906 snd_cs46xx_region_t *region = &chip->region.idx[idx]; 2906 snd_cs46xx_region_t *region = &chip->region.idx[idx];
2907 if (region->remap_addr) 2907 if (region->remap_addr)
2908 iounmap(region->remap_addr); 2908 iounmap(region->remap_addr);
2909 if (region->resource) { 2909 release_and_free_resource(region->resource);
2910 release_resource(region->resource);
2911 kfree_nocheck(region->resource);
2912 }
2913 } 2910 }
2914 if (chip->irq >= 0) 2911 if (chip->irq >= 0)
2915 free_irq(chip->irq, (void *)chip); 2912 free_irq(chip->irq, (void *)chip);
diff --git a/sound/pci/emu10k1/emu10k1x.c b/sound/pci/emu10k1/emu10k1x.c
index ad15755a63c3..cbb689474e7d 100644
--- a/sound/pci/emu10k1/emu10k1x.c
+++ b/sound/pci/emu10k1/emu10k1x.c
@@ -759,10 +759,8 @@ static int snd_emu10k1x_free(emu10k1x_t *chip)
759 outl(HCFG_LOCKSOUNDCACHE, chip->port + HCFG); 759 outl(HCFG_LOCKSOUNDCACHE, chip->port + HCFG);
760 760
761 // release the i/o port 761 // release the i/o port
762 if (chip->res_port) { 762 release_and_free_resource(chip->res_port);
763 release_resource(chip->res_port); 763
764 kfree_nocheck(chip->res_port);
765 }
766 // release the irq 764 // release the irq
767 if (chip->irq >= 0) 765 if (chip->irq >= 0)
768 free_irq(chip->irq, (void *)chip); 766 free_irq(chip->irq, (void *)chip);
diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c
index ecdcada90ca2..1bf094b67469 100644
--- a/sound/pci/es1968.c
+++ b/sound/pci/es1968.c
@@ -2461,8 +2461,7 @@ static int __devinit snd_es1968_create_gameport(es1968_t *chip, int dev)
2461 chip->gameport = gp = gameport_allocate_port(); 2461 chip->gameport = gp = gameport_allocate_port();
2462 if (!gp) { 2462 if (!gp) {
2463 printk(KERN_ERR "es1968: cannot allocate memory for gameport\n"); 2463 printk(KERN_ERR "es1968: cannot allocate memory for gameport\n");
2464 release_resource(r); 2464 release_and_free_resource(r);
2465 kfree_nocheck(r);
2466 return -ENOMEM; 2465 return -ENOMEM;
2467 } 2466 }
2468 2467
@@ -2488,8 +2487,7 @@ static void snd_es1968_free_gameport(es1968_t *chip)
2488 gameport_unregister_port(chip->gameport); 2487 gameport_unregister_port(chip->gameport);
2489 chip->gameport = NULL; 2488 chip->gameport = NULL;
2490 2489
2491 release_resource(r); 2490 release_and_free_resource(r);
2492 kfree_nocheck(r);
2493 } 2491 }
2494} 2492}
2495#else 2493#else
diff --git a/sound/pci/nm256/nm256.c b/sound/pci/nm256/nm256.c
index 5c55a3b1d121..ebfa38b51128 100644
--- a/sound/pci/nm256/nm256.c
+++ b/sound/pci/nm256/nm256.c
@@ -1347,14 +1347,8 @@ static int snd_nm256_free(nm256_t *chip)
1347 iounmap(chip->cport); 1347 iounmap(chip->cport);
1348 if (chip->buffer) 1348 if (chip->buffer)
1349 iounmap(chip->buffer); 1349 iounmap(chip->buffer);
1350 if (chip->res_cport) { 1350 release_and_free_resource(chip->res_cport);
1351 release_resource(chip->res_cport); 1351 release_and_free_resource(chip->res_buffer);
1352 kfree_nocheck(chip->res_cport);
1353 }
1354 if (chip->res_buffer) {
1355 release_resource(chip->res_buffer);
1356 kfree_nocheck(chip->res_buffer);
1357 }
1358 if (chip->irq >= 0) 1352 if (chip->irq >= 0)
1359 free_irq(chip->irq, (void*)chip); 1353 free_irq(chip->irq, (void*)chip);
1360 1354
diff --git a/sound/pci/sonicvibes.c b/sound/pci/sonicvibes.c
index 1f6c2bfd43fd..4f64814dfef0 100644
--- a/sound/pci/sonicvibes.c
+++ b/sound/pci/sonicvibes.c
@@ -1205,14 +1205,8 @@ static int snd_sonicvibes_free(sonicvibes_t *sonic)
1205 pci_write_config_dword(sonic->pci, 0x48, sonic->dmac_port); 1205 pci_write_config_dword(sonic->pci, 0x48, sonic->dmac_port);
1206 if (sonic->irq >= 0) 1206 if (sonic->irq >= 0)
1207 free_irq(sonic->irq, (void *)sonic); 1207 free_irq(sonic->irq, (void *)sonic);
1208 if (sonic->res_dmaa) { 1208 release_and_free_resource(sonic->res_dmaa);
1209 release_resource(sonic->res_dmaa); 1209 release_and_free_resource(sonic->res_dmac);
1210 kfree_nocheck(sonic->res_dmaa);
1211 }
1212 if (sonic->res_dmac) {
1213 release_resource(sonic->res_dmac);
1214 kfree_nocheck(sonic->res_dmac);
1215 }
1216 pci_release_regions(sonic->pci); 1210 pci_release_regions(sonic->pci);
1217 pci_disable_device(sonic->pci); 1211 pci_disable_device(sonic->pci);
1218 kfree(sonic); 1212 kfree(sonic);
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c
index b2779fb7d1a9..b0302c369c3d 100644
--- a/sound/pci/via82xx.c
+++ b/sound/pci/via82xx.c
@@ -1655,8 +1655,7 @@ static int __devinit snd_via686_create_gameport(via82xx_t *chip, unsigned char *
1655 chip->gameport = gp = gameport_allocate_port(); 1655 chip->gameport = gp = gameport_allocate_port();
1656 if (!gp) { 1656 if (!gp) {
1657 printk(KERN_ERR "via82xx: cannot allocate memory for gameport\n"); 1657 printk(KERN_ERR "via82xx: cannot allocate memory for gameport\n");
1658 release_resource(r); 1658 release_and_free_resource(r);
1659 kfree_nocheck(r);
1660 return -ENOMEM; 1659 return -ENOMEM;
1661 } 1660 }
1662 1661
@@ -1682,8 +1681,7 @@ static void snd_via686_free_gameport(via82xx_t *chip)
1682 1681
1683 gameport_unregister_port(chip->gameport); 1682 gameport_unregister_port(chip->gameport);
1684 chip->gameport = NULL; 1683 chip->gameport = NULL;
1685 release_resource(r); 1684 release_and_free_resource(r);
1686 kfree_nocheck(r);
1687 } 1685 }
1688} 1686}
1689#else 1687#else
@@ -2023,10 +2021,7 @@ static int snd_via82xx_free(via82xx_t *chip)
2023 __end_hw: 2021 __end_hw:
2024 if (chip->irq >= 0) 2022 if (chip->irq >= 0)
2025 free_irq(chip->irq, (void *)chip); 2023 free_irq(chip->irq, (void *)chip);
2026 if (chip->mpu_res) { 2024 release_and_free_resource(chip->mpu_res);
2027 release_resource(chip->mpu_res);
2028 kfree_nocheck(chip->mpu_res);
2029 }
2030 pci_release_regions(chip->pci); 2025 pci_release_regions(chip->pci);
2031 2026
2032 if (chip->chip_type == TYPE_VIA686) { 2027 if (chip->chip_type == TYPE_VIA686) {
diff --git a/sound/pci/ymfpci/ymfpci.c b/sound/pci/ymfpci/ymfpci.c
index 2e69abe51aa9..e50d744ae706 100644
--- a/sound/pci/ymfpci/ymfpci.c
+++ b/sound/pci/ymfpci/ymfpci.c
@@ -130,8 +130,7 @@ static int __devinit snd_ymfpci_create_gameport(ymfpci_t *chip, int dev,
130 chip->gameport = gp = gameport_allocate_port(); 130 chip->gameport = gp = gameport_allocate_port();
131 if (!gp) { 131 if (!gp) {
132 printk(KERN_ERR "ymfpci: cannot allocate memory for gameport\n"); 132 printk(KERN_ERR "ymfpci: cannot allocate memory for gameport\n");
133 release_resource(r); 133 release_and_free_resource(r);
134 kfree_nocheck(r);
135 return -ENOMEM; 134 return -ENOMEM;
136 } 135 }
137 136
@@ -161,8 +160,7 @@ void snd_ymfpci_free_gameport(ymfpci_t *chip)
161 gameport_unregister_port(chip->gameport); 160 gameport_unregister_port(chip->gameport);
162 chip->gameport = NULL; 161 chip->gameport = NULL;
163 162
164 release_resource(r); 163 release_and_free_resource(r);
165 kfree_nocheck(r);
166 } 164 }
167} 165}
168#else 166#else
@@ -267,14 +265,8 @@ static int __devinit snd_card_ymfpci_probe(struct pci_dev *pci,
267 old_legacy_ctrl, 265 old_legacy_ctrl,
268 &chip)) < 0) { 266 &chip)) < 0) {
269 snd_card_free(card); 267 snd_card_free(card);
270 if (mpu_res) { 268 release_and_free_resource(mpu_res);
271 release_resource(mpu_res); 269 release_and_free_resource(fm_res);
272 kfree_nocheck(mpu_res);
273 }
274 if (fm_res) {
275 release_resource(fm_res);
276 kfree_nocheck(fm_res);
277 }
278 return err; 270 return err;
279 } 271 }
280 chip->fm_res = fm_res; 272 chip->fm_res = fm_res;
diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c
index 2e671ee438c6..c0aaade772d4 100644
--- a/sound/pci/ymfpci/ymfpci_main.c
+++ b/sound/pci/ymfpci/ymfpci_main.c
@@ -2151,14 +2151,8 @@ static int snd_ymfpci_free(ymfpci_t *chip)
2151#ifdef CONFIG_PM 2151#ifdef CONFIG_PM
2152 vfree(chip->saved_regs); 2152 vfree(chip->saved_regs);
2153#endif 2153#endif
2154 if (chip->mpu_res) { 2154 release_and_free_resource(chip->mpu_res);
2155 release_resource(chip->mpu_res); 2155 release_and_free_resource(chip->fm_res);
2156 kfree_nocheck(chip->mpu_res);
2157 }
2158 if (chip->fm_res) {
2159 release_resource(chip->fm_res);
2160 kfree_nocheck(chip->fm_res);
2161 }
2162 snd_ymfpci_free_gameport(chip); 2156 snd_ymfpci_free_gameport(chip);
2163 if (chip->reg_area_virt) 2157 if (chip->reg_area_virt)
2164 iounmap(chip->reg_area_virt); 2158 iounmap(chip->reg_area_virt);
@@ -2167,10 +2161,7 @@ static int snd_ymfpci_free(ymfpci_t *chip)
2167 2161
2168 if (chip->irq >= 0) 2162 if (chip->irq >= 0)
2169 free_irq(chip->irq, (void *)chip); 2163 free_irq(chip->irq, (void *)chip);
2170 if (chip->res_reg_area) { 2164 release_and_free_resource(chip->res_reg_area);
2171 release_resource(chip->res_reg_area);
2172 kfree_nocheck(chip->res_reg_area);
2173 }
2174 2165
2175 pci_write_config_word(chip->pci, 0x40, chip->old_legacy_ctrl); 2166 pci_write_config_word(chip->pci, 0x40, chip->old_legacy_ctrl);
2176 2167