#include <sound/driver.h>
#include <linux/time.h>
+#include <linux/delay.h>
#include <linux/init.h>
#include <sound/core.h>
#include "au88x0.h"
#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;
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,
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;
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;
}