summaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2005-10-04 08:46:51 +0200
committerJaroslav Kysela <perex@suse.cz>2005-11-04 13:17:16 +0100
commitb7fe46220487f684abc858865cff817389af5c76 (patch)
treed1eabbbdd0f686c87996133fd22ce2327da638c1 /sound/pci
parent4b0940f8117b6cdf7e7c27bdecc29931f18c81ed (diff)
downloadop-kernel-dev-b7fe46220487f684abc858865cff817389af5c76.zip
op-kernel-dev-b7fe46220487f684abc858865cff817389af5c76.tar.gz
[ALSA] highlanderize motherboard AC97/HDA drivers
Remove the code for supporting eight cards from the integrated controller drivers because There Can Be Only One controller of each type per mainboard. Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/atiixp.c42
-rw-r--r--sound/pci/atiixp_modem.c28
-rw-r--r--sound/pci/hda/hda_intel.c34
-rw-r--r--sound/pci/intel8x0.c58
-rw-r--r--sound/pci/intel8x0m.c28
-rw-r--r--sound/pci/via82xx.c103
-rw-r--r--sound/pci/via82xx_modem.c29
7 files changed, 119 insertions, 203 deletions
diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c
index cb17411..332a71d 100644
--- a/sound/pci/atiixp.c
+++ b/sound/pci/atiixp.c
@@ -39,24 +39,21 @@ MODULE_DESCRIPTION("ATI IXP AC97 controller");
MODULE_LICENSE("GPL");
MODULE_SUPPORTED_DEVICE("{{ATI,IXP150/200/250/300/400}}");
-static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
-static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
-static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
-static int ac97_clock[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 48000};
-static char *ac97_quirk[SNDRV_CARDS];
-static int spdif_aclink[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};
-
-module_param_array(index, int, NULL, 0444);
+static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */
+static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */
+static int ac97_clock = 48000;
+static char *ac97_quirk;
+static int spdif_aclink = 1;
+
+module_param(index, int, 0444);
MODULE_PARM_DESC(index, "Index value for ATI IXP controller.");
-module_param_array(id, charp, NULL, 0444);
+module_param(id, charp, 0444);
MODULE_PARM_DESC(id, "ID string for ATI IXP controller.");
-module_param_array(enable, bool, NULL, 0444);
-MODULE_PARM_DESC(enable, "Enable audio part of ATI IXP controller.");
-module_param_array(ac97_clock, int, NULL, 0444);
+module_param(ac97_clock, int, 0444);
MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (default 48000Hz).");
-module_param_array(ac97_quirk, charp, NULL, 0444);
+module_param(ac97_quirk, charp, 0444);
MODULE_PARM_DESC(ac97_quirk, "AC'97 workaround for strange hardware.");
-module_param_array(spdif_aclink, bool, NULL, 0444);
+module_param(spdif_aclink, bool, 0444);
MODULE_PARM_DESC(spdif_aclink, "S/PDIF over AC-link.");
@@ -1578,26 +1575,18 @@ static int __devinit snd_atiixp_create(snd_card_t *card,
static int __devinit snd_atiixp_probe(struct pci_dev *pci,
const struct pci_device_id *pci_id)
{
- static int dev;
snd_card_t *card;
atiixp_t *chip;
unsigned char revision;
int err;
- if (dev >= SNDRV_CARDS)
- return -ENODEV;
- if (!enable[dev]) {
- dev++;
- return -ENOENT;
- }
-
- card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);
+ card = snd_card_new(index, id, THIS_MODULE, 0);
if (card == NULL)
return -ENOMEM;
pci_read_config_byte(pci, PCI_REVISION_ID, &revision);
- strcpy(card->driver, spdif_aclink[dev] ? "ATIIXP" : "ATIIXP-SPDMA");
+ strcpy(card->driver, spdif_aclink ? "ATIIXP" : "ATIIXP-SPDMA");
strcpy(card->shortname, "ATI IXP");
if ((err = snd_atiixp_create(card, pci, &chip)) < 0)
goto __error;
@@ -1605,9 +1594,9 @@ static int __devinit snd_atiixp_probe(struct pci_dev *pci,
if ((err = snd_atiixp_aclink_reset(chip)) < 0)
goto __error;
- chip->spdif_over_aclink = spdif_aclink[dev];
+ chip->spdif_over_aclink = spdif_aclink;
- if ((err = snd_atiixp_mixer_new(chip, ac97_clock[dev], ac97_quirk[dev])) < 0)
+ if ((err = snd_atiixp_mixer_new(chip, ac97_clock, ac97_quirk)) < 0)
goto __error;
if ((err = snd_atiixp_pcm_new(chip)) < 0)
@@ -1628,7 +1617,6 @@ static int __devinit snd_atiixp_probe(struct pci_dev *pci,
goto __error;
pci_set_drvdata(pci, card);
- dev++;
return 0;
__error:
diff --git a/sound/pci/atiixp_modem.c b/sound/pci/atiixp_modem.c
index a88a6f3..a4778d3 100644
--- a/sound/pci/atiixp_modem.c
+++ b/sound/pci/atiixp_modem.c
@@ -39,18 +39,15 @@ MODULE_DESCRIPTION("ATI IXP MC97 controller");
MODULE_LICENSE("GPL");
MODULE_SUPPORTED_DEVICE("{{ATI,IXP150/200/250}}");
-static int index[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = -2}; /* Exclude the first card */
-static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
-static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
-static int ac97_clock[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 48000};
+static int index = -2; /* Exclude the first card */
+static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */
+static int ac97_clock = 48000;
-module_param_array(index, int, NULL, 0444);
+module_param(index, int, 0444);
MODULE_PARM_DESC(index, "Index value for ATI IXP controller.");
-module_param_array(id, charp, NULL, 0444);
+module_param(id, charp, 0444);
MODULE_PARM_DESC(id, "ID string for ATI IXP controller.");
-module_param_array(enable, bool, NULL, 0444);
-MODULE_PARM_DESC(enable, "Enable audio part of ATI IXP controller.");
-module_param_array(ac97_clock, int, NULL, 0444);
+module_param(ac97_clock, int, 0444);
MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (default 48000Hz).");
@@ -1256,20 +1253,12 @@ static int __devinit snd_atiixp_create(snd_card_t *card,
static int __devinit snd_atiixp_probe(struct pci_dev *pci,
const struct pci_device_id *pci_id)
{
- static int dev;
snd_card_t *card;
atiixp_t *chip;
unsigned char revision;
int err;
- if (dev >= SNDRV_CARDS)
- return -ENODEV;
- if (!enable[dev]) {
- dev++;
- return -ENOENT;
- }
-
- card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);
+ card = snd_card_new(index, id, THIS_MODULE, 0);
if (card == NULL)
return -ENOMEM;
@@ -1283,7 +1272,7 @@ static int __devinit snd_atiixp_probe(struct pci_dev *pci,
if ((err = snd_atiixp_aclink_reset(chip)) < 0)
goto __error;
- if ((err = snd_atiixp_mixer_new(chip, ac97_clock[dev])) < 0)
+ if ((err = snd_atiixp_mixer_new(chip, ac97_clock)) < 0)
goto __error;
if ((err = snd_atiixp_pcm_new(chip)) < 0)
@@ -1302,7 +1291,6 @@ static int __devinit snd_atiixp_probe(struct pci_dev *pci,
goto __error;
pci_set_drvdata(pci, card);
- dev++;
return 0;
__error:
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index faf9dd0..d9e88df 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -47,21 +47,18 @@
#include "hda_codec.h"
-static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
-static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
-static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
-static char *model[SNDRV_CARDS];
-static int position_fix[SNDRV_CARDS];
+static int index = SNDRV_DEFAULT_IDX1;
+static char *id = SNDRV_DEFAULT_STR1;
+static char *model;
+static int position_fix;
-module_param_array(index, int, NULL, 0444);
+module_param(index, int, 0444);
MODULE_PARM_DESC(index, "Index value for Intel HD audio interface.");
-module_param_array(id, charp, NULL, 0444);
+module_param(id, charp, 0444);
MODULE_PARM_DESC(id, "ID string for Intel HD audio interface.");
-module_param_array(enable, bool, NULL, 0444);
-MODULE_PARM_DESC(enable, "Enable Intel HD audio interface.");
-module_param_array(model, charp, NULL, 0444);
+module_param(model, charp, 0444);
MODULE_PARM_DESC(model, "Use the given board model.");
-module_param_array(position_fix, int, NULL, 0444);
+module_param(position_fix, int, 0444);
MODULE_PARM_DESC(position_fix, "Fix DMA pointer (0 = auto, 1 = none, 2 = POSBUF, 3 = FIFO size).");
MODULE_LICENSE("GPL");
@@ -1544,32 +1541,24 @@ static int __devinit azx_create(snd_card_t *card, struct pci_dev *pci,
static int __devinit azx_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
{
- static int dev;
snd_card_t *card;
azx_t *chip;
int err = 0;
- if (dev >= SNDRV_CARDS)
- return -ENODEV;
- if (! enable[dev]) {
- dev++;
- return -ENOENT;
- }
-
- card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);
+ card = snd_card_new(index, id, THIS_MODULE, 0);
if (NULL == card) {
snd_printk(KERN_ERR SFX "Error creating card!\n");
return -ENOMEM;
}
- if ((err = azx_create(card, pci, position_fix[dev], pci_id->driver_data,
+ if ((err = azx_create(card, pci, position_fix, pci_id->driver_data,
&chip)) < 0) {
snd_card_free(card);
return err;
}
/* create codec instances */
- if ((err = azx_codec_create(chip, model[dev])) < 0) {
+ if ((err = azx_codec_create(chip, model)) < 0) {
snd_card_free(card);
return err;
}
@@ -1595,7 +1584,6 @@ static int __devinit azx_probe(struct pci_dev *pci, const struct pci_device_id *
}
pci_set_drvdata(pci, card);
- dev++;
return err;
}
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
index 0d11cf7..bd9563c 100644
--- a/sound/pci/intel8x0.c
+++ b/sound/pci/intel8x0.c
@@ -64,34 +64,27 @@ MODULE_SUPPORTED_DEVICE("{{Intel,82801AA-ICH},"
"{AMD,AMD8111},"
"{ALI,M5455}}");
-static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
-static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
-static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
-static int ac97_clock[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0};
-static char *ac97_quirk[SNDRV_CARDS];
-static int buggy_semaphore[SNDRV_CARDS];
-static int buggy_irq[SNDRV_CARDS];
-static int xbox[SNDRV_CARDS];
-
-#ifdef SUPPORT_MIDI
-static int mpu_port[SNDRV_CARDS]; /* disabled */
-#endif
-
-module_param_array(index, int, NULL, 0444);
+static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */
+static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */
+static int ac97_clock = 0;
+static char *ac97_quirk;
+static int buggy_semaphore;
+static int buggy_irq;
+static int xbox;
+
+module_param(index, int, 0444);
MODULE_PARM_DESC(index, "Index value for Intel i8x0 soundcard.");
-module_param_array(id, charp, NULL, 0444);
+module_param(id, charp, 0444);
MODULE_PARM_DESC(id, "ID string for Intel i8x0 soundcard.");
-module_param_array(enable, bool, NULL, 0444);
-MODULE_PARM_DESC(enable, "Enable Intel i8x0 soundcard.");
-module_param_array(ac97_clock, int, NULL, 0444);
+module_param(ac97_clock, int, 0444);
MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (0 = auto-detect).");
-module_param_array(ac97_quirk, charp, NULL, 0444);
+module_param(ac97_quirk, charp, 0444);
MODULE_PARM_DESC(ac97_quirk, "AC'97 workaround for strange hardware.");
-module_param_array(buggy_semaphore, bool, NULL, 0444);
+module_param(buggy_semaphore, bool, 0444);
MODULE_PARM_DESC(buggy_semaphore, "Enable workaround for hardwares with problematic codec semaphores.");
-module_param_array(buggy_irq, bool, NULL, 0444);
+module_param(buggy_irq, bool, 0444);
MODULE_PARM_DESC(buggy_irq, "Enable workaround for buggy interrupts on some motherboards.");
-module_param_array(xbox, bool, NULL, 0444);
+module_param(xbox, bool, 0444);
MODULE_PARM_DESC(xbox, "Set to 1 for Xbox, if you have problems with the AC'97 codec detection.");
/*
@@ -2781,20 +2774,12 @@ static struct shortname_table {
static int __devinit snd_intel8x0_probe(struct pci_dev *pci,
const struct pci_device_id *pci_id)
{
- static int dev;
snd_card_t *card;
intel8x0_t *chip;
int err;
struct shortname_table *name;
- if (dev >= SNDRV_CARDS)
- return -ENODEV;
- if (!enable[dev]) {
- dev++;
- return -ENOENT;
- }
-
- card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);
+ card = snd_card_new(index, id, THIS_MODULE, 0);
if (card == NULL)
return -ENOMEM;
@@ -2819,16 +2804,16 @@ static int __devinit snd_intel8x0_probe(struct pci_dev *pci,
}
if ((err = snd_intel8x0_create(card, pci, pci_id->driver_data,
- buggy_semaphore[dev], &chip)) < 0) {
+ buggy_semaphore, &chip)) < 0) {
snd_card_free(card);
return err;
}
- if (buggy_irq[dev])
+ if (buggy_irq)
chip->buggy_irq = 1;
- if (xbox[dev])
+ if (xbox)
chip->xbox = 1;
- if ((err = snd_intel8x0_mixer(chip, ac97_clock[dev], ac97_quirk[dev])) < 0) {
+ if ((err = snd_intel8x0_mixer(chip, ac97_clock, ac97_quirk)) < 0) {
snd_card_free(card);
return err;
}
@@ -2843,7 +2828,7 @@ static int __devinit snd_intel8x0_probe(struct pci_dev *pci,
"%s with %s at %#lx, irq %i", card->shortname,
snd_ac97_get_short_name(chip->ac97[0]), chip->addr, chip->irq);
- if (! ac97_clock[dev])
+ if (! ac97_clock)
intel8x0_measure_ac97_clock(chip);
if ((err = snd_card_register(card)) < 0) {
@@ -2851,7 +2836,6 @@ static int __devinit snd_intel8x0_probe(struct pci_dev *pci,
return err;
}
pci_set_drvdata(pci, card);
- dev++;
return 0;
}
diff --git a/sound/pci/intel8x0m.c b/sound/pci/intel8x0m.c
index 15364d2..be604bb 100644
--- a/sound/pci/intel8x0m.c
+++ b/sound/pci/intel8x0m.c
@@ -56,18 +56,15 @@ MODULE_SUPPORTED_DEVICE("{{Intel,82801AA-ICH},"
"{NVidia,NForce3 Modem},"
"{AMD,AMD768}}");
-static int index[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = -2}; /* Exclude the first card */
-static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
-static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
-static int ac97_clock[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0};
+static int index = -2; /* Exclude the first card */
+static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */
+static int ac97_clock = 0;
-module_param_array(index, int, NULL, 0444);
+module_param(index, int, 0444);
MODULE_PARM_DESC(index, "Index value for Intel i8x0 modemcard.");
-module_param_array(id, charp, NULL, 0444);
+module_param(id, charp, 0444);
MODULE_PARM_DESC(id, "ID string for Intel i8x0 modemcard.");
-module_param_array(enable, bool, NULL, 0444);
-MODULE_PARM_DESC(enable, "Enable Intel i8x0 modemcard.");
-module_param_array(ac97_clock, int, NULL, 0444);
+module_param(ac97_clock, int, 0444);
MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (0 = auto-detect).");
/*
@@ -1263,20 +1260,12 @@ static struct shortname_table {
static int __devinit snd_intel8x0m_probe(struct pci_dev *pci,
const struct pci_device_id *pci_id)
{
- static int dev;
snd_card_t *card;
intel8x0_t *chip;
int err;
struct shortname_table *name;
- if (dev >= SNDRV_CARDS)
- return -ENODEV;
- if (!enable[dev]) {
- dev++;
- return -ENOENT;
- }
-
- card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);
+ card = snd_card_new(index, id, THIS_MODULE, 0);
if (card == NULL)
return -ENOMEM;
@@ -1295,7 +1284,7 @@ static int __devinit snd_intel8x0m_probe(struct pci_dev *pci,
return err;
}
- if ((err = snd_intel8x0_mixer(chip, ac97_clock[dev])) < 0) {
+ if ((err = snd_intel8x0_mixer(chip, ac97_clock)) < 0) {
snd_card_free(card);
return err;
}
@@ -1314,7 +1303,6 @@ static int __devinit snd_intel8x0m_probe(struct pci_dev *pci,
return err;
}
pci_set_drvdata(pci, card);
- dev++;
return 0;
}
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c
index ecc4836..4545208 100644
--- a/sound/pci/via82xx.c
+++ b/sound/pci/via82xx.c
@@ -73,34 +73,31 @@ MODULE_SUPPORTED_DEVICE("{{VIA,VT82C686A/B/C,pci},{VIA,VT8233A/C,8235}}");
#define SUPPORT_JOYSTICK 1
#endif
-static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
-static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
-static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
-static long mpu_port[SNDRV_CARDS];
+static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */
+static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */
+static long mpu_port;
#ifdef SUPPORT_JOYSTICK
-static int joystick[SNDRV_CARDS];
+static int joystick;
#endif
-static int ac97_clock[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 48000};
-static char *ac97_quirk[SNDRV_CARDS];
-static int dxs_support[SNDRV_CARDS];
+static int ac97_clock = 48000;
+static char *ac97_quirk;
+static int dxs_support;
-module_param_array(index, int, NULL, 0444);
+module_param(index, int, 0444);
MODULE_PARM_DESC(index, "Index value for VIA 82xx bridge.");
-module_param_array(id, charp, NULL, 0444);
+module_param(id, charp, 0444);
MODULE_PARM_DESC(id, "ID string for VIA 82xx bridge.");
-module_param_array(enable, bool, NULL, 0444);
-MODULE_PARM_DESC(enable, "Enable audio part of VIA 82xx bridge.");
-module_param_array(mpu_port, long, NULL, 0444);
+module_param(mpu_port, long, 0444);
MODULE_PARM_DESC(mpu_port, "MPU-401 port. (VT82C686x only)");
#ifdef SUPPORT_JOYSTICK
-module_param_array(joystick, bool, NULL, 0444);
+module_param(joystick, bool, 0444);
MODULE_PARM_DESC(joystick, "Enable joystick. (VT82C686x only)");
#endif
-module_param_array(ac97_clock, int, NULL, 0444);
+module_param(ac97_clock, int, 0444);
MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (default 48000Hz).");
-module_param_array(ac97_quirk, charp, NULL, 0444);
+module_param(ac97_quirk, charp, 0444);
MODULE_PARM_DESC(ac97_quirk, "AC'97 workaround for strange hardware.");
-module_param_array(dxs_support, int, NULL, 0444);
+module_param(dxs_support, int, 0444);
MODULE_PARM_DESC(dxs_support, "Support for DXS channels (0 = auto, 1 = enable, 2 = disable, 3 = 48k only, 4 = no VRA, 5 = enable any sample rate)");
@@ -1637,12 +1634,12 @@ static int __devinit snd_via82xx_mixer_new(via82xx_t *chip, const char *quirk_ov
#ifdef SUPPORT_JOYSTICK
#define JOYSTICK_ADDR 0x200
-static int __devinit snd_via686_create_gameport(via82xx_t *chip, int dev, unsigned char *legacy)
+static int __devinit snd_via686_create_gameport(via82xx_t *chip, unsigned char *legacy)
{
struct gameport *gp;
struct resource *r;
- if (!joystick[dev])
+ if (!joystick)
return -ENODEV;
r = request_region(JOYSTICK_ADDR, 8, "VIA686 gameport");
@@ -1686,7 +1683,7 @@ static void snd_via686_free_gameport(via82xx_t *chip)
}
}
#else
-static inline int snd_via686_create_gameport(via82xx_t *chip, int dev, unsigned char *legacy)
+static inline int snd_via686_create_gameport(via82xx_t *chip, unsigned char *legacy)
{
return -ENOSYS;
}
@@ -1698,7 +1695,7 @@ static inline void snd_via686_free_gameport(via82xx_t *chip) { }
*
*/
-static int __devinit snd_via8233_init_misc(via82xx_t *chip, int dev)
+static int __devinit snd_via8233_init_misc(via82xx_t *chip)
{
int i, err, caps;
unsigned char val;
@@ -1739,7 +1736,7 @@ static int __devinit snd_via8233_init_misc(via82xx_t *chip, int dev)
return 0;
}
-static int __devinit snd_via686_init_misc(via82xx_t *chip, int dev)
+static int __devinit snd_via686_init_misc(via82xx_t *chip)
{
unsigned char legacy, legacy_cfg;
int rev_h = 0;
@@ -1750,32 +1747,33 @@ static int __devinit snd_via686_init_misc(via82xx_t *chip, int dev)
legacy &= ~VIA_FUNC_ENABLE_GAME; /* disable joystick */
if (chip->revision >= VIA_REV_686_H) {
rev_h = 1;
- if (mpu_port[dev] >= 0x200) { /* force MIDI */
- mpu_port[dev] &= 0xfffc;
- pci_write_config_dword(chip->pci, 0x18, mpu_port[dev] | 0x01);
+ if (mpu_port >= 0x200) { /* force MIDI */
+ mpu_port &= 0xfffc;
+ pci_write_config_dword(chip->pci, 0x18, mpu_port | 0x01);
#ifdef CONFIG_PM
- chip->mpu_port_saved = mpu_port[dev];
+ chip->mpu_port_saved = mpu_port;
#endif
} else {
- mpu_port[dev] = pci_resource_start(chip->pci, 2);
+ mpu_port = pci_resource_start(chip->pci, 2);
}
} else {
- switch (mpu_port[dev]) { /* force MIDI */
+ switch (mpu_port) { /* force MIDI */
case 0x300:
case 0x310:
case 0x320:
case 0x330:
legacy_cfg &= ~(3 << 2);
- legacy_cfg |= (mpu_port[dev] & 0x0030) >> 2;
+ legacy_cfg |= (mpu_port & 0x0030) >> 2;
break;
default: /* no, use BIOS settings */
if (legacy & VIA_FUNC_ENABLE_MIDI)
- mpu_port[dev] = 0x300 + ((legacy_cfg & 0x000c) << 2);
+ mpu_port = 0x300 + ((legacy_cfg & 0x000c) << 2);
break;
}
}
- if (mpu_port[dev] >= 0x200 &&
- (chip->mpu_res = request_region(mpu_port[dev], 2, "VIA82xx MPU401")) != NULL) {
+ if (mpu_port >= 0x200 &&
+ (chip->mpu_res = request_region(mpu_port, 2, "VIA82xx MPU401"))
+ != NULL) {
if (rev_h)
legacy |= VIA_FUNC_MIDI_PNP; /* enable PCI I/O 2 */
legacy |= VIA_FUNC_ENABLE_MIDI;
@@ -1783,16 +1781,17 @@ static int __devinit snd_via686_init_misc(via82xx_t *chip, int dev)
if (rev_h)
legacy &= ~VIA_FUNC_MIDI_PNP; /* disable PCI I/O 2 */
legacy &= ~VIA_FUNC_ENABLE_MIDI;
- mpu_port[dev] = 0;
+ mpu_port = 0;
}
pci_write_config_byte(chip->pci, VIA_FUNC_ENABLE, legacy);
pci_write_config_byte(chip->pci, VIA_PNP_CONTROL, legacy_cfg);
if (chip->mpu_res) {
if (snd_mpu401_uart_new(chip->card, 0, MPU401_HW_VIA686A,
- mpu_port[dev], 1,
+ mpu_port, 1,
chip->irq, 0, &chip->rmidi) < 0) {
- printk(KERN_WARNING "unable to initialize MPU-401 at 0x%lx, skipping\n", mpu_port[dev]);
+ printk(KERN_WARNING "unable to initialize MPU-401"
+ " at 0x%lx, skipping\n", mpu_port);
legacy &= ~VIA_FUNC_ENABLE_MIDI;
} else {
legacy &= ~VIA_FUNC_MIDI_IRQMASK; /* enable MIDI interrupt */
@@ -1800,7 +1799,7 @@ static int __devinit snd_via686_init_misc(via82xx_t *chip, int dev)
pci_write_config_byte(chip->pci, VIA_FUNC_ENABLE, legacy);
}
- snd_via686_create_gameport(chip, dev, &legacy);
+ snd_via686_create_gameport(chip, &legacy);
#ifdef CONFIG_PM
chip->legacy_saved = legacy;
@@ -2221,7 +2220,6 @@ static int __devinit check_dxs_list(struct pci_dev *pci)
static int __devinit snd_via82xx_probe(struct pci_dev *pci,
const struct pci_device_id *pci_id)
{
- static int dev;
snd_card_t *card;
via82xx_t *chip;
unsigned char revision;
@@ -2229,14 +2227,7 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci,
unsigned int i;
int err;
- if (dev >= SNDRV_CARDS)
- return -ENODEV;
- if (!enable[dev]) {
- dev++;
- return -ENOENT;
- }
-
- card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);
+ card = snd_card_new(index, id, THIS_MODULE, 0);
if (card == NULL)
return -ENOMEM;
@@ -2259,12 +2250,12 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci,
}
}
if (chip_type != TYPE_VIA8233A) {
- if (dxs_support[dev] == VIA_DXS_AUTO)
- dxs_support[dev] = check_dxs_list(pci);
+ if (dxs_support == VIA_DXS_AUTO)
+ dxs_support = check_dxs_list(pci);
/* force to use VIA8233 or 8233A model according to
* dxs_support module option
*/
- if (dxs_support[dev] == VIA_DXS_DISABLE)
+ if (dxs_support == VIA_DXS_DISABLE)
chip_type = TYPE_VIA8233A;
else
chip_type = TYPE_VIA8233;
@@ -2282,14 +2273,15 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci,
goto __error;
}
- if ((err = snd_via82xx_create(card, pci, chip_type, revision, ac97_clock[dev], &chip)) < 0)
+ if ((err = snd_via82xx_create(card, pci, chip_type, revision,
+ ac97_clock, &chip)) < 0)
goto __error;
- if ((err = snd_via82xx_mixer_new(chip, ac97_quirk[dev])) < 0)
+ if ((err = snd_via82xx_mixer_new(chip, ac97_quirk)) < 0)
goto __error;
if (chip_type == TYPE_VIA686) {
if ((err = snd_via686_pcm_new(chip)) < 0 ||
- (err = snd_via686_init_misc(chip, dev)) < 0)
+ (err = snd_via686_init_misc(chip)) < 0)
goto __error;
} else {
if (chip_type == TYPE_VIA8233A) {
@@ -2299,16 +2291,16 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci,
} else {
if ((err = snd_via8233_pcm_new(chip)) < 0)
goto __error;
- if (dxs_support[dev] == VIA_DXS_48K)
+ if (dxs_support == VIA_DXS_48K)
chip->dxs_fixed = 1;
- else if (dxs_support[dev] == VIA_DXS_NO_VRA)
+ else if (dxs_support == VIA_DXS_NO_VRA)
chip->no_vra = 1;
- else if (dxs_support[dev] == VIA_DXS_SRC) {
+ else if (dxs_support == VIA_DXS_SRC) {
chip->no_vra = 1;
chip->dxs_src = 1;
}
}
- if ((err = snd_via8233_init_misc(chip, dev)) < 0)
+ if ((err = snd_via8233_init_misc(chip)) < 0)
goto __error;
}
@@ -2329,7 +2321,6 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci,
return err;
}
pci_set_drvdata(pci, card);
- dev++;
return 0;
__error:
diff --git a/sound/pci/via82xx_modem.c b/sound/pci/via82xx_modem.c
index c3ab8fb..a7a60d8 100644
--- a/sound/pci/via82xx_modem.c
+++ b/sound/pci/via82xx_modem.c
@@ -55,18 +55,15 @@ MODULE_DESCRIPTION("VIA VT82xx modem");
MODULE_LICENSE("GPL");
MODULE_SUPPORTED_DEVICE("{{VIA,VT82C686A/B/C modem,pci}}");
-static int index[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = -2}; /* Exclude the first card */
-static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
-static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
-static int ac97_clock[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 48000};
+static int index = -2; /* Exclude the first card */
+static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */
+static int ac97_clock = 48000;
-module_param_array(index, int, NULL, 0444);
+module_param(index, int, 0444);
MODULE_PARM_DESC(index, "Index value for VIA 82xx bridge.");
-module_param_array(id, charp, NULL, 0444);
+module_param(id, charp, 0444);
MODULE_PARM_DESC(id, "ID string for VIA 82xx bridge.");
-module_param_array(enable, bool, NULL, 0444);
-MODULE_PARM_DESC(enable, "Enable modem part of VIA 82xx bridge.");
-module_param_array(ac97_clock, int, NULL, 0444);
+module_param(ac97_clock, int, 0444);
MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (default 48000Hz).");
@@ -1135,7 +1132,6 @@ static int __devinit snd_via82xx_create(snd_card_t * card,
static int __devinit snd_via82xx_probe(struct pci_dev *pci,
const struct pci_device_id *pci_id)
{
- static int dev;
snd_card_t *card;
via82xx_t *chip;
unsigned char revision;
@@ -1143,14 +1139,7 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci,
unsigned int i;
int err;
- if (dev >= SNDRV_CARDS)
- return -ENODEV;
- if (!enable[dev]) {
- dev++;
- return -ENOENT;
- }
-
- card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);
+ card = snd_card_new(index, id, THIS_MODULE, 0);
if (card == NULL)
return -ENOMEM;
@@ -1167,7 +1156,8 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci,
goto __error;
}
- if ((err = snd_via82xx_create(card, pci, chip_type, revision, ac97_clock[dev], &chip)) < 0)
+ if ((err = snd_via82xx_create(card, pci, chip_type, revision,
+ ac97_clock, &chip)) < 0)
goto __error;
if ((err = snd_via82xx_mixer_new(chip)) < 0)
goto __error;
@@ -1191,7 +1181,6 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci,
return err;
}
pci_set_drvdata(pci, card);
- dev++;
return 0;
__error:
OpenPOWER on IntegriCloud