aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/oss/cs4232.c6
-rw-r--r--sound/oss/wavfront.c38
2 files changed, 31 insertions, 13 deletions
diff --git a/sound/oss/cs4232.c b/sound/oss/cs4232.c
index 6ec308f5d935..7c59e2d4003a 100644
--- a/sound/oss/cs4232.c
+++ b/sound/oss/cs4232.c
@@ -195,10 +195,12 @@ static int __init probe_cs4232(struct address_info *hw_config, int isapnp_config
195 CS_OUT2(0x15, 0x00); /* Select logical device 0 (WSS/SB/FM) */ 195 CS_OUT2(0x15, 0x00); /* Select logical device 0 (WSS/SB/FM) */
196 CS_OUT3(0x47, (base >> 8) & 0xff, base & 0xff); /* WSS base */ 196 CS_OUT3(0x47, (base >> 8) & 0xff, base & 0xff); /* WSS base */
197 197
198 if (check_region(0x388, 4)) /* Not free */ 198 if (!request_region(0x388, 4, "FM")) /* Not free */
199 CS_OUT3(0x48, 0x00, 0x00) /* FM base off */ 199 CS_OUT3(0x48, 0x00, 0x00) /* FM base off */
200 else 200 else {
201 release_region(0x388, 4);
201 CS_OUT3(0x48, 0x03, 0x88); /* FM base 0x388 */ 202 CS_OUT3(0x48, 0x03, 0x88); /* FM base 0x388 */
203 }
202 204
203 CS_OUT3(0x42, 0x00, 0x00); /* SB base off */ 205 CS_OUT3(0x42, 0x00, 0x00); /* SB base off */
204 CS_OUT2(0x22, irq); /* SB+WSS IRQ */ 206 CS_OUT2(0x22, irq); /* SB+WSS IRQ */
diff --git a/sound/oss/wavfront.c b/sound/oss/wavfront.c
index b92ba8921638..b1a4eeb9dc08 100644
--- a/sound/oss/wavfront.c
+++ b/sound/oss/wavfront.c
@@ -2434,7 +2434,7 @@ static int __init detect_wavefront (int irq, int io_base)
2434 consumes 16. 2434 consumes 16.
2435 */ 2435 */
2436 2436
2437 if (check_region (io_base, 16)) { 2437 if (!request_region (io_base, 16, "wavfront")) {
2438 printk (KERN_ERR LOGNAME "IO address range 0x%x - 0x%x " 2438 printk (KERN_ERR LOGNAME "IO address range 0x%x - 0x%x "
2439 "already in use - ignored\n", dev.base, 2439 "already in use - ignored\n", dev.base,
2440 dev.base+15); 2440 dev.base+15);
@@ -2466,10 +2466,13 @@ static int __init detect_wavefront (int irq, int io_base)
2466 } else { 2466 } else {
2467 printk (KERN_WARNING LOGNAME "not raw, but no " 2467 printk (KERN_WARNING LOGNAME "not raw, but no "
2468 "hardware version!\n"); 2468 "hardware version!\n");
2469 release_region (io_base, 16);
2469 return 0; 2470 return 0;
2470 } 2471 }
2471 2472
2472 if (!wf_raw) { 2473 if (!wf_raw) {
2474 /* will re-acquire region in install_wavefront() */
2475 release_region (io_base, 16);
2473 return 1; 2476 return 1;
2474 } else { 2477 } else {
2475 printk (KERN_INFO LOGNAME 2478 printk (KERN_INFO LOGNAME
@@ -2489,6 +2492,7 @@ static int __init detect_wavefront (int irq, int io_base)
2489 2492
2490 if (wavefront_hw_reset ()) { 2493 if (wavefront_hw_reset ()) {
2491 printk (KERN_WARNING LOGNAME "hardware reset failed\n"); 2494 printk (KERN_WARNING LOGNAME "hardware reset failed\n");
2495 release_region (io_base, 16);
2492 return 0; 2496 return 0;
2493 } 2497 }
2494 2498
@@ -2496,6 +2500,8 @@ static int __init detect_wavefront (int irq, int io_base)
2496 2500
2497 dev.has_fx = (detect_wffx () == 0); 2501 dev.has_fx = (detect_wffx () == 0);
2498 2502
2503 /* will re-acquire region in install_wavefront() */
2504 release_region (io_base, 16);
2499 return 1; 2505 return 1;
2500} 2506}
2501 2507
@@ -2804,17 +2810,27 @@ static int __init wavefront_init (int atboot)
2804} 2810}
2805 2811
2806static int __init install_wavefront (void) 2812static int __init install_wavefront (void)
2807
2808{ 2813{
2814 if (!request_region (dev.base+2, 6, "wavefront synth"))
2815 return -1;
2816
2817 if (dev.has_fx) {
2818 if (!request_region (dev.base+8, 8, "wavefront fx")) {
2819 release_region (dev.base+2, 6);
2820 return -1;
2821 }
2822 }
2823
2809 if ((dev.synth_dev = register_sound_synth (&wavefront_fops, -1)) < 0) { 2824 if ((dev.synth_dev = register_sound_synth (&wavefront_fops, -1)) < 0) {
2810 printk (KERN_ERR LOGNAME "cannot register raw synth\n"); 2825 printk (KERN_ERR LOGNAME "cannot register raw synth\n");
2811 return -1; 2826 goto err_out;
2812 } 2827 }
2813 2828
2814#if OSS_SUPPORT_LEVEL & OSS_SUPPORT_SEQ 2829#if OSS_SUPPORT_LEVEL & OSS_SUPPORT_SEQ
2815 if ((dev.oss_dev = sound_alloc_synthdev()) == -1) { 2830 if ((dev.oss_dev = sound_alloc_synthdev()) == -1) {
2816 printk (KERN_ERR LOGNAME "Too many sequencers\n"); 2831 printk (KERN_ERR LOGNAME "Too many sequencers\n");
2817 return -1; 2832 /* FIXME: leak: should unregister sound synth */
2833 goto err_out;
2818 } else { 2834 } else {
2819 synth_devs[dev.oss_dev] = &wavefront_operations; 2835 synth_devs[dev.oss_dev] = &wavefront_operations;
2820 } 2836 }
@@ -2827,20 +2843,20 @@ static int __init install_wavefront (void)
2827 sound_unload_synthdev (dev.oss_dev); 2843 sound_unload_synthdev (dev.oss_dev);
2828#endif /* OSS_SUPPORT_SEQ */ 2844#endif /* OSS_SUPPORT_SEQ */
2829 2845
2830 return -1; 2846 goto err_out;
2831 } 2847 }
2832 2848
2833 request_region (dev.base+2, 6, "wavefront synth");
2834
2835 if (dev.has_fx) {
2836 request_region (dev.base+8, 8, "wavefront fx");
2837 }
2838
2839 if (wavefront_config_midi ()) { 2849 if (wavefront_config_midi ()) {
2840 printk (KERN_WARNING LOGNAME "could not initialize MIDI.\n"); 2850 printk (KERN_WARNING LOGNAME "could not initialize MIDI.\n");
2841 } 2851 }
2842 2852
2843 return dev.oss_dev; 2853 return dev.oss_dev;
2854
2855err_out:
2856 release_region (dev.base+2, 6);
2857 if (dev.has_fx)
2858 release_region (dev.base+8, 8);
2859 return -1;
2844} 2860}
2845 2861
2846static void __exit uninstall_wavefront (void) 2862static void __exit uninstall_wavefront (void)