aboutsummaryrefslogtreecommitdiffstats
path: root/sound/oss/mad16.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor_core@ameritech.net>2005-06-01 03:38:46 -0400
committerDmitry Torokhov <dtor_core@ameritech.net>2005-06-01 03:38:46 -0400
commite608460dee4c2de3a01f67c1bac21adb61d617e3 (patch)
treeb37a75642947a0a45afbba40c76c82985675d155 /sound/oss/mad16.c
parentba7376e9348eceda21884cda87e714093260aed2 (diff)
Input: mad16 (OSS) - do not carry around gameport code if gameport core
support is disabled. Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
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 a7067f169919..aa3c50db66c4 100644
--- a/sound/oss/mad16.c
+++ b/sound/oss/mad16.c
@@ -50,9 +50,12 @@
50#include "sb.h" 50#include "sb.h"
51#include "mpu401.h" 51#include "mpu401.h"
52 52
53#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE))
54#define SUPPORT_JOYSTICK 1
55#endif
56
53static int mad16_conf; 57static int mad16_conf;
54static int mad16_cdsel; 58static int mad16_cdsel;
55static struct gameport *gameport;
56static DEFINE_SPINLOCK(lock); 59static DEFINE_SPINLOCK(lock);
57 60
58#define C928 1 61#define C928 1
@@ -902,6 +905,10 @@ static int __initdata irq_map[16] =
902 -1, -1, -1, -1 905 -1, -1, -1, -1
903}; 906};
904 907
908#ifdef SUPPORT_JOYSTICK
909
910static struct gameport *gameport;
911
905static int __devinit mad16_register_gameport(int io_port) 912static int __devinit mad16_register_gameport(int io_port)
906{ 913{
907 if (!request_region(io_port, 1, "mad16 gameport")) { 914 if (!request_region(io_port, 1, "mad16 gameport")) {
@@ -925,6 +932,20 @@ static int __devinit mad16_register_gameport(int io_port)
925 return 0; 932 return 0;
926} 933}
927 934
935static inline void mad16_unregister_gameport(void)
936{
937 if (gameport) {
938 /* the gameport was initialized so we must free it up */
939 gameport_unregister_port(gameport);
940 gameport = NULL;
941 release_region(0x201, 1);
942 }
943}
944#else
945static inline int mad16_register_gameport(int io_port) { return -ENOSYS; }
946static inline void mad16_unregister_gameport(void) { }
947#endif
948
928static int __devinit init_mad16(void) 949static int __devinit init_mad16(void)
929{ 950{
930 int dmatype = 0; 951 int dmatype = 0;
@@ -1060,12 +1081,7 @@ static void __exit cleanup_mad16(void)
1060{ 1081{
1061 if (found_mpu) 1082 if (found_mpu)
1062 unload_mad16_mpu(&cfg_mpu); 1083 unload_mad16_mpu(&cfg_mpu);
1063 if (gameport) { 1084 mad16_unregister_gameport();
1064 /* the gameport was initialized so we must free it up */
1065 gameport_unregister_port(gameport);
1066 gameport = NULL;
1067 release_region(0x201, 1);
1068 }
1069 unload_mad16(&cfg); 1085 unload_mad16(&cfg);
1070 release_region(MC0_PORT, 12); 1086 release_region(MC0_PORT, 12);
1071} 1087}