Commit e608460d authored by Dmitry Torokhov's avatar Dmitry Torokhov

Input: mad16 (OSS) - do not carry around gameport code if gameport core

       support is disabled.
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
parent ba7376e9
...@@ -50,9 +50,12 @@ ...@@ -50,9 +50,12 @@
#include "sb.h" #include "sb.h"
#include "mpu401.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_conf;
static int mad16_cdsel; static int mad16_cdsel;
static struct gameport *gameport;
static DEFINE_SPINLOCK(lock); static DEFINE_SPINLOCK(lock);
#define C928 1 #define C928 1
...@@ -902,6 +905,10 @@ static int __initdata irq_map[16] = ...@@ -902,6 +905,10 @@ static int __initdata irq_map[16] =
-1, -1, -1, -1 -1, -1, -1, -1
}; };
#ifdef SUPPORT_JOYSTICK
static struct gameport *gameport;
static int __devinit mad16_register_gameport(int io_port) static int __devinit mad16_register_gameport(int io_port)
{ {
if (!request_region(io_port, 1, "mad16 gameport")) { if (!request_region(io_port, 1, "mad16 gameport")) {
...@@ -925,6 +932,20 @@ static int __devinit mad16_register_gameport(int io_port) ...@@ -925,6 +932,20 @@ static int __devinit mad16_register_gameport(int io_port)
return 0; 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) static int __devinit init_mad16(void)
{ {
int dmatype = 0; int dmatype = 0;
...@@ -1060,12 +1081,7 @@ static void __exit cleanup_mad16(void) ...@@ -1060,12 +1081,7 @@ static void __exit cleanup_mad16(void)
{ {
if (found_mpu) if (found_mpu)
unload_mad16_mpu(&cfg_mpu); unload_mad16_mpu(&cfg_mpu);
if (gameport) { mad16_unregister_gameport();
/* the gameport was initialized so we must free it up */
gameport_unregister_port(gameport);
gameport = NULL;
release_region(0x201, 1);
}
unload_mad16(&cfg); unload_mad16(&cfg);
release_region(MC0_PORT, 12); release_region(MC0_PORT, 12);
} }
......
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