diff options
Diffstat (limited to 'sound/oss/sonicvibes.c')
-rw-r--r-- | sound/oss/sonicvibes.c | 25 |
1 files changed, 20 insertions, 5 deletions
diff --git a/sound/oss/sonicvibes.c b/sound/oss/sonicvibes.c index 06047e7979af..17d0e461f8d8 100644 --- a/sound/oss/sonicvibes.c +++ b/sound/oss/sonicvibes.c | |||
@@ -122,6 +122,9 @@ | |||
122 | 122 | ||
123 | #include "dm.h" | 123 | #include "dm.h" |
124 | 124 | ||
125 | #if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE)) | ||
126 | #define SUPPORT_JOYSTICK 1 | ||
127 | #endif | ||
125 | 128 | ||
126 | /* --------------------------------------------------------------------- */ | 129 | /* --------------------------------------------------------------------- */ |
127 | 130 | ||
@@ -365,7 +368,9 @@ struct sv_state { | |||
365 | unsigned char obuf[MIDIOUTBUF]; | 368 | unsigned char obuf[MIDIOUTBUF]; |
366 | } midi; | 369 | } midi; |
367 | 370 | ||
371 | #if SUPPORT_JOYSTICK | ||
368 | struct gameport *gameport; | 372 | struct gameport *gameport; |
373 | #endif | ||
369 | }; | 374 | }; |
370 | 375 | ||
371 | /* --------------------------------------------------------------------- */ | 376 | /* --------------------------------------------------------------------- */ |
@@ -2485,6 +2490,7 @@ static struct initvol { | |||
2485 | #define RSRCISIOREGION(dev,num) (pci_resource_start((dev), (num)) != 0 && \ | 2490 | #define RSRCISIOREGION(dev,num) (pci_resource_start((dev), (num)) != 0 && \ |
2486 | (pci_resource_flags((dev), (num)) & IORESOURCE_IO)) | 2491 | (pci_resource_flags((dev), (num)) & IORESOURCE_IO)) |
2487 | 2492 | ||
2493 | #ifdef SUPPORT_JOYSTICK | ||
2488 | static int __devinit sv_register_gameport(struct sv_state *s, int io_port) | 2494 | static int __devinit sv_register_gameport(struct sv_state *s, int io_port) |
2489 | { | 2495 | { |
2490 | struct gameport *gp; | 2496 | struct gameport *gp; |
@@ -2511,6 +2517,19 @@ static int __devinit sv_register_gameport(struct sv_state *s, int io_port) | |||
2511 | return 0; | 2517 | return 0; |
2512 | } | 2518 | } |
2513 | 2519 | ||
2520 | static inline void sv_unregister_gameport(struct sv_state *s) | ||
2521 | { | ||
2522 | if (s->gameport) { | ||
2523 | int gpio = s->gameport->io; | ||
2524 | gameport_unregister_port(s->gameport); | ||
2525 | release_region(gpio, SV_EXTENT_GAME); | ||
2526 | } | ||
2527 | } | ||
2528 | #else | ||
2529 | static inline int sv_register_gameport(struct sv_state *s, int io_port) { return -ENOSYS; } | ||
2530 | static inline void sv_unregister_gameport(struct sv_state *s) { } | ||
2531 | #endif /* SUPPORT_JOYSTICK */ | ||
2532 | |||
2514 | static int __devinit sv_probe(struct pci_dev *pcidev, const struct pci_device_id *pciid) | 2533 | static int __devinit sv_probe(struct pci_dev *pcidev, const struct pci_device_id *pciid) |
2515 | { | 2534 | { |
2516 | static char __devinitdata sv_ddma_name[] = "S3 Inc. SonicVibes DDMA Controller"; | 2535 | static char __devinitdata sv_ddma_name[] = "S3 Inc. SonicVibes DDMA Controller"; |
@@ -2711,11 +2730,7 @@ static void __devexit sv_remove(struct pci_dev *dev) | |||
2711 | /*outb(0, s->iodmaa + SV_DMA_RESET);*/ | 2730 | /*outb(0, s->iodmaa + SV_DMA_RESET);*/ |
2712 | /*outb(0, s->iodmac + SV_DMA_RESET);*/ | 2731 | /*outb(0, s->iodmac + SV_DMA_RESET);*/ |
2713 | free_irq(s->irq, s); | 2732 | free_irq(s->irq, s); |
2714 | if (s->gameport) { | 2733 | sv_unregister_gameport(s); |
2715 | int gpio = s->gameport->io; | ||
2716 | gameport_unregister_port(s->gameport); | ||
2717 | release_region(gpio, SV_EXTENT_GAME); | ||
2718 | } | ||
2719 | release_region(s->iodmac, SV_EXTENT_DMA); | 2734 | release_region(s->iodmac, SV_EXTENT_DMA); |
2720 | release_region(s->iodmaa, SV_EXTENT_DMA); | 2735 | release_region(s->iodmaa, SV_EXTENT_DMA); |
2721 | release_region(s->ioenh, SV_EXTENT_ENH); | 2736 | release_region(s->ioenh, SV_EXTENT_ENH); |