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 fb09065d07c8..a4ecab2f0522 100644
--- a/sound/oss/esssolo1.c
+++ b/sound/oss/esssolo1.c
@@ -150,6 +150,10 @@
150 150
151#define FMODE_DMFM 0x10 151#define FMODE_DMFM 0x10
152 152
153#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE))
154#define SUPPORT_JOYSTICK 1
155#endif
156
153static struct pci_driver solo1_driver; 157static struct pci_driver solo1_driver;
154 158
155/* --------------------------------------------------------------------- */ 159/* --------------------------------------------------------------------- */
@@ -227,7 +231,9 @@ struct solo1_state {
227 unsigned char obuf[MIDIOUTBUF]; 231 unsigned char obuf[MIDIOUTBUF];
228 } midi; 232 } midi;
229 233
234#if SUPPORT_JOYSTICK
230 struct gameport *gameport; 235 struct gameport *gameport;
236#endif
231}; 237};
232 238
233/* --------------------------------------------------------------------- */ 239/* --------------------------------------------------------------------- */
@@ -2281,6 +2287,7 @@ solo1_resume(struct pci_dev *pci_dev) {
2281 return 0; 2287 return 0;
2282} 2288}
2283 2289
2290#ifdef SUPPORT_JOYSTICK
2284static int __devinit solo1_register_gameport(struct solo1_state *s, int io_port) 2291static int __devinit solo1_register_gameport(struct solo1_state *s, int io_port)
2285{ 2292{
2286 struct gameport *gp; 2293 struct gameport *gp;
@@ -2307,6 +2314,19 @@ static int __devinit solo1_register_gameport(struct solo1_state *s, int io_port)
2307 return 0; 2314 return 0;
2308} 2315}
2309 2316
2317static inline void solo1_unregister_gameport(struct solo1_state *s)
2318{
2319 if (s->gameport) {
2320 int gpio = s->gameport->io;
2321 gameport_unregister_port(s->gameport);
2322 release_region(gpio, GAMEPORT_EXTENT);
2323 }
2324}
2325#else
2326static inline int solo1_register_gameport(struct solo1_state *s, int io_port) { return -ENOSYS; }
2327static inline void solo1_unregister_gameport(struct solo1_state *s) { }
2328#endif /* SUPPORT_JOYSTICK */
2329
2310static int __devinit solo1_probe(struct pci_dev *pcidev, const struct pci_device_id *pciid) 2330static int __devinit solo1_probe(struct pci_dev *pcidev, const struct pci_device_id *pciid)
2311{ 2331{
2312 struct solo1_state *s; 2332 struct solo1_state *s;
@@ -2438,11 +2458,7 @@ static void __devexit solo1_remove(struct pci_dev *dev)
2438 synchronize_irq(s->irq); 2458 synchronize_irq(s->irq);
2439 pci_write_config_word(s->dev, 0x60, 0); /* turn off DDMA controller address space */ 2459 pci_write_config_word(s->dev, 0x60, 0); /* turn off DDMA controller address space */
2440 free_irq(s->irq, s); 2460 free_irq(s->irq, s);
2441 if (s->gameport) { 2461 solo1_unregister_gameport(s);
2442 int gpio = s->gameport->io;
2443 gameport_unregister_port(s->gameport);
2444 release_region(gpio, GAMEPORT_EXTENT);
2445 }
2446 release_region(s->iobase, IOBASE_EXTENT); 2462 release_region(s->iobase, IOBASE_EXTENT);
2447 release_region(s->sbbase+FMSYNTH_EXTENT, SBBASE_EXTENT-FMSYNTH_EXTENT); 2463 release_region(s->sbbase+FMSYNTH_EXTENT, SBBASE_EXTENT-FMSYNTH_EXTENT);
2448 release_region(s->ddmabase, DDMABASE_EXTENT); 2464 release_region(s->ddmabase, DDMABASE_EXTENT);