Commit ba7376e9348eceda21884cda87e714093260aed2
1 parent
263aba711e
Exists in
master
and in
7 other branches
Input: sonicvibes (OSS) - do not carry around gameport code if gameport
core support is disabled. Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Showing 1 changed file with 20 additions and 5 deletions Side-by-side Diff
sound/oss/sonicvibes.c
... | ... | @@ -122,6 +122,9 @@ |
122 | 122 | |
123 | 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 | |
128 | 131 | |
... | ... | @@ -365,7 +368,9 @@ |
365 | 368 | unsigned char obuf[MIDIOUTBUF]; |
366 | 369 | } midi; |
367 | 370 | |
371 | +#if SUPPORT_JOYSTICK | |
368 | 372 | struct gameport *gameport; |
373 | +#endif | |
369 | 374 | }; |
370 | 375 | |
371 | 376 | /* --------------------------------------------------------------------- */ |
... | ... | @@ -2485,6 +2490,7 @@ |
2485 | 2490 | #define RSRCISIOREGION(dev,num) (pci_resource_start((dev), (num)) != 0 && \ |
2486 | 2491 | (pci_resource_flags((dev), (num)) & IORESOURCE_IO)) |
2487 | 2492 | |
2493 | +#ifdef SUPPORT_JOYSTICK | |
2488 | 2494 | static int __devinit sv_register_gameport(struct sv_state *s, int io_port) |
2489 | 2495 | { |
2490 | 2496 | struct gameport *gp; |
... | ... | @@ -2511,6 +2517,19 @@ |
2511 | 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 | 2533 | static int __devinit sv_probe(struct pci_dev *pcidev, const struct pci_device_id *pciid) |
2515 | 2534 | { |
2516 | 2535 | static char __devinitdata sv_ddma_name[] = "S3 Inc. SonicVibes DDMA Controller"; |
... | ... | @@ -2711,11 +2730,7 @@ |
2711 | 2730 | /*outb(0, s->iodmaa + SV_DMA_RESET);*/ |
2712 | 2731 | /*outb(0, s->iodmac + SV_DMA_RESET);*/ |
2713 | 2732 | free_irq(s->irq, s); |
2714 | - if (s->gameport) { | |
2715 | - int gpio = s->gameport->io; | |
2716 | - gameport_unregister_port(s->gameport); | |
2717 | - release_region(gpio, SV_EXTENT_GAME); | |
2718 | - } | |
2733 | + sv_unregister_gameport(s); | |
2719 | 2734 | release_region(s->iodmac, SV_EXTENT_DMA); |
2720 | 2735 | release_region(s->iodmaa, SV_EXTENT_DMA); |
2721 | 2736 | release_region(s->ioenh, SV_EXTENT_ENH); |