aboutsummaryrefslogtreecommitdiffstats
path: root/sound/oss/trident.c
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor_core@ameritech.net>2005-06-01 03:38:37 -0400
committerDmitry Torokhov <dtor_core@ameritech.net>2005-06-01 03:38:37 -0400
commit263aba711eabd4b63b70dfe8f78e3a8a7ce65fa9 (patch)
treef88b415478e7061c0ed3f8f0c4851d5949bee330 /sound/oss/trident.c
parent04b6389a5e236a0d214503e922f1e87ccb97f79d (diff)
Input: trident (OSS) - do not carry around gameport code if gameport
core support is disabled, some formatting changes. Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'sound/oss/trident.c')
-rw-r--r--sound/oss/trident.c37
1 files changed, 25 insertions, 12 deletions
diff --git a/sound/oss/trident.c b/sound/oss/trident.c
index 47537f0a5b05..5f0ad6bb43b9 100644
--- a/sound/oss/trident.c
+++ b/sound/oss/trident.c
@@ -228,6 +228,10 @@
228 228
229#define DRIVER_VERSION "0.14.10j-2.6" 229#define DRIVER_VERSION "0.14.10j-2.6"
230 230
231#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE))
232#define SUPPORT_JOYSTICK 1
233#endif
234
231/* magic numbers to protect our data structures */ 235/* magic numbers to protect our data structures */
232#define TRIDENT_CARD_MAGIC 0x5072696E /* "Prin" */ 236#define TRIDENT_CARD_MAGIC 0x5072696E /* "Prin" */
233#define TRIDENT_STATE_MAGIC 0x63657373 /* "cess" */ 237#define TRIDENT_STATE_MAGIC 0x63657373 /* "cess" */
@@ -4252,24 +4256,25 @@ trident_ac97_init(struct trident_card *card)
4252 return num_ac97 + 1; 4256 return num_ac97 + 1;
4253} 4257}
4254 4258
4259#ifdef SUPPORT_JOYSTICK
4255/* Gameport functions for the cards ADC gameport */ 4260/* Gameport functions for the cards ADC gameport */
4256 4261
4257static unsigned char 4262static unsigned char trident_game_read(struct gameport *gameport)
4258trident_game_read(struct gameport *gameport)
4259{ 4263{
4260 struct trident_card *card = gameport->port_data; 4264 struct trident_card *card = gameport->port_data;
4265
4261 return inb(TRID_REG(card, T4D_GAME_LEG)); 4266 return inb(TRID_REG(card, T4D_GAME_LEG));
4262} 4267}
4263 4268
4264static void 4269static void trident_game_trigger(struct gameport *gameport)
4265trident_game_trigger(struct gameport *gameport)
4266{ 4270{
4267 struct trident_card *card = gameport->port_data; 4271 struct trident_card *card = gameport->port_data;
4272
4268 outb(0xff, TRID_REG(card, T4D_GAME_LEG)); 4273 outb(0xff, TRID_REG(card, T4D_GAME_LEG));
4269} 4274}
4270 4275
4271static int 4276static int trident_game_cooked_read(struct gameport *gameport,
4272trident_game_cooked_read(struct gameport *gameport, int *axes, int *buttons) 4277 int *axes, int *buttons)
4273{ 4278{
4274 struct trident_card *card = gameport->port_data; 4279 struct trident_card *card = gameport->port_data;
4275 int i; 4280 int i;
@@ -4285,8 +4290,7 @@ trident_game_cooked_read(struct gameport *gameport, int *axes, int *buttons)
4285 return 0; 4290 return 0;
4286} 4291}
4287 4292
4288static int 4293static int trident_game_open(struct gameport *gameport, int mode)
4289trident_game_open(struct gameport *gameport, int mode)
4290{ 4294{
4291 struct trident_card *card = gameport->port_data; 4295 struct trident_card *card = gameport->port_data;
4292 4296
@@ -4305,8 +4309,7 @@ trident_game_open(struct gameport *gameport, int mode)
4305 return 0; 4309 return 0;
4306} 4310}
4307 4311
4308static int __devinit 4312static int __devinit trident_register_gameport(struct trident_card *card)
4309trident_register_gameport(struct trident_card *card)
4310{ 4313{
4311 struct gameport *gp; 4314 struct gameport *gp;
4312 4315
@@ -4330,6 +4333,17 @@ trident_register_gameport(struct trident_card *card)
4330 return 0; 4333 return 0;
4331} 4334}
4332 4335
4336static inline void trident_unregister_gameport(struct trident_card *card)
4337{
4338 if (card->gameport)
4339 gameport_unregister_port(card->gameport);
4340}
4341
4342#else
4343static inline int trident_register_gameport(struct trident_card *card) { return -ENOSYS; }
4344static inline void trident_unregister_gameport(struct trident_card *card) { }
4345#endif /* SUPPORT_JOYSTICK */
4346
4333/* install the driver, we do not allocate hardware channel nor DMA buffer */ 4347/* install the driver, we do not allocate hardware channel nor DMA buffer */
4334/* now, they are defered until "ACCESS" time (in prog_dmabuf called by */ 4348/* now, they are defered until "ACCESS" time (in prog_dmabuf called by */
4335/* open/read/write/ioctl/mmap) */ 4349/* open/read/write/ioctl/mmap) */
@@ -4569,8 +4583,7 @@ trident_remove(struct pci_dev *pci_dev)
4569 } 4583 }
4570 4584
4571 /* Unregister gameport */ 4585 /* Unregister gameport */
4572 if (card->gameport) 4586 trident_unregister_gameport(card);
4573 gameport_unregister_port(card->gameport);
4574 4587
4575 /* Kill interrupts, and SP/DIF */ 4588 /* Kill interrupts, and SP/DIF */
4576 trident_disable_loop_interrupts(card); 4589 trident_disable_loop_interrupts(card);