aboutsummaryrefslogtreecommitdiff
path: root/sound/oss/mad16.c
diff options
context:
space:
mode:
authorGreg KH <greg@press.(none)>2005-06-27 22:07:56 -0700
committerGreg Kroah-Hartman <gregkh@suse.de>2005-06-27 22:07:56 -0700
commit8644d2a42bdba2d513f71c07eaf1b6f9b718b8eb (patch)
treec43b6c2fdf1b68b66906a2de69446dcec0f9af6b /sound/oss/mad16.c
parent1cde8a16815bd85c8137d1ea556398983c597c11 (diff)
parent99f95e5286df2f69edab8a04c7080d986ee4233b (diff)
Merge rsync://rsync.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
Diffstat (limited to 'sound/oss/mad16.c')
-rw-r--r--sound/oss/mad16.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/sound/oss/mad16.c b/sound/oss/mad16.c
index a7067f16991..aa3c50db66c 100644
--- a/sound/oss/mad16.c
+++ b/sound/oss/mad16.c
@@ -50,9 +50,12 @@
#include "sb.h"
#include "mpu401.h"
+#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE))
+#define SUPPORT_JOYSTICK 1
+#endif
+
static int mad16_conf;
static int mad16_cdsel;
-static struct gameport *gameport;
static DEFINE_SPINLOCK(lock);
#define C928 1
@@ -902,6 +905,10 @@ static int __initdata irq_map[16] =
-1, -1, -1, -1
};
+#ifdef SUPPORT_JOYSTICK
+
+static struct gameport *gameport;
+
static int __devinit mad16_register_gameport(int io_port)
{
if (!request_region(io_port, 1, "mad16 gameport")) {
@@ -925,6 +932,20 @@ static int __devinit mad16_register_gameport(int io_port)
return 0;
}
+static inline void mad16_unregister_gameport(void)
+{
+ if (gameport) {
+ /* the gameport was initialized so we must free it up */
+ gameport_unregister_port(gameport);
+ gameport = NULL;
+ release_region(0x201, 1);
+ }
+}
+#else
+static inline int mad16_register_gameport(int io_port) { return -ENOSYS; }
+static inline void mad16_unregister_gameport(void) { }
+#endif
+
static int __devinit init_mad16(void)
{
int dmatype = 0;
@@ -1060,12 +1081,7 @@ static void __exit cleanup_mad16(void)
{
if (found_mpu)
unload_mad16_mpu(&cfg_mpu);
- if (gameport) {
- /* the gameport was initialized so we must free it up */
- gameport_unregister_port(gameport);
- gameport = NULL;
- release_region(0x201, 1);
- }
+ mad16_unregister_gameport();
unload_mad16(&cfg);
release_region(MC0_PORT, 12);
}