aboutsummaryrefslogtreecommitdiffstats
path: root/sound/isa
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/isa
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/isa')
-rw-r--r--sound/isa/ad1816a/ad1816a_lib.c5
-rw-r--r--sound/isa/ad1848/ad1848_lib.c5
-rw-r--r--sound/isa/cs423x/cs4231_lib.c10
-rw-r--r--sound/isa/cs423x/cs4236.c8
-rw-r--r--sound/isa/es1688/es1688_lib.c3
-rw-r--r--sound/isa/es18xx.c15
-rw-r--r--sound/isa/gus/gus_main.c10
-rw-r--r--sound/isa/gus/interwave.c5
-rw-r--r--sound/isa/opl3sa2.c5
-rw-r--r--sound/isa/opti9xx/opti92x-ad1848.c25
-rw-r--r--sound/isa/sb/emu8000.c15
-rw-r--r--sound/isa/sb/sb16.c5
-rw-r--r--sound/isa/sb/sb8.c5
-rw-r--r--sound/isa/sb/sb_common.c6
-rw-r--r--sound/isa/sscape.c6
-rw-r--r--sound/isa/wavefront/wavefront.c5
16 files changed, 31 insertions, 102 deletions
diff --git a/sound/isa/ad1816a/ad1816a_lib.c b/sound/isa/ad1816a/ad1816a_lib.c
index 27a9dcfbba00..7ae02396cae2 100644
--- a/sound/isa/ad1816a/ad1816a_lib.c
+++ b/sound/isa/ad1816a/ad1816a_lib.c
@@ -542,10 +542,7 @@ static int snd_ad1816a_probe(ad1816a_t *chip)
542 542
543static int snd_ad1816a_free(ad1816a_t *chip) 543static int snd_ad1816a_free(ad1816a_t *chip)
544{ 544{
545 if (chip->res_port) { 545 release_and_free_resource(chip->res_port);
546 release_resource(chip->res_port);
547 kfree_nocheck(chip->res_port);
548 }
549 if (chip->irq >= 0) 546 if (chip->irq >= 0)
550 free_irq(chip->irq, (void *) chip); 547 free_irq(chip->irq, (void *) chip);
551 if (chip->dma1 >= 0) { 548 if (chip->dma1 >= 0) {
diff --git a/sound/isa/ad1848/ad1848_lib.c b/sound/isa/ad1848/ad1848_lib.c
index 303861cd03cd..0c2924dfefaf 100644
--- a/sound/isa/ad1848/ad1848_lib.c
+++ b/sound/isa/ad1848/ad1848_lib.c
@@ -846,10 +846,7 @@ static int snd_ad1848_capture_close(snd_pcm_substream_t * substream)
846 846
847static int snd_ad1848_free(ad1848_t *chip) 847static int snd_ad1848_free(ad1848_t *chip)
848{ 848{
849 if (chip->res_port) { 849 release_and_free_resource(chip->res_port);
850 release_resource(chip->res_port);
851 kfree_nocheck(chip->res_port);
852 }
853 if (chip->irq >= 0) 850 if (chip->irq >= 0)
854 free_irq(chip->irq, (void *) chip); 851 free_irq(chip->irq, (void *) chip);
855 if (chip->dma >= 0) { 852 if (chip->dma >= 0) {
diff --git a/sound/isa/cs423x/cs4231_lib.c b/sound/isa/cs423x/cs4231_lib.c
index 32318258cd8e..4af769030beb 100644
--- a/sound/isa/cs423x/cs4231_lib.c
+++ b/sound/isa/cs423x/cs4231_lib.c
@@ -1417,14 +1417,8 @@ static int snd_cs4231_pm_resume(snd_card_t *card)
1417 1417
1418static int snd_cs4231_free(cs4231_t *chip) 1418static int snd_cs4231_free(cs4231_t *chip)
1419{ 1419{
1420 if (chip->res_port) { 1420 release_and_free_resource(chip->res_port);
1421 release_resource(chip->res_port); 1421 release_and_free_resource(chip->res_cport);
1422 kfree_nocheck(chip->res_port);
1423 }
1424 if (chip->res_cport) {
1425 release_resource(chip->res_cport);
1426 kfree_nocheck(chip->res_cport);
1427 }
1428 if (chip->irq >= 0) { 1422 if (chip->irq >= 0) {
1429 disable_irq(chip->irq); 1423 disable_irq(chip->irq);
1430 if (!(chip->hwshare & CS4231_HWSHARE_IRQ)) 1424 if (!(chip->hwshare & CS4231_HWSHARE_IRQ))
diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c
index d28315dc72f7..d60a55e6a0b1 100644
--- a/sound/isa/cs423x/cs4236.c
+++ b/sound/isa/cs423x/cs4236.c
@@ -379,12 +379,8 @@ static void snd_card_cs4236_free(snd_card_t *card)
379{ 379{
380 struct snd_card_cs4236 *acard = (struct snd_card_cs4236 *)card->private_data; 380 struct snd_card_cs4236 *acard = (struct snd_card_cs4236 *)card->private_data;
381 381
382 if (acard) { 382 if (acard)
383 if (acard->res_sb_port) { 383 release_and_free_resource(acard->res_sb_port);
384 release_resource(acard->res_sb_port);
385 kfree_nocheck(acard->res_sb_port);
386 }
387 }
388} 384}
389 385
390#ifdef CONFIG_PNP 386#ifdef CONFIG_PNP
diff --git a/sound/isa/es1688/es1688_lib.c b/sound/isa/es1688/es1688_lib.c
index aac898765c02..2edc9c9f0445 100644
--- a/sound/isa/es1688/es1688_lib.c
+++ b/sound/isa/es1688/es1688_lib.c
@@ -606,8 +606,7 @@ static int snd_es1688_free(es1688_t *chip)
606{ 606{
607 if (chip->res_port) { 607 if (chip->res_port) {
608 snd_es1688_init(chip, 0); 608 snd_es1688_init(chip, 0);
609 release_resource(chip->res_port); 609 release_and_free_resource(chip->res_port);
610 kfree_nocheck(chip->res_port);
611 } 610 }
612 if (chip->irq >= 0) 611 if (chip->irq >= 0)
613 free_irq(chip->irq, (void *) chip); 612 free_irq(chip->irq, (void *) chip);
diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c
index d0ea19f42703..f0f8505cd1a5 100644
--- a/sound/isa/es18xx.c
+++ b/sound/isa/es18xx.c
@@ -1640,18 +1640,9 @@ static int snd_es18xx_resume(snd_card_t *card)
1640 1640
1641static int snd_es18xx_free(es18xx_t *chip) 1641static int snd_es18xx_free(es18xx_t *chip)
1642{ 1642{
1643 if (chip->res_port) { 1643 release_and_free_resource(chip->res_port);
1644 release_resource(chip->res_port); 1644 release_and_free_resource(chip->res_ctrl_port);
1645 kfree_nocheck(chip->res_port); 1645 release_and_free_resource(chip->res_mpu_port);
1646 }
1647 if (chip->res_ctrl_port) {
1648 release_resource(chip->res_ctrl_port);
1649 kfree_nocheck(chip->res_ctrl_port);
1650 }
1651 if (chip->res_mpu_port) {
1652 release_resource(chip->res_mpu_port);
1653 kfree_nocheck(chip->res_mpu_port);
1654 }
1655 if (chip->irq >= 0) 1646 if (chip->irq >= 0)
1656 free_irq(chip->irq, (void *) chip); 1647 free_irq(chip->irq, (void *) chip);
1657 if (chip->dma1 >= 0) { 1648 if (chip->dma1 >= 0) {
diff --git a/sound/isa/gus/gus_main.c b/sound/isa/gus/gus_main.c
index 8f2872f8e8f6..5fd374f052ec 100644
--- a/sound/isa/gus/gus_main.c
+++ b/sound/isa/gus/gus_main.c
@@ -113,14 +113,8 @@ static int snd_gus_free(snd_gus_card_t *gus)
113 snd_gf1_stop(gus); 113 snd_gf1_stop(gus);
114 snd_gus_init_dma_irq(gus, 0); 114 snd_gus_init_dma_irq(gus, 0);
115 __hw_end: 115 __hw_end:
116 if (gus->gf1.res_port1) { 116 release_and_free_resource(gus->gf1.res_port1);
117 release_resource(gus->gf1.res_port1); 117 release_and_free_resource(gus->gf1.res_port2);
118 kfree_nocheck(gus->gf1.res_port1);
119 }
120 if (gus->gf1.res_port2) {
121 release_resource(gus->gf1.res_port2);
122 kfree_nocheck(gus->gf1.res_port2);
123 }
124 if (gus->gf1.irq >= 0) 118 if (gus->gf1.irq >= 0)
125 free_irq(gus->gf1.irq, (void *) gus); 119 free_irq(gus->gf1.irq, (void *) gus);
126 if (gus->gf1.dma1 >= 0) { 120 if (gus->gf1.dma1 >= 0) {
diff --git a/sound/isa/gus/interwave.c b/sound/isa/gus/interwave.c
index 358cba9d738f..b101ab0a0dbf 100644
--- a/sound/isa/gus/interwave.c
+++ b/sound/isa/gus/interwave.c
@@ -638,10 +638,7 @@ static void snd_interwave_free(snd_card_t *card)
638 if (iwcard == NULL) 638 if (iwcard == NULL)
639 return; 639 return;
640#ifdef SNDRV_STB 640#ifdef SNDRV_STB
641 if (iwcard->i2c_res) { 641 release_and_free_resource(iwcard->i2c_res);
642 release_resource(iwcard->i2c_res);
643 kfree_nocheck(iwcard->i2c_res);
644 }
645#endif 642#endif
646 if (iwcard->irq >= 0) 643 if (iwcard->irq >= 0)
647 free_irq(iwcard->irq, (void *)iwcard); 644 free_irq(iwcard->irq, (void *)iwcard);
diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c
index 4ba268f251e3..47cabda792b6 100644
--- a/sound/isa/opl3sa2.c
+++ b/sound/isa/opl3sa2.c
@@ -656,10 +656,7 @@ static int snd_opl3sa2_free(opl3sa2_t *chip)
656{ 656{
657 if (chip->irq >= 0) 657 if (chip->irq >= 0)
658 free_irq(chip->irq, (void *)chip); 658 free_irq(chip->irq, (void *)chip);
659 if (chip->res_port) { 659 release_and_free_resource(chip->res_port);
660 release_resource(chip->res_port);
661 kfree_nocheck(chip->res_port);
662 }
663 kfree(chip); 660 kfree(chip);
664 return 0; 661 return 0;
665} 662}
diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c
index 73573cb1db6a..b94339f8306f 100644
--- a/sound/isa/opti9xx/opti92x-ad1848.c
+++ b/sound/isa/opti9xx/opti92x-ad1848.c
@@ -299,10 +299,8 @@ static char * snd_opti9xx_names[] = {
299static long snd_legacy_find_free_ioport(long *port_table, long size) 299static long snd_legacy_find_free_ioport(long *port_table, long size)
300{ 300{
301 while (*port_table != -1) { 301 while (*port_table != -1) {
302 struct resource *res; 302 if (request_region(*port_table, size, "ALSA test")) {
303 if ((res = request_region(*port_table, size, "ALSA test")) != NULL) { 303 release_region(*port_table, size);
304 release_resource(res);
305 kfree_nocheck(res);
306 return *port_table; 304 return *port_table;
307 } 305 }
308 port_table++; 306 port_table++;
@@ -1227,10 +1225,7 @@ static int snd_opti93x_probe(opti93x_t *chip)
1227 1225
1228static int snd_opti93x_free(opti93x_t *chip) 1226static int snd_opti93x_free(opti93x_t *chip)
1229{ 1227{
1230 if (chip->res_port) { 1228 release_and_free_resource(chip->res_port);
1231 release_resource(chip->res_port);
1232 kfree_nocheck(chip->res_port);
1233 }
1234 if (chip->dma1 >= 0) { 1229 if (chip->dma1 >= 0) {
1235 disable_dma(chip->dma1); 1230 disable_dma(chip->dma1);
1236 free_dma(chip->dma1); 1231 free_dma(chip->dma1);
@@ -1656,8 +1651,7 @@ static int __devinit snd_card_opti9xx_detect(snd_card_t *card, opti9xx_t *chip)
1656 if (value == snd_opti9xx_read(chip, OPTi9XX_MC_REG(1))) 1651 if (value == snd_opti9xx_read(chip, OPTi9XX_MC_REG(1)))
1657 return 1; 1652 return 1;
1658 1653
1659 release_resource(chip->res_mc_base); 1654 release_and_free_resource(chip->res_mc_base);
1660 kfree_nocheck(chip->res_mc_base);
1661 chip->res_mc_base = NULL; 1655 chip->res_mc_base = NULL;
1662 1656
1663 } 1657 }
@@ -1683,8 +1677,7 @@ static int __devinit snd_card_opti9xx_detect(snd_card_t *card, opti9xx_t *chip)
1683 if (snd_opti9xx_read(chip, OPTi9XX_MC_REG(7)) == 0xff - value) 1677 if (snd_opti9xx_read(chip, OPTi9XX_MC_REG(7)) == 0xff - value)
1684 return 1; 1678 return 1;
1685 1679
1686 release_resource(chip->res_mc_base); 1680 release_and_free_resource(chip->res_mc_base);
1687 kfree_nocheck(chip->res_mc_base);
1688 chip->res_mc_base = NULL; 1681 chip->res_mc_base = NULL;
1689 } 1682 }
1690#endif /* OPTi93X */ 1683#endif /* OPTi93X */
@@ -1886,12 +1879,8 @@ static void snd_card_opti9xx_free(snd_card_t *card)
1886{ 1879{
1887 opti9xx_t *chip = (opti9xx_t *)card->private_data; 1880 opti9xx_t *chip = (opti9xx_t *)card->private_data;
1888 1881
1889 if (chip) { 1882 if (chip)
1890 if (chip->res_mc_base) { 1883 release_and_free_resource(chip->res_mc_base);
1891 release_resource(chip->res_mc_base);
1892 kfree_nocheck(chip->res_mc_base);
1893 }
1894 }
1895} 1884}
1896 1885
1897static int snd_card_opti9xx_probe(struct pnp_card_link *pcard, 1886static int snd_card_opti9xx_probe(struct pnp_card_link *pcard,
diff --git a/sound/isa/sb/emu8000.c b/sound/isa/sb/emu8000.c
index 5375705c054b..95540f133199 100644
--- a/sound/isa/sb/emu8000.c
+++ b/sound/isa/sb/emu8000.c
@@ -1054,18 +1054,9 @@ __error:
1054 */ 1054 */
1055static int snd_emu8000_free(emu8000_t *hw) 1055static int snd_emu8000_free(emu8000_t *hw)
1056{ 1056{
1057 if (hw->res_port1) { 1057 release_and_free_resource(hw->res_port1);
1058 release_resource(hw->res_port1); 1058 release_and_free_resource(hw->res_port2);
1059 kfree_nocheck(hw->res_port1); 1059 release_and_free_resource(hw->res_port3);
1060 }
1061 if (hw->res_port2) {
1062 release_resource(hw->res_port2);
1063 kfree_nocheck(hw->res_port2);
1064 }
1065 if (hw->res_port3) {
1066 release_resource(hw->res_port3);
1067 kfree_nocheck(hw->res_port3);
1068 }
1069 kfree(hw); 1060 kfree(hw);
1070 return 0; 1061 return 0;
1071} 1062}
diff --git a/sound/isa/sb/sb16.c b/sound/isa/sb/sb16.c
index 7888783d68f5..c2fa451bc8f0 100644
--- a/sound/isa/sb/sb16.c
+++ b/sound/isa/sb/sb16.c
@@ -345,10 +345,7 @@ static void snd_sb16_free(snd_card_t *card)
345 345
346 if (acard == NULL) 346 if (acard == NULL)
347 return; 347 return;
348 if (acard->fm_res) { 348 release_and_free_resource(acard->fm_res);
349 release_resource(acard->fm_res);
350 kfree_nocheck(acard->fm_res);
351 }
352} 349}
353 350
354#ifdef CONFIG_PNP 351#ifdef CONFIG_PNP
diff --git a/sound/isa/sb/sb8.c b/sound/isa/sb/sb8.c
index c41ac25e85ca..0bc0a3afdabc 100644
--- a/sound/isa/sb/sb8.c
+++ b/sound/isa/sb/sb8.c
@@ -78,10 +78,7 @@ static void snd_sb8_free(snd_card_t *card)
78 78
79 if (acard == NULL) 79 if (acard == NULL)
80 return; 80 return;
81 if (acard->fm_res) { 81 release_and_free_resource(acard->fm_res);
82 release_resource(acard->fm_res);
83 kfree_nocheck(acard->fm_res);
84 }
85} 82}
86 83
87static int __init snd_sb8_probe(int dev) 84static int __init snd_sb8_probe(int dev)
diff --git a/sound/isa/sb/sb_common.c b/sound/isa/sb/sb_common.c
index f0f205ae425f..46b9480669f9 100644
--- a/sound/isa/sb/sb_common.c
+++ b/sound/isa/sb/sb_common.c
@@ -178,10 +178,8 @@ static int snd_sbdsp_probe(sb_t * chip)
178 178
179static int snd_sbdsp_free(sb_t *chip) 179static int snd_sbdsp_free(sb_t *chip)
180{ 180{
181 if (chip->res_port) { 181 if (chip->res_port)
182 release_resource(chip->res_port); 182 release_and_free_resource(chip->res_port);
183 kfree_nocheck(chip->res_port);
184 }
185 if (chip->irq >= 0) 183 if (chip->irq >= 0)
186 free_irq(chip->irq, (void *) chip); 184 free_irq(chip->irq, (void *) chip);
187#ifdef CONFIG_ISA 185#ifdef CONFIG_ISA
diff --git a/sound/isa/sscape.c b/sound/isa/sscape.c
index 9f6b58c79209..1036876146c4 100644
--- a/sound/isa/sscape.c
+++ b/sound/isa/sscape.c
@@ -338,8 +338,7 @@ static inline void activate_ad1845_unsafe(unsigned io_base)
338static void soundscape_free(snd_card_t * c) 338static void soundscape_free(snd_card_t * c)
339{ 339{
340 register struct soundscape *sscape = get_card_soundscape(c); 340 register struct soundscape *sscape = get_card_soundscape(c);
341 release_resource(sscape->io_res); 341 release_and_free_resource(sscape->io_res);
342 kfree_nocheck(sscape->io_res);
343 free_dma(sscape->chip->dma1); 342 free_dma(sscape->chip->dma1);
344} 343}
345 344
@@ -1288,8 +1287,7 @@ static int __devinit create_sscape(const struct params *params, snd_card_t **rca
1288 free_dma(params->dma1); 1287 free_dma(params->dma1);
1289 1288
1290 _release_region: 1289 _release_region:
1291 release_resource(io_res); 1290 release_and_free_resource(io_res);
1292 kfree_nocheck(io_res);
1293 1291
1294 return err; 1292 return err;
1295} 1293}
diff --git a/sound/isa/wavefront/wavefront.c b/sound/isa/wavefront/wavefront.c
index 0a572e0a47e6..1818f1013c3f 100644
--- a/sound/isa/wavefront/wavefront.c
+++ b/sound/isa/wavefront/wavefront.c
@@ -379,10 +379,7 @@ snd_wavefront_free(snd_card_t *card)
379 snd_wavefront_card_t *acard = (snd_wavefront_card_t *)card->private_data; 379 snd_wavefront_card_t *acard = (snd_wavefront_card_t *)card->private_data;
380 380
381 if (acard) { 381 if (acard) {
382 if (acard->wavefront.res_base != NULL) { 382 release_and_free_resource(acard->wavefront.res_base);
383 release_resource(acard->wavefront.res_base);
384 kfree_nocheck(acard->wavefront.res_base);
385 }
386 if (acard->wavefront.irq > 0) 383 if (acard->wavefront.irq > 0)
387 free_irq(acard->wavefront.irq, (void *)acard); 384 free_irq(acard->wavefront.irq, (void *)acard);
388 } 385 }