aboutsummaryrefslogtreecommitdiffstats
path: root/sound/oss/esssolo1.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/oss/esssolo1.c')
-rw-r--r--sound/oss/esssolo1.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/sound/oss/esssolo1.c b/sound/oss/esssolo1.c
index 6b3b9a99579d..a682ab1242cc 100644
--- a/sound/oss/esssolo1.c
+++ b/sound/oss/esssolo1.c
@@ -149,6 +149,10 @@
149 149
150#define FMODE_DMFM 0x10 150#define FMODE_DMFM 0x10
151 151
152#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE))
153#define SUPPORT_JOYSTICK 1
154#endif
155
152static struct pci_driver solo1_driver; 156static struct pci_driver solo1_driver;
153 157
154/* --------------------------------------------------------------------- */ 158/* --------------------------------------------------------------------- */
@@ -226,7 +230,9 @@ struct solo1_state {
226 unsigned char obuf[MIDIOUTBUF]; 230 unsigned char obuf[MIDIOUTBUF];
227 } midi; 231 } midi;
228 232
233#if SUPPORT_JOYSTICK
229 struct gameport *gameport; 234 struct gameport *gameport;
235#endif
230}; 236};
231 237
232/* --------------------------------------------------------------------- */ 238/* --------------------------------------------------------------------- */
@@ -2280,6 +2286,7 @@ solo1_resume(struct pci_dev *pci_dev) {
2280 return 0; 2286 return 0;
2281} 2287}
2282 2288
2289#ifdef SUPPORT_JOYSTICK
2283static int __devinit solo1_register_gameport(struct solo1_state *s, int io_port) 2290static int __devinit solo1_register_gameport(struct solo1_state *s, int io_port)
2284{ 2291{
2285 struct gameport *gp; 2292 struct gameport *gp;
@@ -2306,6 +2313,19 @@ static int __devinit solo1_register_gameport(struct solo1_state *s, int io_port)
2306 return 0; 2313 return 0;
2307} 2314}
2308 2315
2316static inline void solo1_unregister_gameport(struct solo1_state *s)
2317{
2318 if (s->gameport) {
2319 int gpio = s->gameport->io;
2320 gameport_unregister_port(s->gameport);
2321 release_region(gpio, GAMEPORT_EXTENT);
2322 }
2323}
2324#else
2325static inline int solo1_register_gameport(struct solo1_state *s, int io_port) { return -ENOSYS; }
2326static inline void solo1_unregister_gameport(struct solo1_state *s) { }
2327#endif /* SUPPORT_JOYSTICK */
2328
2309static int __devinit solo1_probe(struct pci_dev *pcidev, const struct pci_device_id *pciid) 2329static int __devinit solo1_probe(struct pci_dev *pcidev, const struct pci_device_id *pciid)
2310{ 2330{
2311 struct solo1_state *s; 2331 struct solo1_state *s;
@@ -2437,11 +2457,7 @@ static void __devexit solo1_remove(struct pci_dev *dev)
2437 synchronize_irq(s->irq); 2457 synchronize_irq(s->irq);
2438 pci_write_config_word(s->dev, 0x60, 0); /* turn off DDMA controller address space */ 2458 pci_write_config_word(s->dev, 0x60, 0); /* turn off DDMA controller address space */
2439 free_irq(s->irq, s); 2459 free_irq(s->irq, s);
2440 if (s->gameport) { 2460 solo1_unregister_gameport(s);
2441 int gpio = s->gameport->io;
2442 gameport_unregister_port(s->gameport);
2443 release_region(gpio, GAMEPORT_EXTENT);
2444 }
2445 release_region(s->iobase, IOBASE_EXTENT); 2461 release_region(s->iobase, IOBASE_EXTENT);
2446 release_region(s->sbbase+FMSYNTH_EXTENT, SBBASE_EXTENT-FMSYNTH_EXTENT); 2462 release_region(s->sbbase+FMSYNTH_EXTENT, SBBASE_EXTENT-FMSYNTH_EXTENT);
2447 release_region(s->ddmabase, DDMABASE_EXTENT); 2463 release_region(s->ddmabase, DDMABASE_EXTENT);