Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 3539
b: refs/heads/master
c: ba7376e
h: refs/heads/master
i:
  3537: 23e4b1b
  3535: fb81824
v: v3
  • Loading branch information
Dmitry Torokhov committed Jun 1, 2005
1 parent 5fef60a commit c076231
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 263aba711eabd4b63b70dfe8f78e3a8a7ce65fa9
refs/heads/master: ba7376e9348eceda21884cda87e714093260aed2
25 changes: 20 additions & 5 deletions trunk/sound/oss/sonicvibes.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@

#include "dm.h"

#if defined(CONFIG_GAMEPORT) || (defined(MODULE) && defined(CONFIG_GAMEPORT_MODULE))
#define SUPPORT_JOYSTICK 1
#endif

/* --------------------------------------------------------------------- */

Expand Down Expand Up @@ -365,7 +368,9 @@ struct sv_state {
unsigned char obuf[MIDIOUTBUF];
} midi;

#if SUPPORT_JOYSTICK
struct gameport *gameport;
#endif
};

/* --------------------------------------------------------------------- */
Expand Down Expand Up @@ -2485,6 +2490,7 @@ static struct initvol {
#define RSRCISIOREGION(dev,num) (pci_resource_start((dev), (num)) != 0 && \
(pci_resource_flags((dev), (num)) & IORESOURCE_IO))

#ifdef SUPPORT_JOYSTICK
static int __devinit sv_register_gameport(struct sv_state *s, int io_port)
{
struct gameport *gp;
Expand All @@ -2511,6 +2517,19 @@ static int __devinit sv_register_gameport(struct sv_state *s, int io_port)
return 0;
}

static inline void sv_unregister_gameport(struct sv_state *s)
{
if (s->gameport) {
int gpio = s->gameport->io;
gameport_unregister_port(s->gameport);
release_region(gpio, SV_EXTENT_GAME);
}
}
#else
static inline int sv_register_gameport(struct sv_state *s, int io_port) { return -ENOSYS; }
static inline void sv_unregister_gameport(struct sv_state *s) { }
#endif /* SUPPORT_JOYSTICK */

static int __devinit sv_probe(struct pci_dev *pcidev, const struct pci_device_id *pciid)
{
static char __devinitdata sv_ddma_name[] = "S3 Inc. SonicVibes DDMA Controller";
Expand Down Expand Up @@ -2711,11 +2730,7 @@ static void __devexit sv_remove(struct pci_dev *dev)
/*outb(0, s->iodmaa + SV_DMA_RESET);*/
/*outb(0, s->iodmac + SV_DMA_RESET);*/
free_irq(s->irq, s);
if (s->gameport) {
int gpio = s->gameport->io;
gameport_unregister_port(s->gameport);
release_region(gpio, SV_EXTENT_GAME);
}
sv_unregister_gameport(s);
release_region(s->iodmac, SV_EXTENT_DMA);
release_region(s->iodmaa, SV_EXTENT_DMA);
release_region(s->ioenh, SV_EXTENT_ENH);
Expand Down

0 comments on commit c076231

Please sign in to comment.