Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 3540
b: refs/heads/master
c: e608460
h: refs/heads/master
v: v3
  • Loading branch information
Dmitry Torokhov committed Jun 1, 2005
1 parent c076231 commit 685bef9
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ba7376e9348eceda21884cda87e714093260aed2
refs/heads/master: e608460dee4c2de3a01f67c1bac21adb61d617e3
30 changes: 23 additions & 7 deletions trunk/sound/oss/mad16.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")) {
Expand All @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 685bef9

Please sign in to comment.