patch-2_6_7-vs1_9_1_12
[linux-2.6.git] / sound / pci / au88x0 / au88x0_game.c
index 7e7443d..6cc70af 100644 (file)
@@ -32,6 +32,7 @@
 
 #include <sound/driver.h>
 #include <linux/time.h>
+#include <linux/delay.h>
 #include <linux/init.h>
 #include <sound/core.h>
 #include "au88x0.h"
@@ -41,8 +42,6 @@
 
 #define VORTEX_GAME_DWAIT      20      /* 20 ms */
 
-static struct gameport gameport;
-
 static unsigned char vortex_game_read(struct gameport *gameport)
 {
        vortex_t *vortex = gameport->driver;
@@ -81,7 +80,7 @@ static int vortex_game_open(struct gameport *gameport, int mode)
                hwwrite(vortex->mmio, VORTEX_CTRL2,
                        hwread(vortex->mmio,
                               VORTEX_CTRL2) | CTRL2_GAME_ADCMODE);
-               wait_ms(VORTEX_GAME_DWAIT);
+               msleep(VORTEX_GAME_DWAIT);
                return 0;
        case GAMEPORT_MODE_RAW:
                hwwrite(vortex->mmio, VORTEX_CTRL2,
@@ -97,8 +96,10 @@ static int vortex_game_open(struct gameport *gameport, int mode)
 
 static int vortex_gameport_register(vortex_t * vortex)
 {
-       vortex->gameport = &gameport;
-
+       if ((vortex->gameport = snd_kcalloc(sizeof(struct gameport), GFP_KERNEL)) == NULL) {
+               return -1;
+       };
+       
        vortex->gameport->driver = vortex;
        vortex->gameport->fuzz = 64;
 
@@ -117,8 +118,10 @@ static int vortex_gameport_register(vortex_t * vortex)
 
 static int vortex_gameport_unregister(vortex_t * vortex)
 {
-       if (vortex->gameport != NULL)
+       if (vortex->gameport != NULL) {
                gameport_unregister_port(vortex->gameport);
+               kfree(vortex->gameport);
+       }
        return 0;
 }