Commit afff95cf authored by Rusty Russell's avatar Rusty Russell Committed by Linus Torvalds

[PATCH] remove check_region from sound_oss_awe_wave.c

From:  william stinson <wstinson@wanadoo.fr>

  this patch for sound/oss/awe_wave.c sound driver for Linux removes
  three calls to check_region using request_region instead

  This is patch number 33 in a series of check_region patches I am doing as
  part of the kernel janitors project.
parent a19fe3a1
...@@ -267,8 +267,7 @@ static struct voice_alloc_info *voice_alloc; /* set at initialization */ ...@@ -267,8 +267,7 @@ static struct voice_alloc_info *voice_alloc; /* set at initialization */
* function prototypes * function prototypes
*/ */
static int awe_check_port(void); static int awe_request_region(void);
static void awe_request_region(void);
static void awe_release_region(void); static void awe_release_region(void);
static void awe_reset_samples(void); static void awe_reset_samples(void);
...@@ -533,8 +532,8 @@ static int __init _attach_awe(void) ...@@ -533,8 +532,8 @@ static int __init _attach_awe(void)
return 0; return 0;
} }
/* check AWE32 ports are available */ /* reserve I/O ports for awedrv */
if (awe_check_port()) { if (! awe_request_region()) {
printk(KERN_ERR "AWE32: I/O area already used.\n"); printk(KERN_ERR "AWE32: I/O area already used.\n");
return 0; return 0;
} }
...@@ -545,6 +544,7 @@ static int __init _attach_awe(void) ...@@ -545,6 +544,7 @@ static int __init _attach_awe(void)
my_dev = sound_alloc_synthdev(); my_dev = sound_alloc_synthdev();
if (my_dev == -1) { if (my_dev == -1) {
printk(KERN_ERR "AWE32 Error: too many synthesizers\n"); printk(KERN_ERR "AWE32 Error: too many synthesizers\n");
awe_release_region();
return 0; return 0;
} }
...@@ -559,9 +559,6 @@ static int __init _attach_awe(void) ...@@ -559,9 +559,6 @@ static int __init _attach_awe(void)
attach_midiemu(); attach_midiemu();
#endif #endif
/* reserve I/O ports for awedrv */
awe_request_region();
/* clear all samples */ /* clear all samples */
awe_reset_samples(); awe_reset_samples();
...@@ -737,26 +734,27 @@ static void awe_wait(unsigned short delay) ...@@ -737,26 +734,27 @@ static void awe_wait(unsigned short delay)
/* /*
* port check / request * port request
* 0x620-623, 0xA20-A23, 0xE20-E23 * 0x620-623, 0xA20-A23, 0xE20-E23
*/ */
static int __init static int __init
awe_check_port(void)
{
if (! port_setuped) return 0;
return (check_region(awe_ports[0], 4) ||
check_region(awe_ports[1], 4) ||
check_region(awe_ports[3], 4));
}
static void __init
awe_request_region(void) awe_request_region(void)
{ {
if (! port_setuped) return; if (! port_setuped)
request_region(awe_ports[0], 4, "sound driver (AWE32)"); return 0;
request_region(awe_ports[1], 4, "sound driver (AWE32)"); if (! request_region(awe_ports[0], 4, "sound driver (AWE32)"))
request_region(awe_ports[3], 4, "sound driver (AWE32)"); return 0;
if (! request_region(awe_ports[1], 4, "sound driver (AWE32)"))
goto err_out;
if (! request_region(awe_ports[3], 4, "sound driver (AWE32)"))
goto err_out1;
return 1;
err_out1:
release_region(awe_ports[1], 4);
err_out:
release_region(awe_ports[0], 4);
return 0;
} }
static void __exit static void __exit
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment