Commit 263aba71 authored by Dmitry Torokhov's avatar Dmitry Torokhov

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

       core support is disabled, some formatting changes.
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
parent 04b6389a
...@@ -228,6 +228,10 @@ ...@@ -228,6 +228,10 @@
#define DRIVER_VERSION "0.14.10j-2.6" #define DRIVER_VERSION "0.14.10j-2.6"
#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE))
#define SUPPORT_JOYSTICK 1
#endif
/* magic numbers to protect our data structures */ /* magic numbers to protect our data structures */
#define TRIDENT_CARD_MAGIC 0x5072696E /* "Prin" */ #define TRIDENT_CARD_MAGIC 0x5072696E /* "Prin" */
#define TRIDENT_STATE_MAGIC 0x63657373 /* "cess" */ #define TRIDENT_STATE_MAGIC 0x63657373 /* "cess" */
...@@ -4252,24 +4256,25 @@ trident_ac97_init(struct trident_card *card) ...@@ -4252,24 +4256,25 @@ trident_ac97_init(struct trident_card *card)
return num_ac97 + 1; return num_ac97 + 1;
} }
#ifdef SUPPORT_JOYSTICK
/* Gameport functions for the cards ADC gameport */ /* Gameport functions for the cards ADC gameport */
static unsigned char static unsigned char trident_game_read(struct gameport *gameport)
trident_game_read(struct gameport *gameport)
{ {
struct trident_card *card = gameport->port_data; struct trident_card *card = gameport->port_data;
return inb(TRID_REG(card, T4D_GAME_LEG)); return inb(TRID_REG(card, T4D_GAME_LEG));
} }
static void static void trident_game_trigger(struct gameport *gameport)
trident_game_trigger(struct gameport *gameport)
{ {
struct trident_card *card = gameport->port_data; struct trident_card *card = gameport->port_data;
outb(0xff, TRID_REG(card, T4D_GAME_LEG)); outb(0xff, TRID_REG(card, T4D_GAME_LEG));
} }
static int static int trident_game_cooked_read(struct gameport *gameport,
trident_game_cooked_read(struct gameport *gameport, int *axes, int *buttons) int *axes, int *buttons)
{ {
struct trident_card *card = gameport->port_data; struct trident_card *card = gameport->port_data;
int i; int i;
...@@ -4285,8 +4290,7 @@ trident_game_cooked_read(struct gameport *gameport, int *axes, int *buttons) ...@@ -4285,8 +4290,7 @@ trident_game_cooked_read(struct gameport *gameport, int *axes, int *buttons)
return 0; return 0;
} }
static int static int trident_game_open(struct gameport *gameport, int mode)
trident_game_open(struct gameport *gameport, int mode)
{ {
struct trident_card *card = gameport->port_data; struct trident_card *card = gameport->port_data;
...@@ -4305,8 +4309,7 @@ trident_game_open(struct gameport *gameport, int mode) ...@@ -4305,8 +4309,7 @@ trident_game_open(struct gameport *gameport, int mode)
return 0; return 0;
} }
static int __devinit static int __devinit trident_register_gameport(struct trident_card *card)
trident_register_gameport(struct trident_card *card)
{ {
struct gameport *gp; struct gameport *gp;
...@@ -4330,6 +4333,17 @@ trident_register_gameport(struct trident_card *card) ...@@ -4330,6 +4333,17 @@ trident_register_gameport(struct trident_card *card)
return 0; return 0;
} }
static inline void trident_unregister_gameport(struct trident_card *card)
{
if (card->gameport)
gameport_unregister_port(card->gameport);
}
#else
static inline int trident_register_gameport(struct trident_card *card) { return -ENOSYS; }
static inline void trident_unregister_gameport(struct trident_card *card) { }
#endif /* SUPPORT_JOYSTICK */
/* install the driver, we do not allocate hardware channel nor DMA buffer */ /* install the driver, we do not allocate hardware channel nor DMA buffer */
/* now, they are defered until "ACCESS" time (in prog_dmabuf called by */ /* now, they are defered until "ACCESS" time (in prog_dmabuf called by */
/* open/read/write/ioctl/mmap) */ /* open/read/write/ioctl/mmap) */
...@@ -4569,8 +4583,7 @@ trident_remove(struct pci_dev *pci_dev) ...@@ -4569,8 +4583,7 @@ trident_remove(struct pci_dev *pci_dev)
} }
/* Unregister gameport */ /* Unregister gameport */
if (card->gameport) trident_unregister_gameport(card);
gameport_unregister_port(card->gameport);
/* Kill interrupts, and SP/DIF */ /* Kill interrupts, and SP/DIF */
trident_disable_loop_interrupts(card); trident_disable_loop_interrupts(card);
......
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