From c1f6d41593d3ef1f778fd6892cc4b916050c7cb9 Mon Sep 17 00:00:00 2001 From: Mark Salazar Date: Mon, 16 Jan 2006 11:29:09 +0100 Subject: [ALSA] #1/4 for Zoom Video - resolve common vs chipset specific mixer controls Modules: ES18xx driver First of 4 es18xx.c patches culminating in Zoom Video support. While adding support for Zoom Video to the es18xx driver I found some of the mixer controls were wrong. Since you guys went to the trouble of supplying the datasheets for the supported chipsets I did a review of all of them and tried to get es18xx.c to accurately reflect the proper mixer controls for each chipset. If the datasheets are wrong then so are my patches. This first patch moves some controls from the common-to-all-chipsets array 'snd_es18xx_base_controls' to a chipset-specific array and adds code to manage that new array. Also while testing on my ES1878 test machine I discovered it needed a couple of udelays in the identify function so those are in this patch as well. Testing: This work was initially done on the source from the Debian Sarge ALSA package, then tested on an ES1879 and an ES1878 machine. Patches were created against the Sarge code and then edited to apply correctly to the ALSA cvs code. Lastly the patched ALSA cvs code was test for successful compilation. No additional testing was done on the ALSA cvs version. Signed-off-by: Mark Salazar Signed-off-by: Takashi Iwai --- sound/isa/es18xx.c | 49 ++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 38 insertions(+), 11 deletions(-) (limited to 'sound/isa') diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c index 08f032b51107..bde9860327fe 100644 --- a/sound/isa/es18xx.c +++ b/sound/isa/es18xx.c @@ -1191,19 +1191,22 @@ static int snd_es18xx_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_e return change; } +/* Mixer controls + * These arrays contain setup data for mixer controls. + * + * The controls that are universal to all chipsets are fully initialized + * here. + */ static struct snd_kcontrol_new snd_es18xx_base_controls[] = { ES18XX_DOUBLE("Master Playback Volume", 0, 0x60, 0x62, 0, 0, 63, 0), ES18XX_DOUBLE("Master Playback Switch", 0, 0x60, 0x62, 6, 6, 1, 1), ES18XX_DOUBLE("Line Playback Volume", 0, 0x3e, 0x3e, 4, 0, 15, 0), ES18XX_DOUBLE("CD Playback Volume", 0, 0x38, 0x38, 4, 0, 15, 0), ES18XX_DOUBLE("FM Playback Volume", 0, 0x36, 0x36, 4, 0, 15, 0), -ES18XX_DOUBLE("Mono Playback Volume", 0, 0x6d, 0x6d, 4, 0, 15, 0), ES18XX_DOUBLE("Mic Playback Volume", 0, 0x1a, 0x1a, 4, 0, 15, 0), ES18XX_DOUBLE("Aux Playback Volume", 0, 0x3a, 0x3a, 4, 0, 15, 0), -ES18XX_SINGLE("PC Speaker Playback Volume", 0, 0x3c, 0, 7, 0), ES18XX_SINGLE("Record Monitor", 0, 0xa8, 3, 1, 0), ES18XX_DOUBLE("Capture Volume", 0, 0xb4, 0xb4, 4, 0, 15, 0), -ES18XX_SINGLE("Capture Switch", 0, 0x1c, 4, 1, 1), { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = "Capture Source", @@ -1213,19 +1216,27 @@ ES18XX_SINGLE("Capture Switch", 0, 0x1c, 4, 1, 1), } }; -static struct snd_kcontrol_new snd_es18xx_mono_in_control = -ES18XX_DOUBLE("Mono Input Playback Volume", 0, 0x6d, 0x6d, 4, 0, 15, 0); - static struct snd_kcontrol_new snd_es18xx_recmix_controls[] = { ES18XX_DOUBLE("PCM Capture Volume", 0, 0x69, 0x69, 4, 0, 15, 0), ES18XX_DOUBLE("Mic Capture Volume", 0, 0x68, 0x68, 4, 0, 15, 0), ES18XX_DOUBLE("Line Capture Volume", 0, 0x6e, 0x6e, 4, 0, 15, 0), ES18XX_DOUBLE("FM Capture Volume", 0, 0x6b, 0x6b, 4, 0, 15, 0), -ES18XX_DOUBLE("Mono Capture Volume", 0, 0x6f, 0x6f, 4, 0, 15, 0), ES18XX_DOUBLE("CD Capture Volume", 0, 0x6a, 0x6a, 4, 0, 15, 0), ES18XX_DOUBLE("Aux Capture Volume", 0, 0x6c, 0x6c, 4, 0, 15, 0) }; +/* + * The chipset specific mixer controls + */ +static struct snd_kcontrol_new snd_es18xx_opt_speaker = + ES18XX_SINGLE("PC Speaker Playback Volume", 0, 0x3c, 0, 7, 0); + +static struct snd_kcontrol_new snd_es18xx_opt_1869[] = { +ES18XX_SINGLE("Capture Switch", 0, 0x1c, 4, 1, 1), +ES18XX_DOUBLE("Mono Playback Volume", 0, 0x6d, 0x6d, 4, 0, 15, 0), +ES18XX_DOUBLE("Mono Capture Volume", 0, 0x6f, 0x6f, 4, 0, 15, 0) +}; + static struct snd_kcontrol_new snd_es18xx_pcm1_controls[] = { ES18XX_DOUBLE("PCM Playback Volume", 0, 0x14, 0x14, 4, 0, 15, 0), }; @@ -1476,11 +1487,14 @@ static int __devinit snd_es18xx_identify(struct snd_es18xx *chip) } outb(0x40, chip->port + 0x04); + udelay(10); hi = inb(chip->port + 0x05); + udelay(10); lo = inb(chip->port + 0x05); if (hi != lo) { chip->version = hi << 8 | lo; chip->ctrl_port = inb(chip->port + 0x05) << 8; + udelay(10); chip->ctrl_port += inb(chip->port + 0x05); if ((chip->res_ctrl_port = request_region(chip->ctrl_port, 8, "ES18xx - CTRL")) == NULL) { @@ -1778,10 +1792,6 @@ static int __devinit snd_es18xx_mixer(struct snd_es18xx *chip) } } - if (chip->caps & ES18XX_MONO) { - if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_es18xx_mono_in_control, chip))) < 0) - return err; - } if (chip->caps & ES18XX_RECMIX) { for (idx = 0; idx < ARRAY_SIZE(snd_es18xx_recmix_controls); idx++) { if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_es18xx_recmix_controls[idx], chip))) < 0) @@ -1819,6 +1829,23 @@ static int __devinit snd_es18xx_mixer(struct snd_es18xx *chip) } } + /* finish initializing other chipset specific controls + */ + if (chip->version != 0x1868) { + err = snd_ctl_add(card, snd_ctl_new1(&snd_es18xx_opt_speaker, + chip)); + if (err < 0) + return err; + } + if (chip->version == 0x1869) { + for (idx = 0; idx < ARRAY_SIZE(snd_es18xx_opt_1869); idx++) { + err = snd_ctl_add(card, + snd_ctl_new1(&snd_es18xx_opt_1869[idx], + chip)); + if (err < 0) + return err; + } + } return 0; } -- cgit v1.2.3 From f4df221f8fe129ac2fa2a2a4306b7355cf7d05d6 Mon Sep 17 00:00:00 2001 From: Mark Salazar Date: Mon, 16 Jan 2006 11:31:14 +0100 Subject: [ALSA] #2/4 for Zoom Video - resolve number of record sources Modules: ES18xx driver Second of 4 es18xx.c patches culminating in Zoom Video support. This patch changes the 'record source' mux routines to reflect the fact that not all of the supported chipsets have 8 possible inputs. Some have 4 and some have 5. Testing: This work was initially done on the source from the Debian Sarge ALSA package, then tested on an ES1879 and an ES1878 machine. Patches were created against the Sarge code and then edited to apply correctly to the ALSA cvs code. Lastly the patched ALSA cvs code was test for successful compilation. No additional testing was done on the ALSA cvs version. Signed-off-by: Mark Salazar Signed-off-by: Takashi Iwai --- sound/isa/es18xx.c | 99 +++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 90 insertions(+), 9 deletions(-) (limited to 'sound/isa') diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c index bde9860327fe..0488eba051e9 100644 --- a/sound/isa/es18xx.c +++ b/sound/isa/es18xx.c @@ -939,37 +939,118 @@ static int snd_es18xx_capture_close(struct snd_pcm_substream *substream) * MIXER part */ +/* Record source mux routines: + * Depending on the chipset this mux switches between 4, 5, or 8 possible inputs. + * bit table for the 4/5 source mux: + * reg 1C: + * b2 b1 b0 muxSource + * x 0 x microphone + * 0 1 x CD + * 1 1 0 line + * 1 1 1 mixer + * if it's "mixer" and it's a 5 source mux chipset then reg 7A bit 3 determines + * either the play mixer or the capture mixer. + * + * "map4Source" translates from source number to reg bit pattern + * "invMap4Source" translates from reg bit pattern to source number + */ + static int snd_es18xx_info_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { - static char *texts[8] = { + static char *texts4Source[4] = { + "Mic", "CD", "Line", "Master" + }; + static char *texts5Source[5] = { + "Mic", "CD", "Line", "Master", "Mix" + }; + static char *texts8Source[8] = { "Mic", "Mic Master", "CD", "AOUT", "Mic1", "Mix", "Line", "Master" }; + struct snd_es18xx *chip = snd_kcontrol_chip(kcontrol); uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; uinfo->count = 1; - uinfo->value.enumerated.items = 8; - if (uinfo->value.enumerated.item > 7) - uinfo->value.enumerated.item = 7; - strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); + switch (chip->version) { + case 0x1868: + case 0x1878: + uinfo->value.enumerated.items = 4; + if (uinfo->value.enumerated.item > 3) + uinfo->value.enumerated.item = 3; + strcpy(uinfo->value.enumerated.name, texts4Source[uinfo->value.enumerated.item]); + break; + case 0x1887: + case 0x1888: + uinfo->value.enumerated.items = 5; + if (uinfo->value.enumerated.item > 4) + uinfo->value.enumerated.item = 4; + strcpy(uinfo->value.enumerated.name, texts5Source[uinfo->value.enumerated.item]); + break; + case 0x1869: /* DS somewhat contradictory for 1869: could be be 5 or 8 */ + case 0x1879: + uinfo->value.enumerated.items = 8; + if (uinfo->value.enumerated.item > 7) + uinfo->value.enumerated.item = 7; + strcpy(uinfo->value.enumerated.name, texts8Source[uinfo->value.enumerated.item]); + break; + default: + return -EINVAL; + } return 0; } static int snd_es18xx_get_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { + static unsigned char invMap4Source[8] = {0, 0, 1, 1, 0, 0, 2, 3}; struct snd_es18xx *chip = snd_kcontrol_chip(kcontrol); - ucontrol->value.enumerated.item[0] = snd_es18xx_mixer_read(chip, 0x1c) & 0x07; + int muxSource = snd_es18xx_mixer_read(chip, 0x1c) & 0x07; + if (!(chip->version == 0x1869 || chip->version == 0x1879)) { + muxSource = invMap4Source[muxSource]; + if (muxSource==3 && + (chip->version == 0x1887 || chip->version == 0x1888) && + (snd_es18xx_mixer_read(chip, 0x7a) & 0x08) + ) + muxSource = 4; + } + ucontrol->value.enumerated.item[0] = muxSource; return 0; } static int snd_es18xx_put_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { + static unsigned char map4Source[4] = {0, 2, 6, 7}; struct snd_es18xx *chip = snd_kcontrol_chip(kcontrol); unsigned char val = ucontrol->value.enumerated.item[0]; - - if (val > 7) + unsigned char retVal = 0; + + switch (chip->version) { + /* 5 source chips */ + case 0x1887: + case 0x1888: + if (val > 4) + return -EINVAL; + if (val == 4) { + retVal = snd_es18xx_mixer_bits(chip, 0x7a, 0x08, 0x08) != 0x08; + val = 3; + } else + retVal = snd_es18xx_mixer_bits(chip, 0x7a, 0x08, 0x00) != 0x00; + /* 4 source chips */ + case 0x1868: + case 0x1878: + if (val > 3) + return -EINVAL; + val = map4Source[val]; + break; + /* 8 source chips */ + case 0x1869: + case 0x1879: + if (val > 7) + return -EINVAL; + break; + default: return -EINVAL; - return snd_es18xx_mixer_bits(chip, 0x1c, 0x07, val) != val; + } + return (snd_es18xx_mixer_bits(chip, 0x1c, 0x07, val) != val) || retVal; } static int snd_es18xx_info_spatializer_enable(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) -- cgit v1.2.3 From 14086771c04acecc81e3985ca3118b330324194d Mon Sep 17 00:00:00 2001 From: Mark Salazar Date: Mon, 16 Jan 2006 11:33:52 +0100 Subject: [ALSA] #3/4 for Zoom Video - change Hardware Volume interrupt handling Modules: ES18xx driver Third of 4 es18xx.c patches culminating in Zoom Video support. This patch changes the Hardware Volume support to reflect the fact that not all of the supported chipsets have seperate registers dedicated to the Hardware Volume inputs. Although all the chipsets can generate an HWV interrupt whenever a Hardware Volume input is received only those with seperate HWV registers can split the HWV registers from the Master volume registers. Testing: This work was initially done on the source from the Debian Sarge ALSA package, then tested on an ES1879 and an ES1878 machine. Patches were created against the Sarge code and then edited to apply correctly to the ALSA cvs code. Lastly the patched ALSA cvs code was test for successful compilation. No additional testing was done on the ALSA cvs version. Signed-off-by: Mark Salazar Signed-off-by: Takashi Iwai --- sound/isa/es18xx.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'sound/isa') diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c index 0488eba051e9..93335000c51e 100644 --- a/sound/isa/es18xx.c +++ b/sound/isa/es18xx.c @@ -148,7 +148,7 @@ struct snd_audiodrive { #define ES18XX_DUPLEX_SAME 0x0010 /* Playback and record must share the same rate */ #define ES18XX_NEW_RATE 0x0020 /* More precise rate setting */ #define ES18XX_AUXB 0x0040 /* AuxB mixer control */ -#define ES18XX_HWV 0x0080 /* Has hardware volume */ +#define ES18XX_HWV 0x0080 /* Has seperate hardware volume mixer controls*/ #define ES18XX_MONO 0x0100 /* Mono_in mixer control */ #define ES18XX_I2S 0x0200 /* I2S mixer control */ #define ES18XX_MUTEREC 0x0400 /* Record source can be muted */ @@ -788,9 +788,12 @@ static irqreturn_t snd_es18xx_interrupt(int irq, void *dev_id, struct pt_regs *r /* Hardware volume */ if (status & HWV_IRQ) { - int split = snd_es18xx_mixer_read(chip, 0x64) & 0x80; - snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, &chip->hw_switch->id); - snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, &chip->hw_volume->id); + int split = 0; + if (chip->caps & ES18XX_HWV) { + split = snd_es18xx_mixer_read(chip, 0x64) & 0x80; + snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, &chip->hw_switch->id); + snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, &chip->hw_volume->id); + } if (!split) { snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, &chip->master_switch->id); snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, &chip->master_volume->id); @@ -1614,22 +1617,22 @@ static int __devinit snd_es18xx_probe(struct snd_es18xx *chip) switch (chip->version) { case 0x1868: - chip->caps = ES18XX_DUPLEX_MONO | ES18XX_DUPLEX_SAME | ES18XX_CONTROL | ES18XX_HWV; + chip->caps = ES18XX_DUPLEX_MONO | ES18XX_DUPLEX_SAME | ES18XX_CONTROL; break; case 0x1869: chip->caps = ES18XX_PCM2 | ES18XX_SPATIALIZER | ES18XX_RECMIX | ES18XX_NEW_RATE | ES18XX_AUXB | ES18XX_MONO | ES18XX_MUTEREC | ES18XX_CONTROL | ES18XX_HWV; break; case 0x1878: - chip->caps = ES18XX_DUPLEX_MONO | ES18XX_DUPLEX_SAME | ES18XX_I2S | ES18XX_CONTROL | ES18XX_HWV; + chip->caps = ES18XX_DUPLEX_MONO | ES18XX_DUPLEX_SAME | ES18XX_I2S | ES18XX_CONTROL; break; case 0x1879: chip->caps = ES18XX_PCM2 | ES18XX_SPATIALIZER | ES18XX_RECMIX | ES18XX_NEW_RATE | ES18XX_AUXB | ES18XX_I2S | ES18XX_CONTROL | ES18XX_HWV; break; case 0x1887: - chip->caps = ES18XX_PCM2 | ES18XX_RECMIX | ES18XX_AUXB | ES18XX_DUPLEX_SAME | ES18XX_HWV; + chip->caps = ES18XX_PCM2 | ES18XX_RECMIX | ES18XX_AUXB | ES18XX_DUPLEX_SAME; break; case 0x1888: - chip->caps = ES18XX_PCM2 | ES18XX_RECMIX | ES18XX_AUXB | ES18XX_DUPLEX_SAME | ES18XX_HWV; + chip->caps = ES18XX_PCM2 | ES18XX_RECMIX | ES18XX_AUXB | ES18XX_DUPLEX_SAME; break; default: snd_printk(KERN_ERR "[0x%lx] unsupported chip ES%x\n", -- cgit v1.2.3 From 95b712965f0a50365cc0128dacc27acf562f2ff1 Mon Sep 17 00:00:00 2001 From: Mark Salazar Date: Mon, 16 Jan 2006 11:35:40 +0100 Subject: [ALSA] #4/4 for Zoom Video - add Zoom Video support Modules: ES18xx driver Forth of 4 es18xx.c patches culminating in Zoom Video support. This patch adds Zoom Video support for those chipsets that support it. Testing: This work was initially done on the source from the Debian Sarge ALSA package, then tested on an ES1879. I could not test the Zoom Video function for an ES1878 or ES1869. Patches were created against the Sarge code and then edited to apply correctly to the ALSA cvs code. Lastly the patched ALSA cvs code was test for successful compilation. No additional testing was done on the ALSA cvs version. One quirk (noted in my comments below) is that apparently the datasheet is wrong for one of the ES1879 Zoom Video 'enable' bits, because 1) if you set this bit it messes up PCM playback (speaker_test play a lower frequency) 2) even if you don't set this bit Zoom Video still works. I added a control to toggle the bit on just in case there might be a version of the ES1879 that requires it, but I expect noone will need it. Signed-off-by: Mark Salazar Signed-off-by: Takashi Iwai --- sound/isa/es18xx.c | 51 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 48 insertions(+), 3 deletions(-) (limited to 'sound/isa') diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c index 93335000c51e..79785808dd60 100644 --- a/sound/isa/es18xx.c +++ b/sound/isa/es18xx.c @@ -49,6 +49,10 @@ * - contrarily to some pages in DS_1869.PDF the rates can be set * independently. * + * - Zoom Video is implemented by sharing the FM DAC, thus the user can + * have either FM playback or Video playback but not both simultaneously. + * The Video Playback Switch mixer control toggles this choice. + * * BUGS: * * - There is a major trouble I noted: @@ -63,7 +67,16 @@ * */ - +/* + * ES1879 NOTES: + * - When Zoom Video is enabled (reg 0x71 bit 6 toggled on) the PCM playback + * seems to be effected (speaker_test plays a lower frequency). Can't find + * anything in the datasheet to account for this, so a Video Playback Switch + * control has been included to allow ZV to be enabled only when necessary. + * Then again on at least one test system the 0x71 bit 6 enable bit is not + * needed for ZV, so maybe the datasheet is entirely wrong here. + */ + #include #include #include @@ -1317,10 +1330,20 @@ static struct snd_kcontrol_new snd_es18xx_opt_speaker = static struct snd_kcontrol_new snd_es18xx_opt_1869[] = { ES18XX_SINGLE("Capture Switch", 0, 0x1c, 4, 1, 1), +ES18XX_SINGLE("Video Playback Switch", 0, 0x7f, 0, 1, 0), ES18XX_DOUBLE("Mono Playback Volume", 0, 0x6d, 0x6d, 4, 0, 15, 0), ES18XX_DOUBLE("Mono Capture Volume", 0, 0x6f, 0x6f, 4, 0, 15, 0) }; +static struct snd_kcontrol_new snd_es18xx_opt_1878 = + ES18XX_DOUBLE("Video Playback Volume", 0, 0x68, 0x68, 4, 0, 15, 0); + +static struct snd_kcontrol_new snd_es18xx_opt_1879[] = { +ES18XX_SINGLE("Video Playback Switch", 0, 0x71, 6, 1, 0), +ES18XX_DOUBLE("Video Playback Volume", 0, 0x6d, 0x6d, 4, 0, 15, 0), +ES18XX_DOUBLE("Video Capture Volume", 0, 0x6f, 0x6f, 4, 0, 15, 0) +}; + static struct snd_kcontrol_new snd_es18xx_pcm1_controls[] = { ES18XX_DOUBLE("PCM Playback Volume", 0, 0x14, 0x14, 4, 0, 15, 0), }; @@ -1365,7 +1388,6 @@ static struct snd_kcontrol_new snd_es18xx_hw_volume_controls[] = { ES18XX_SINGLE("Hardware Master Volume Split", 0, 0x64, 7, 1, 0), }; -#if 0 static int __devinit snd_es18xx_config_read(struct snd_es18xx *chip, unsigned char reg) { int data; @@ -1376,7 +1398,6 @@ static int __devinit snd_es18xx_config_read(struct snd_es18xx *chip, unsigned ch spin_unlock_irqrestore(&chip->ctrl_lock, flags); return data; } -#endif static void __devinit snd_es18xx_config_write(struct snd_es18xx *chip, unsigned char reg, unsigned char data) @@ -1522,6 +1543,17 @@ static int __devinit snd_es18xx_initialize(struct snd_es18xx *chip) snd_es18xx_mixer_write(chip, 0x58, 0x94); snd_es18xx_mixer_write(chip, 0x5a, 0x80); } + /* Flip the "enable I2S" bits for those chipsets that need it */ + switch (chip->version) { + case 0x1879: + //Leaving I2S enabled on the 1879 screws up the PCM playback (rate effected somehow) + //so a Switch control has been added to toggle this 0x71 bit on/off: + //snd_es18xx_mixer_bits(chip, 0x71, 0x40, 0x40); + /* Note: we fall through on purpose here. */ + case 0x1878: + snd_es18xx_config_write(chip, 0x29, snd_es18xx_config_read(chip, 0x29) | 0x40); + break; + } /* Mute input source */ if (chip->caps & ES18XX_MUTEREC) mask = 0x10; @@ -1929,6 +1961,19 @@ static int __devinit snd_es18xx_mixer(struct snd_es18xx *chip) if (err < 0) return err; } + } else if (chip->version == 0x1878) { + err = snd_ctl_add(card, snd_ctl_new1(&snd_es18xx_opt_1878, + chip)); + if (err < 0) + return err; + } else if (chip->version == 0x1879) { + for (idx = 0; idx < ARRAY_SIZE(snd_es18xx_opt_1879); idx++) { + err = snd_ctl_add(card, + snd_ctl_new1(&snd_es18xx_opt_1879[idx], + chip)); + if (err < 0) + return err; + } } return 0; } -- cgit v1.2.3 From 8b7547f95cbe8a5940df62ed730646fdfcba5fda Mon Sep 17 00:00:00 2001 From: Ingo Molnar Date: Mon, 16 Jan 2006 16:33:08 +0100 Subject: [ALSA] semaphore -> mutex (ISA part) Semaphore to mutex conversion. The conversion was generated via scripts, and the result was validated automatically via a script as well. Signed-off-by: Ingo Molnar Signed-off-by: Andrew Morton Signed-off-by: Takashi Iwai --- include/sound/ad1848.h | 2 +- include/sound/cs4231.h | 4 ++-- include/sound/gus.h | 6 +++--- include/sound/sb16_csp.h | 2 +- sound/isa/ad1848/ad1848_lib.c | 14 +++++++------- sound/isa/cs423x/cs4231_lib.c | 30 +++++++++++++++--------------- sound/isa/cs423x/cs4236_lib.c | 4 ++-- sound/isa/gus/gus_dma.c | 10 +++++----- sound/isa/gus/gus_main.c | 2 +- sound/isa/gus/gus_mem.c | 14 +++++++------- sound/isa/gus/gus_synth.c | 14 +++++++------- sound/isa/sb/sb16_csp.c | 12 ++++++------ 12 files changed, 57 insertions(+), 57 deletions(-) (limited to 'sound/isa') diff --git a/include/sound/ad1848.h b/include/sound/ad1848.h index 1a2759f3a292..57af1fe7b309 100644 --- a/include/sound/ad1848.h +++ b/include/sound/ad1848.h @@ -154,7 +154,7 @@ struct snd_ad1848 { #endif spinlock_t reg_lock; - struct semaphore open_mutex; + struct mutex open_mutex; }; /* exported functions */ diff --git a/include/sound/cs4231.h b/include/sound/cs4231.h index ac6a5d882088..60b5b92a1319 100644 --- a/include/sound/cs4231.h +++ b/include/sound/cs4231.h @@ -248,8 +248,8 @@ struct snd_cs4231 { unsigned int c_dma_size; spinlock_t reg_lock; - struct semaphore mce_mutex; - struct semaphore open_mutex; + struct mutex mce_mutex; + struct mutex open_mutex; int (*rate_constraint) (struct snd_pcm_runtime *runtime); void (*set_playback_format) (struct snd_cs4231 *chip, struct snd_pcm_hw_params *hw_params, unsigned char pdfr); diff --git a/include/sound/gus.h b/include/sound/gus.h index 63da50fae773..68a664ab97f3 100644 --- a/include/sound/gus.h +++ b/include/sound/gus.h @@ -209,7 +209,7 @@ struct snd_gf1_mem { struct snd_gf1_bank_info banks_16[4]; struct snd_gf1_mem_block *first; struct snd_gf1_mem_block *last; - struct semaphore memory_mutex; + struct mutex memory_mutex; }; struct snd_gf1_dma_block { @@ -467,8 +467,8 @@ struct snd_gus_card { spinlock_t dma_lock; spinlock_t pcm_volume_level_lock; spinlock_t uart_cmd_lock; - struct semaphore dma_mutex; - struct semaphore register_mutex; + struct mutex dma_mutex; + struct mutex register_mutex; }; /* I/O functions for GF1/InterWave chip - gus_io.c */ diff --git a/include/sound/sb16_csp.h b/include/sound/sb16_csp.h index 3b44d4b370f5..caf6fe21514d 100644 --- a/include/sound/sb16_csp.h +++ b/include/sound/sb16_csp.h @@ -158,7 +158,7 @@ struct snd_sb_csp { struct snd_kcontrol *qsound_switch; struct snd_kcontrol *qsound_space; - struct semaphore access_mutex; /* locking */ + struct mutex access_mutex; /* locking */ }; int snd_sb_csp_new(struct snd_sb *chip, int device, struct snd_hwdep ** rhwdep); diff --git a/sound/isa/ad1848/ad1848_lib.c b/sound/isa/ad1848/ad1848_lib.c index b78530d7ea90..d4b0e580557e 100644 --- a/sound/isa/ad1848/ad1848_lib.c +++ b/sound/isa/ad1848/ad1848_lib.c @@ -387,9 +387,9 @@ static int snd_ad1848_open(struct snd_ad1848 *chip, unsigned int mode) { unsigned long flags; - down(&chip->open_mutex); + mutex_lock(&chip->open_mutex); if (chip->mode & AD1848_MODE_OPEN) { - up(&chip->open_mutex); + mutex_unlock(&chip->open_mutex); return -EAGAIN; } snd_ad1848_mce_down(chip); @@ -432,7 +432,7 @@ static int snd_ad1848_open(struct snd_ad1848 *chip, unsigned int mode) spin_unlock_irqrestore(&chip->reg_lock, flags); chip->mode = mode; - up(&chip->open_mutex); + mutex_unlock(&chip->open_mutex); return 0; } @@ -441,9 +441,9 @@ static void snd_ad1848_close(struct snd_ad1848 *chip) { unsigned long flags; - down(&chip->open_mutex); + mutex_lock(&chip->open_mutex); if (!chip->mode) { - up(&chip->open_mutex); + mutex_unlock(&chip->open_mutex); return; } /* disable IRQ */ @@ -471,7 +471,7 @@ static void snd_ad1848_close(struct snd_ad1848 *chip) spin_unlock_irqrestore(&chip->reg_lock, flags); chip->mode = 0; - up(&chip->open_mutex); + mutex_unlock(&chip->open_mutex); } /* @@ -889,7 +889,7 @@ int snd_ad1848_create(struct snd_card *card, if (chip == NULL) return -ENOMEM; spin_lock_init(&chip->reg_lock); - init_MUTEX(&chip->open_mutex); + mutex_init(&chip->open_mutex); chip->card = card; chip->port = port; chip->irq = -1; diff --git a/sound/isa/cs423x/cs4231_lib.c b/sound/isa/cs423x/cs4231_lib.c index eab7eb59b5f7..823db8246701 100644 --- a/sound/isa/cs423x/cs4231_lib.c +++ b/sound/isa/cs423x/cs4231_lib.c @@ -531,7 +531,7 @@ static void snd_cs4231_playback_format(struct snd_cs4231 *chip, unsigned long flags; int full_calib = 1; - down(&chip->mce_mutex); + mutex_lock(&chip->mce_mutex); snd_cs4231_calibrate_mute(chip, 1); if (chip->hardware == CS4231_HW_CS4231A || (chip->hardware & CS4231_HW_CS4232_MASK)) { @@ -560,7 +560,7 @@ static void snd_cs4231_playback_format(struct snd_cs4231 *chip, snd_cs4231_mce_down(chip); } snd_cs4231_calibrate_mute(chip, 0); - up(&chip->mce_mutex); + mutex_unlock(&chip->mce_mutex); } static void snd_cs4231_capture_format(struct snd_cs4231 *chip, @@ -570,7 +570,7 @@ static void snd_cs4231_capture_format(struct snd_cs4231 *chip, unsigned long flags; int full_calib = 1; - down(&chip->mce_mutex); + mutex_lock(&chip->mce_mutex); snd_cs4231_calibrate_mute(chip, 1); if (chip->hardware == CS4231_HW_CS4231A || (chip->hardware & CS4231_HW_CS4232_MASK)) { @@ -603,7 +603,7 @@ static void snd_cs4231_capture_format(struct snd_cs4231 *chip, snd_cs4231_mce_down(chip); } snd_cs4231_calibrate_mute(chip, 0); - up(&chip->mce_mutex); + mutex_unlock(&chip->mce_mutex); } /* @@ -709,15 +709,15 @@ static int snd_cs4231_open(struct snd_cs4231 *chip, unsigned int mode) { unsigned long flags; - down(&chip->open_mutex); + mutex_lock(&chip->open_mutex); if ((chip->mode & mode) || ((chip->mode & CS4231_MODE_OPEN) && chip->single_dma)) { - up(&chip->open_mutex); + mutex_unlock(&chip->open_mutex); return -EAGAIN; } if (chip->mode & CS4231_MODE_OPEN) { chip->mode |= mode; - up(&chip->open_mutex); + mutex_unlock(&chip->open_mutex); return 0; } /* ok. now enable and ack CODEC IRQ */ @@ -737,7 +737,7 @@ static int snd_cs4231_open(struct snd_cs4231 *chip, unsigned int mode) spin_unlock_irqrestore(&chip->reg_lock, flags); chip->mode = mode; - up(&chip->open_mutex); + mutex_unlock(&chip->open_mutex); return 0; } @@ -745,10 +745,10 @@ static void snd_cs4231_close(struct snd_cs4231 *chip, unsigned int mode) { unsigned long flags; - down(&chip->open_mutex); + mutex_lock(&chip->open_mutex); chip->mode &= ~mode; if (chip->mode & CS4231_MODE_OPEN) { - up(&chip->open_mutex); + mutex_unlock(&chip->open_mutex); return; } snd_cs4231_calibrate_mute(chip, 1); @@ -785,7 +785,7 @@ static void snd_cs4231_close(struct snd_cs4231 *chip, unsigned int mode) snd_cs4231_calibrate_mute(chip, 0); chip->mode = 0; - up(&chip->open_mutex); + mutex_unlock(&chip->open_mutex); } /* @@ -1408,8 +1408,8 @@ static int snd_cs4231_new(struct snd_card *card, chip->hwshare = hwshare; spin_lock_init(&chip->reg_lock); - init_MUTEX(&chip->mce_mutex); - init_MUTEX(&chip->open_mutex); + mutex_init(&chip->mce_mutex); + mutex_init(&chip->open_mutex); chip->card = card; chip->rate_constraint = snd_cs4231_xrate; chip->set_playback_format = snd_cs4231_playback_format; @@ -1538,8 +1538,8 @@ int snd_cs4231_pcm(struct snd_cs4231 *chip, int device, struct snd_pcm **rpcm) return err; spin_lock_init(&chip->reg_lock); - init_MUTEX(&chip->mce_mutex); - init_MUTEX(&chip->open_mutex); + mutex_init(&chip->mce_mutex); + mutex_init(&chip->open_mutex); snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_cs4231_playback_ops); snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_cs4231_capture_ops); diff --git a/sound/isa/cs423x/cs4236_lib.c b/sound/isa/cs423x/cs4236_lib.c index e36981d64ec5..1125ddb2b1aa 100644 --- a/sound/isa/cs423x/cs4236_lib.c +++ b/sound/isa/cs423x/cs4236_lib.c @@ -841,7 +841,7 @@ static int snd_cs4236_put_iec958_switch(struct snd_kcontrol *kcontrol, struct sn enable = ucontrol->value.integer.value[0] & 1; - down(&chip->mce_mutex); + mutex_lock(&chip->mce_mutex); snd_cs4231_mce_up(chip); spin_lock_irqsave(&chip->reg_lock, flags); val = (chip->image[CS4231_ALT_FEATURE_1] & ~0x0e) | (0<<2) | (enable << 1); @@ -854,7 +854,7 @@ static int snd_cs4236_put_iec958_switch(struct snd_kcontrol *kcontrol, struct sn snd_cs4236_ctrl_out(chip, 4, val); spin_unlock_irqrestore(&chip->reg_lock, flags); snd_cs4231_mce_down(chip); - up(&chip->mce_mutex); + mutex_unlock(&chip->mce_mutex); #if 0 printk("set valid: ALT = 0x%x, C3 = 0x%x, C4 = 0x%x, C5 = 0x%x, C6 = 0x%x, C8 = 0x%x\n", diff --git a/sound/isa/gus/gus_dma.c b/sound/isa/gus/gus_dma.c index 930f4bc56f34..44ee5d3674a1 100644 --- a/sound/isa/gus/gus_dma.c +++ b/sound/isa/gus/gus_dma.c @@ -149,10 +149,10 @@ static void snd_gf1_dma_interrupt(struct snd_gus_card * gus) int snd_gf1_dma_init(struct snd_gus_card * gus) { - down(&gus->dma_mutex); + mutex_lock(&gus->dma_mutex); gus->gf1.dma_shared++; if (gus->gf1.dma_shared > 1) { - up(&gus->dma_mutex); + mutex_unlock(&gus->dma_mutex); return 0; } gus->gf1.interrupt_handler_dma_write = snd_gf1_dma_interrupt; @@ -160,7 +160,7 @@ int snd_gf1_dma_init(struct snd_gus_card * gus) gus->gf1.dma_data_pcm_last = gus->gf1.dma_data_synth = gus->gf1.dma_data_synth_last = NULL; - up(&gus->dma_mutex); + mutex_unlock(&gus->dma_mutex); return 0; } @@ -168,7 +168,7 @@ int snd_gf1_dma_done(struct snd_gus_card * gus) { struct snd_gf1_dma_block *block; - down(&gus->dma_mutex); + mutex_lock(&gus->dma_mutex); gus->gf1.dma_shared--; if (!gus->gf1.dma_shared) { snd_dma_disable(gus->gf1.dma1); @@ -185,7 +185,7 @@ int snd_gf1_dma_done(struct snd_gus_card * gus) gus->gf1.dma_data_pcm_last = gus->gf1.dma_data_synth_last = NULL; } - up(&gus->dma_mutex); + mutex_unlock(&gus->dma_mutex); return 0; } diff --git a/sound/isa/gus/gus_main.c b/sound/isa/gus/gus_main.c index 6d15b3d18a87..53eeaf37007d 100644 --- a/sound/isa/gus/gus_main.c +++ b/sound/isa/gus/gus_main.c @@ -225,7 +225,7 @@ int snd_gus_create(struct snd_card *card, spin_lock_init(&gus->dma_lock); spin_lock_init(&gus->pcm_volume_level_lock); spin_lock_init(&gus->uart_cmd_lock); - init_MUTEX(&gus->dma_mutex); + mutex_init(&gus->dma_mutex); if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, gus, &ops)) < 0) { snd_gus_free(gus); return err; diff --git a/sound/isa/gus/gus_mem.c b/sound/isa/gus/gus_mem.c index e8bdb860a19f..3c0d27aa08b3 100644 --- a/sound/isa/gus/gus_mem.c +++ b/sound/isa/gus/gus_mem.c @@ -34,9 +34,9 @@ static void snd_gf1_mem_info_read(struct snd_info_entry *entry, void snd_gf1_mem_lock(struct snd_gf1_mem * alloc, int xup) { if (!xup) { - down(&alloc->memory_mutex); + mutex_lock(&alloc->memory_mutex); } else { - up(&alloc->memory_mutex); + mutex_unlock(&alloc->memory_mutex); } } @@ -59,7 +59,7 @@ static struct snd_gf1_mem_block *snd_gf1_mem_xalloc(struct snd_gf1_mem * alloc, alloc->first = nblock; else nblock->prev->next = nblock; - up(&alloc->memory_mutex); + mutex_unlock(&alloc->memory_mutex); return NULL; } pblock = pblock->next; @@ -80,7 +80,7 @@ int snd_gf1_mem_xfree(struct snd_gf1_mem * alloc, struct snd_gf1_mem_block * blo { if (block->share) { /* ok.. shared block */ block->share--; - up(&alloc->memory_mutex); + mutex_unlock(&alloc->memory_mutex); return 0; } if (alloc->first == block) { @@ -244,7 +244,7 @@ int snd_gf1_mem_init(struct snd_gus_card * gus) #endif alloc = &gus->gf1.mem_alloc; - init_MUTEX(&alloc->memory_mutex); + mutex_init(&alloc->memory_mutex); alloc->first = alloc->last = NULL; if (!gus->gf1.memory) return 0; @@ -299,7 +299,7 @@ static void snd_gf1_mem_info_read(struct snd_info_entry *entry, gus = entry->private_data; alloc = &gus->gf1.mem_alloc; - down(&alloc->memory_mutex); + mutex_lock(&alloc->memory_mutex); snd_iprintf(buffer, "8-bit banks : \n "); for (i = 0; i < 4; i++) snd_iprintf(buffer, "0x%06x (%04ik)%s", alloc->banks_8[i].address, alloc->banks_8[i].size >> 10, i + 1 < 4 ? "," : ""); @@ -343,7 +343,7 @@ static void snd_gf1_mem_info_read(struct snd_info_entry *entry, } snd_iprintf(buffer, " Total: memory = %i, used = %i, free = %i\n", total, used, total - used); - up(&alloc->memory_mutex); + mutex_unlock(&alloc->memory_mutex); #if 0 ultra_iprintf(buffer, " Verify: free = %i, max 8-bit block = %i, max 16-bit block = %i\n", ultra_memory_free_size(card, &card->gf1.mem_alloc), diff --git a/sound/isa/gus/gus_synth.c b/sound/isa/gus/gus_synth.c index 85a1b051f09a..2767cc187ae3 100644 --- a/sound/isa/gus/gus_synth.c +++ b/sound/isa/gus/gus_synth.c @@ -55,9 +55,9 @@ static int snd_gus_synth_use(void *private_data, struct snd_seq_port_subscribe * if (info->voices > 32) return -EINVAL; - down(&gus->register_mutex); + mutex_lock(&gus->register_mutex); if (!snd_gus_use_inc(gus)) { - up(&gus->register_mutex); + mutex_unlock(&gus->register_mutex); return -EFAULT; } for (idx = 0; idx < info->voices; idx++) { @@ -65,12 +65,12 @@ static int snd_gus_synth_use(void *private_data, struct snd_seq_port_subscribe * if (voice == NULL) { snd_gus_synth_free_voices(gus, info->sender.client, info->sender.port); snd_gus_use_dec(gus); - up(&gus->register_mutex); + mutex_unlock(&gus->register_mutex); return -EBUSY; } voice->index = idx; } - up(&gus->register_mutex); + mutex_unlock(&gus->register_mutex); return 0; } @@ -79,10 +79,10 @@ static int snd_gus_synth_unuse(void *private_data, struct snd_seq_port_subscribe struct snd_gus_port * port = private_data; struct snd_gus_card * gus = port->gus; - down(&gus->register_mutex); + mutex_lock(&gus->register_mutex); snd_gus_synth_free_voices(gus, info->sender.client, info->sender.port); snd_gus_use_dec(gus); - up(&gus->register_mutex); + mutex_unlock(&gus->register_mutex); return 0; } @@ -223,7 +223,7 @@ static int snd_gus_synth_new_device(struct snd_seq_device *dev) if (gus == NULL) return -EINVAL; - init_MUTEX(&gus->register_mutex); + mutex_init(&gus->register_mutex); gus->gf1.seq_client = -1; /* allocate new client */ diff --git a/sound/isa/sb/sb16_csp.c b/sound/isa/sb/sb16_csp.c index 9c2b5efbacbf..9703c68e4e08 100644 --- a/sound/isa/sb/sb16_csp.c +++ b/sound/isa/sb/sb16_csp.c @@ -138,7 +138,7 @@ int snd_sb_csp_new(struct snd_sb *chip, int device, struct snd_hwdep ** rhwdep) p->ops.csp_stop = snd_sb_csp_stop; p->ops.csp_qsound_transfer = snd_sb_csp_qsound_transfer; - init_MUTEX(&p->access_mutex); + mutex_init(&p->access_mutex); sprintf(hw->name, "CSP v%d.%d", (version >> 4), (version & 0x0f)); hw->iface = SNDRV_HWDEP_IFACE_SB16CSP; hw->private_data = p; @@ -265,13 +265,13 @@ static int snd_sb_csp_release(struct snd_hwdep * hw, struct file *file) */ static int snd_sb_csp_use(struct snd_sb_csp * p) { - down(&p->access_mutex); + mutex_lock(&p->access_mutex); if (p->used) { - up(&p->access_mutex); + mutex_unlock(&p->access_mutex); return -EAGAIN; } p->used++; - up(&p->access_mutex); + mutex_unlock(&p->access_mutex); return 0; @@ -282,9 +282,9 @@ static int snd_sb_csp_use(struct snd_sb_csp * p) */ static int snd_sb_csp_unuse(struct snd_sb_csp * p) { - down(&p->access_mutex); + mutex_lock(&p->access_mutex); p->used--; - up(&p->access_mutex); + mutex_unlock(&p->access_mutex); return 0; } -- cgit v1.2.3 From d08a23e2509e8e80637b4dfa5607ea00b9151b0a Mon Sep 17 00:00:00 2001 From: Ken Arromdee Date: Thu, 9 Feb 2006 13:50:26 +0100 Subject: [ALSA] ad1816a - Fix PCM trigger direction Modules: AD1816A driver Fixed the bug of capture with Shark Predator ISA resulting in: arecord: pcm_read:1196: read error: Input/output error Signed-off-by: Takashi Iwai --- sound/isa/ad1816a/ad1816a_lib.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'sound/isa') diff --git a/sound/isa/ad1816a/ad1816a_lib.c b/sound/isa/ad1816a/ad1816a_lib.c index ac0d808fff57..fd8fe16c09ee 100644 --- a/sound/isa/ad1816a/ad1816a_lib.c +++ b/sound/isa/ad1816a/ad1816a_lib.c @@ -1,4 +1,3 @@ - /* ad1816a.c - lowlevel code for Analog Devices AD1816A chip. Copyright (C) 1999-2000 by Massimo Piccioni @@ -175,7 +174,7 @@ static void snd_ad1816a_close(struct snd_ad1816a *chip, unsigned int mode) static int snd_ad1816a_trigger(struct snd_ad1816a *chip, unsigned char what, - int channel, int cmd) + int channel, int cmd, int iscapture) { int error = 0; @@ -184,10 +183,14 @@ static int snd_ad1816a_trigger(struct snd_ad1816a *chip, unsigned char what, case SNDRV_PCM_TRIGGER_STOP: spin_lock(&chip->lock); cmd = (cmd == SNDRV_PCM_TRIGGER_START) ? 0xff: 0x00; - if (what & AD1816A_PLAYBACK_ENABLE) + /* if (what & AD1816A_PLAYBACK_ENABLE) */ + /* That is not valid, because playback and capture enable + * are the same bit pattern, just to different addresses + */ + if (! iscapture) snd_ad1816a_out_mask(chip, AD1816A_PLAYBACK_CONFIG, AD1816A_PLAYBACK_ENABLE, cmd); - if (what & AD1816A_CAPTURE_ENABLE) + else snd_ad1816a_out_mask(chip, AD1816A_CAPTURE_CONFIG, AD1816A_CAPTURE_ENABLE, cmd); spin_unlock(&chip->lock); @@ -204,14 +207,14 @@ static int snd_ad1816a_playback_trigger(struct snd_pcm_substream *substream, int { struct snd_ad1816a *chip = snd_pcm_substream_chip(substream); return snd_ad1816a_trigger(chip, AD1816A_PLAYBACK_ENABLE, - SNDRV_PCM_STREAM_PLAYBACK, cmd); + SNDRV_PCM_STREAM_PLAYBACK, cmd, 0); } static int snd_ad1816a_capture_trigger(struct snd_pcm_substream *substream, int cmd) { struct snd_ad1816a *chip = snd_pcm_substream_chip(substream); return snd_ad1816a_trigger(chip, AD1816A_CAPTURE_ENABLE, - SNDRV_PCM_STREAM_CAPTURE, cmd); + SNDRV_PCM_STREAM_CAPTURE, cmd, 1); } static int snd_ad1816a_hw_params(struct snd_pcm_substream *substream, -- cgit v1.2.3 From 8278ca8feb2748cf02d756ac6c5b9ab2e047c84a Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 20 Feb 2006 11:57:34 +0100 Subject: [ALSA] Fix check of enable module option Fix the check of enable module option in probe of platform_device drivers. It shouldn't break the loop but just ignore if enable[i] is false. Signed-off-by: Takashi Iwai --- sound/drivers/dummy.c | 4 +++- sound/drivers/mpu401/mpu401.c | 4 +++- sound/drivers/serial-u16550.c | 4 +++- sound/drivers/virmidi.c | 4 +++- sound/isa/ad1848/ad1848.c | 4 +++- sound/isa/cs423x/cs4231.c | 4 +++- sound/isa/cs423x/cs4236.c | 4 ++-- sound/isa/es1688/es1688.c | 4 +++- sound/isa/es18xx.c | 4 ++-- sound/isa/gus/gusclassic.c | 4 +++- sound/isa/gus/gusextreme.c | 4 +++- sound/isa/gus/gusmax.c | 4 +++- sound/isa/gus/interwave.c | 4 +++- sound/isa/opl3sa2.c | 4 +++- sound/isa/sb/sb16.c | 4 ++-- sound/isa/sb/sb8.c | 4 +++- sound/isa/sgalaxy.c | 4 +++- sound/isa/wavefront/wavefront.c | 4 +++- 18 files changed, 51 insertions(+), 21 deletions(-) (limited to 'sound/isa') diff --git a/sound/drivers/dummy.c b/sound/drivers/dummy.c index 14e1a671b5cf..e35fd5779a9d 100644 --- a/sound/drivers/dummy.c +++ b/sound/drivers/dummy.c @@ -669,8 +669,10 @@ static int __init alsa_card_dummy_init(void) return err; cards = 0; - for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { + for (i = 0; i < SNDRV_CARDS; i++) { struct platform_device *device; + if (! enable[i]) + continue; device = platform_device_register_simple(SND_DUMMY_DRIVER, i, NULL, 0); if (IS_ERR(device)) { diff --git a/sound/drivers/mpu401/mpu401.c b/sound/drivers/mpu401/mpu401.c index 915589a402ab..9d10d79e27af 100644 --- a/sound/drivers/mpu401/mpu401.c +++ b/sound/drivers/mpu401/mpu401.c @@ -240,8 +240,10 @@ static int __init alsa_card_mpu401_init(void) return err; devices = 0; - for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { + for (i = 0; i < SNDRV_CARDS; i++) { struct platform_device *device; + if (! enable[i]) + continue; #ifdef CONFIG_PNP if (pnp[i]) continue; diff --git a/sound/drivers/serial-u16550.c b/sound/drivers/serial-u16550.c index 112ddf705402..13b46d12564a 100644 --- a/sound/drivers/serial-u16550.c +++ b/sound/drivers/serial-u16550.c @@ -989,8 +989,10 @@ static int __init alsa_card_serial_init(void) return err; cards = 0; - for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { + for (i = 0; i < SNDRV_CARDS; i++) { struct platform_device *device; + if (! enable[i]) + continue; device = platform_device_register_simple(SND_SERIAL_DRIVER, i, NULL, 0); if (IS_ERR(device)) { diff --git a/sound/drivers/virmidi.c b/sound/drivers/virmidi.c index 4258723de2ab..a3ee306239c9 100644 --- a/sound/drivers/virmidi.c +++ b/sound/drivers/virmidi.c @@ -163,8 +163,10 @@ static int __init alsa_card_virmidi_init(void) return err; cards = 0; - for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { + for (i = 0; i < SNDRV_CARDS; i++) { struct platform_device *device; + if (! enable[i]) + continue; device = platform_device_register_simple(SND_VIRMIDI_DRIVER, i, NULL, 0); if (IS_ERR(device)) { diff --git a/sound/isa/ad1848/ad1848.c b/sound/isa/ad1848/ad1848.c index e091bbeffd2a..326a057f752f 100644 --- a/sound/isa/ad1848/ad1848.c +++ b/sound/isa/ad1848/ad1848.c @@ -187,8 +187,10 @@ static int __init alsa_card_ad1848_init(void) return err; cards = 0; - for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { + for (i = 0; i < SNDRV_CARDS; i++) { struct platform_device *device; + if (! enable[i]) + continue; device = platform_device_register_simple(SND_AD1848_DRIVER, i, NULL, 0); if (IS_ERR(device)) { diff --git a/sound/isa/cs423x/cs4231.c b/sound/isa/cs423x/cs4231.c index ab67b5c2590d..a30dcd962525 100644 --- a/sound/isa/cs423x/cs4231.c +++ b/sound/isa/cs423x/cs4231.c @@ -203,8 +203,10 @@ static int __init alsa_card_cs4231_init(void) return err; cards = 0; - for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { + for (i = 0; i < SNDRV_CARDS; i++) { struct platform_device *device; + if (! enable[i]) + continue; device = platform_device_register_simple(SND_CS4231_DRIVER, i, NULL, 0); if (IS_ERR(device)) { diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c index 99a42138bea0..4060918e0327 100644 --- a/sound/isa/cs423x/cs4236.c +++ b/sound/isa/cs423x/cs4236.c @@ -771,9 +771,9 @@ static int __init alsa_card_cs423x_init(void) if ((err = platform_driver_register(&cs423x_nonpnp_driver)) < 0) return err; - for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { + for (i = 0; i < SNDRV_CARDS; i++) { struct platform_device *device; - if (is_isapnp_selected(i)) + if (! enable[i] || is_isapnp_selected(i)) continue; device = platform_device_register_simple(CS423X_DRIVER, i, NULL, 0); diff --git a/sound/isa/es1688/es1688.c b/sound/isa/es1688/es1688.c index 50d23cf3d7cc..2b69fc829265 100644 --- a/sound/isa/es1688/es1688.c +++ b/sound/isa/es1688/es1688.c @@ -207,8 +207,10 @@ static int __init alsa_card_es1688_init(void) return err; cards = 0; - for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { + for (i = 0; i < SNDRV_CARDS; i++) { struct platform_device *device; + if (! enable[i]) + continue; device = platform_device_register_simple(ES1688_DRIVER, i, NULL, 0); if (IS_ERR(device)) { diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c index 79785808dd60..bb709264216f 100644 --- a/sound/isa/es18xx.c +++ b/sound/isa/es18xx.c @@ -2381,9 +2381,9 @@ static int __init alsa_card_es18xx_init(void) if ((err = platform_driver_register(&snd_es18xx_nonpnp_driver)) < 0) return err; - for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { + for (i = 0; i < SNDRV_CARDS; i++) { struct platform_device *device; - if (is_isapnp_selected(i)) + if (! enable[i] || is_isapnp_selected(i)) continue; device = platform_device_register_simple(ES18XX_DRIVER, i, NULL, 0); diff --git a/sound/isa/gus/gusclassic.c b/sound/isa/gus/gusclassic.c index 91c219116d7a..26dccfea2437 100644 --- a/sound/isa/gus/gusclassic.c +++ b/sound/isa/gus/gusclassic.c @@ -247,8 +247,10 @@ static int __init alsa_card_gusclassic_init(void) return err; cards = 0; - for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { + for (i = 0; i < SNDRV_CARDS; i++) { struct platform_device *device; + if (! enable[i]) + continue; device = platform_device_register_simple(GUSCLASSIC_DRIVER, i, NULL, 0); if (IS_ERR(device)) { diff --git a/sound/isa/gus/gusextreme.c b/sound/isa/gus/gusextreme.c index 239f16e6b9ee..31dc20501d0c 100644 --- a/sound/isa/gus/gusextreme.c +++ b/sound/isa/gus/gusextreme.c @@ -357,8 +357,10 @@ static int __init alsa_card_gusextreme_init(void) return err; cards = 0; - for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { + for (i = 0; i < SNDRV_CARDS; i++) { struct platform_device *device; + if (! enable[i]) + continue; device = platform_device_register_simple(GUSEXTREME_DRIVER, i, NULL, 0); if (IS_ERR(device)) { diff --git a/sound/isa/gus/gusmax.c b/sound/isa/gus/gusmax.c index d4d2b2a517d5..cafb9b67fa72 100644 --- a/sound/isa/gus/gusmax.c +++ b/sound/isa/gus/gusmax.c @@ -384,8 +384,10 @@ static int __init alsa_card_gusmax_init(void) return err; cards = 0; - for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { + for (i = 0; i < SNDRV_CARDS; i++) { struct platform_device *device; + if (! enable[i]) + continue; device = platform_device_register_simple(GUSMAX_DRIVER, i, NULL, 0); if (IS_ERR(device)) { diff --git a/sound/isa/gus/interwave.c b/sound/isa/gus/interwave.c index 9838d992b101..2cacd0fa6871 100644 --- a/sound/isa/gus/interwave.c +++ b/sound/isa/gus/interwave.c @@ -935,8 +935,10 @@ static int __init alsa_card_interwave_init(void) if ((err = platform_driver_register(&snd_interwave_driver)) < 0) return err; - for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { + for (i = 0; i < SNDRV_CARDS; i++) { struct platform_device *device; + if (! enable[i]) + continue; #ifdef CONFIG_PNP if (isapnp[i]) continue; diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c index 9d8431978501..56fcd8a946a4 100644 --- a/sound/isa/opl3sa2.c +++ b/sound/isa/opl3sa2.c @@ -949,8 +949,10 @@ static int __init alsa_card_opl3sa2_init(void) if ((err = platform_driver_register(&snd_opl3sa2_nonpnp_driver)) < 0) return err; - for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { + for (i = 0; i < SNDRV_CARDS; i++) { struct platform_device *device; + if (! enable[i]) + continue; #ifdef CONFIG_PNP if (isapnp[i]) continue; diff --git a/sound/isa/sb/sb16.c b/sound/isa/sb/sb16.c index 0667bd14ad60..5737ab76160c 100644 --- a/sound/isa/sb/sb16.c +++ b/sound/isa/sb/sb16.c @@ -712,9 +712,9 @@ static int __init alsa_card_sb16_init(void) if ((err = platform_driver_register(&snd_sb16_nonpnp_driver)) < 0) return err; - for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { + for (i = 0; i < SNDRV_CARDS; i++) { struct platform_device *device; - if (is_isapnp_selected(i)) + if (! enable[i] || is_isapnp_selected(i)) continue; device = platform_device_register_simple(SND_SB16_DRIVER, i, NULL, 0); diff --git a/sound/isa/sb/sb8.c b/sound/isa/sb/sb8.c index 60ee79cd14a3..3efa23d303c3 100644 --- a/sound/isa/sb/sb8.c +++ b/sound/isa/sb/sb8.c @@ -258,8 +258,10 @@ static int __init alsa_card_sb8_init(void) return err; cards = 0; - for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { + for (i = 0; i < SNDRV_CARDS; i++) { struct platform_device *device; + if (! enable[i]) + continue; device = platform_device_register_simple(SND_SB8_DRIVER, i, NULL, 0); if (IS_ERR(device)) { diff --git a/sound/isa/sgalaxy.c b/sound/isa/sgalaxy.c index 0dbbb35b242c..a60e66afbf90 100644 --- a/sound/isa/sgalaxy.c +++ b/sound/isa/sgalaxy.c @@ -360,8 +360,10 @@ static int __init alsa_card_sgalaxy_init(void) return err; cards = 0; - for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { + for (i = 0; i < SNDRV_CARDS; i++) { struct platform_device *device; + if (! enable[i]) + continue; device = platform_device_register_simple(SND_SGALAXY_DRIVER, i, NULL, 0); if (IS_ERR(device)) { diff --git a/sound/isa/wavefront/wavefront.c b/sound/isa/wavefront/wavefront.c index fa3ab960de17..c0115bf9065e 100644 --- a/sound/isa/wavefront/wavefront.c +++ b/sound/isa/wavefront/wavefront.c @@ -710,8 +710,10 @@ static int __init alsa_card_wavefront_init(void) if ((err = platform_driver_register(&snd_wavefront_driver)) < 0) return err; - for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { + for (i = 0; i < SNDRV_CARDS; i++) { struct platform_device *device; + if (! enable[i]) + continue; #ifdef CONFIG_PNP if (isapnp[i]) continue; -- cgit v1.2.3 From a5a6bbd9b2481dd556236ea866424590f5f987a4 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 27 Feb 2006 17:20:41 +0100 Subject: [ALSA] cs4236 - Fix a typo Modules: CS4236+ driver Fixed a typo in snd_cs4236_put_master_digital(), resulting in silence right channel. Signed-off-by: Takashi Iwai --- sound/isa/cs423x/cs4236_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'sound/isa') diff --git a/sound/isa/cs423x/cs4236_lib.c b/sound/isa/cs423x/cs4236_lib.c index 1125ddb2b1aa..7a5a6c71f5e4 100644 --- a/sound/isa/cs423x/cs4236_lib.c +++ b/sound/isa/cs423x/cs4236_lib.c @@ -644,7 +644,7 @@ static int snd_cs4236_put_master_digital(struct snd_kcontrol *kcontrol, struct s val2 = (chip->eimage[CS4236_REG(CS4236_RIGHT_MASTER)] & ~0x7f) | val2; change = val1 != chip->eimage[CS4236_REG(CS4236_LEFT_MASTER)] || val2 != chip->eimage[CS4236_REG(CS4236_RIGHT_MASTER)]; snd_cs4236_ext_out(chip, CS4236_LEFT_MASTER, val1); - snd_cs4236_ext_out(chip, CS4236_RIGHT_MASTER, val1); + snd_cs4236_ext_out(chip, CS4236_RIGHT_MASTER, val2); spin_unlock_irqrestore(&chip->reg_lock, flags); return change; } -- cgit v1.2.3 From 0bbbc4ca7e2459f2750bd4bd8dda2ccbf7a71f02 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Mon, 27 Feb 2006 17:23:46 +0100 Subject: [ALSA] opti9x - Fix compile without CONFIG_PNP Modules: Opti9xx drivers Fix compile errors without CONFIG_PNP. Signed-off-by: Takashi Iwai --- sound/isa/opti9xx/opti92x-ad1848.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'sound/isa') diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c index 63d96be11b2b..65b28cbc0ebd 100644 --- a/sound/isa/opti9xx/opti92x-ad1848.c +++ b/sound/isa/opti9xx/opti92x-ad1848.c @@ -2088,9 +2088,11 @@ static int __init alsa_card_opti9xx_init(void) int error; struct platform_device *device; +#ifdef CONFIG_PNP pnp_register_card_driver(&opti9xx_pnpc_driver); if (snd_opti9xx_pnp_is_probed) return 0; +#endif if (! is_isapnp_selected()) { error = platform_driver_register(&snd_opti9xx_driver); if (error < 0) @@ -2102,7 +2104,9 @@ static int __init alsa_card_opti9xx_init(void) } platform_driver_unregister(&snd_opti9xx_driver); } +#ifdef CONFIG_PNP pnp_unregister_card_driver(&opti9xx_pnpc_driver); +#endif #ifdef MODULE printk(KERN_ERR "no OPTi " CHIP_NAME " soundcard found\n"); #endif @@ -2115,7 +2119,9 @@ static void __exit alsa_card_opti9xx_exit(void) platform_device_unregister(snd_opti9xx_platform_device); platform_driver_unregister(&snd_opti9xx_driver); } +#ifdef CONFIG_PNP pnp_unregister_card_driver(&opti9xx_pnpc_driver); +#endif } module_init(alsa_card_opti9xx_init) -- cgit v1.2.3 From bcc54f9a563f146e723ead16c76f842bcaeb694e Mon Sep 17 00:00:00 2001 From: Dave Jones Date: Mon, 6 Mar 2006 13:28:34 +0100 Subject: [ALSA] sound/isa/sb/sb_mixer.c double kfree Modules: SB drivers snd_ctl_add() already does the free on error. Coverity bug #957 Signed-off-by: Dave Jones Signed-off-by: Takashi Iwai --- sound/isa/sb/sb_mixer.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'sound/isa') diff --git a/sound/isa/sb/sb_mixer.c b/sound/isa/sb/sb_mixer.c index 1a6ee344dddb..490b1ca5cf58 100644 --- a/sound/isa/sb/sb_mixer.c +++ b/sound/isa/sb/sb_mixer.c @@ -453,10 +453,8 @@ int snd_sbmixer_add_ctl(struct snd_sb *chip, const char *name, int index, int ty strlcpy(ctl->id.name, name, sizeof(ctl->id.name)); ctl->id.index = index; ctl->private_value = value; - if ((err = snd_ctl_add(chip->card, ctl)) < 0) { - snd_ctl_free_one(ctl); + if ((err = snd_ctl_add(chip->card, ctl)) < 0) return err; - } return 0; } -- cgit v1.2.3 From 3de4414e798795ef5d719622dbf12bbe27a9e72e Mon Sep 17 00:00:00 2001 From: Dave Jones Date: Mon, 6 Mar 2006 13:31:18 +0100 Subject: [ALSA] ad1848 double free Modules: AD1848 driver Same again, snd_ctl_add() already kfree's on error. Coverity #956 Signed-off-by: Dave Jones Signed-off-by: Takashi Iwai --- sound/isa/ad1848/ad1848_lib.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'sound/isa') diff --git a/sound/isa/ad1848/ad1848_lib.c b/sound/isa/ad1848/ad1848_lib.c index d4b0e580557e..e0f8baa843b9 100644 --- a/sound/isa/ad1848/ad1848_lib.c +++ b/sound/isa/ad1848/ad1848_lib.c @@ -1202,10 +1202,8 @@ int snd_ad1848_add_ctl(struct snd_ad1848 *chip, const char *name, int index, int strlcpy(ctl->id.name, name, sizeof(ctl->id.name)); ctl->id.index = index; ctl->private_value = value; - if ((err = snd_ctl_add(chip->card, ctl)) < 0) { - snd_ctl_free_one(ctl); + if ((err = snd_ctl_add(chip->card, ctl)) < 0) return err; - } return 0; } -- cgit v1.2.3 From 202728d783a0fc180e7141d18186eeae167218a1 Mon Sep 17 00:00:00 2001 From: Adrian Bunk Date: Tue, 14 Mar 2006 09:44:19 +0100 Subject: [ALSA] fix some memory leaks Modules: Generic drivers,ES18xx driver,CS46xx driver This patch fixes two memory leaks spotted by the Coverity checker. Signed-off-by: Adrian Bunk Signed-off-by: Takashi Iwai --- sound/drivers/serial-u16550.c | 1 + sound/isa/es18xx.c | 1 + sound/pci/cs46xx/dsp_spos.c | 10 +++++++--- 3 files changed, 9 insertions(+), 3 deletions(-) (limited to 'sound/isa') diff --git a/sound/drivers/serial-u16550.c b/sound/drivers/serial-u16550.c index 13b46d12564a..1a7fbefe4740 100644 --- a/sound/drivers/serial-u16550.c +++ b/sound/drivers/serial-u16550.c @@ -789,6 +789,7 @@ static int __init snd_uart16550_create(struct snd_card *card, if ((err = snd_uart16550_detect(uart)) <= 0) { printk(KERN_ERR "no UART detected at 0x%lx\n", iobase); + snd_uart16550_free(uart); return -ENODEV; } diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c index bb709264216f..721955d26194 100644 --- a/sound/isa/es18xx.c +++ b/sound/isa/es18xx.c @@ -2083,6 +2083,7 @@ static int __devinit snd_audiodrive_pnp(int dev, struct snd_audiodrive *acard, err = pnp_activate_dev(acard->devc); if (err < 0) { snd_printk(KERN_ERR PFX "PnP control configure failure (out of resources?)\n"); + kfree(cfg); return -EAGAIN; } snd_printdd("pnp: port=0x%lx\n", pnp_port_start(acard->devc, 0)); diff --git a/sound/pci/cs46xx/dsp_spos.c b/sound/pci/cs46xx/dsp_spos.c index 8726a68051e7..f407d2a5ce3b 100644 --- a/sound/pci/cs46xx/dsp_spos.c +++ b/sound/pci/cs46xx/dsp_spos.c @@ -237,7 +237,7 @@ struct dsp_spos_instance *cs46xx_dsp_spos_create (struct snd_cs46xx * chip) if (ins->symbol_table.symbols == NULL) { cs46xx_dsp_spos_destroy(chip); - return NULL; + goto error; } ins->code.offset = 0; @@ -246,7 +246,7 @@ struct dsp_spos_instance *cs46xx_dsp_spos_create (struct snd_cs46xx * chip) if (ins->code.data == NULL) { cs46xx_dsp_spos_destroy(chip); - return NULL; + goto error; } ins->nscb = 0; @@ -257,7 +257,7 @@ struct dsp_spos_instance *cs46xx_dsp_spos_create (struct snd_cs46xx * chip) if (ins->modules == NULL) { cs46xx_dsp_spos_destroy(chip); - return NULL; + goto error; } /* default SPDIF input sample rate @@ -280,6 +280,10 @@ struct dsp_spos_instance *cs46xx_dsp_spos_create (struct snd_cs46xx * chip) /* left and right validity bits */ (1 << 13) | (1 << 12); return ins; + +error: + kfree(ins); + return NULL; } void cs46xx_dsp_spos_destroy (struct snd_cs46xx * chip) -- cgit v1.2.3 From d61975fc6b40dadd2cd61fc9535499c7d7b806de Mon Sep 17 00:00:00 2001 From: Eugene Teo Date: Fri, 17 Mar 2006 16:32:52 +0100 Subject: [ALSA] Fix gus_pcm dereference before NULL Modules: GUS Library The NULL check of substream is simply superfluous. It is guaranteed to receive non-NULL substream. Thanks Takashi. Coverity bug #861 Signed-off-by: Eugene Teo Signed-off-by: Takashi Iwai --- sound/isa/gus/gus_pcm.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'sound/isa') diff --git a/sound/isa/gus/gus_pcm.c b/sound/isa/gus/gus_pcm.c index d0829393ec8a..c7f95e7aa018 100644 --- a/sound/isa/gus/gus_pcm.c +++ b/sound/isa/gus/gus_pcm.c @@ -114,8 +114,6 @@ static void snd_gf1_pcm_trigger_up(struct snd_pcm_substream *substream) unsigned char pan; unsigned int voice; - if (substream == NULL) - return; spin_lock_irqsave(&pcmp->lock, flags); if (pcmp->flags & SNDRV_GF1_PCM_PFLG_ACTIVE) { spin_unlock_irqrestore(&pcmp->lock, flags); -- cgit v1.2.3 From ed7cb1913168fdce6d084f2f5cd6818851313383 Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas Date: Mon, 27 Mar 2006 01:17:04 -0800 Subject: [PATCH] pnp: cs4236: adjust pnp_register_driver signature Remove the assumption that pnp_register_driver() returns the number of devices claimed. Signed-off-by: Bjorn Helgaas Cc: Adam Belay Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- sound/isa/cs423x/cs4236.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) (limited to 'sound/isa') diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c index 4060918e0327..382bb17ef49f 100644 --- a/sound/isa/cs423x/cs4236.c +++ b/sound/isa/cs423x/cs4236.c @@ -133,6 +133,7 @@ static int pnpc_registered; static int pnp_registered; #endif #endif /* CONFIG_PNP */ +static unsigned int snd_cs423x_devices; struct snd_card_cs4236 { struct snd_cs4231 *chip; @@ -564,7 +565,7 @@ static int __init snd_cs423x_nonpnp_probe(struct platform_device *pdev) snd_card_free(card); return err; } - + platform_set_drvdata(pdev, card); return 0; } @@ -650,6 +651,7 @@ static int __devinit snd_cs4232_pnpbios_detect(struct pnp_dev *pdev, } pnp_set_drvdata(pdev, card); dev++; + snd_cs423x_devices++; return 0; } @@ -713,6 +715,7 @@ static int __devinit snd_cs423x_pnpc_detect(struct pnp_card_link *pcard, } pnp_set_card_drvdata(pcard, card); dev++; + snd_cs423x_devices++; return 0; } @@ -721,7 +724,7 @@ static void __devexit snd_cs423x_pnpc_remove(struct pnp_card_link * pcard) snd_card_free(pnp_get_card_drvdata(pcard)); pnp_set_card_drvdata(pcard, NULL); } - + #ifdef CONFIG_PM static int snd_cs423x_pnpc_suspend(struct pnp_card_link *pcard, pm_message_t state) { @@ -766,7 +769,7 @@ static void __init_or_module snd_cs423x_unregister_all(void) static int __init alsa_card_cs423x_init(void) { - int i, err, cards = 0; + int i, err; if ((err = platform_driver_register(&cs423x_nonpnp_driver)) < 0) return err; @@ -782,24 +785,20 @@ static int __init alsa_card_cs423x_init(void) goto errout; } platform_devices[i] = device; - cards++; + snd_cs423x_devices++; } #ifdef CONFIG_PNP #ifdef CS4232 - i = pnp_register_driver(&cs4232_pnp_driver); - if (i >= 0) { + err = pnp_register_driver(&cs4232_pnp_driver); + if (!err) pnp_registered = 1; - cards += i; - } #endif - i = pnp_register_card_driver(&cs423x_pnpc_driver); - if (i >= 0) { + err = pnp_register_card_driver(&cs423x_pnpc_driver); + if (!err) pnpc_registered = 1; - cards += i; - } #endif /* CONFIG_PNP */ - if (!cards) { + if (!snd_cs423x_devices) { #ifdef MODULE printk(KERN_ERR IDENT " soundcard not found or device busy\n"); #endif -- cgit v1.2.3 From 8c59c4a2216583cf79eaaaf71ef1dd5757e12854 Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas Date: Mon, 27 Mar 2006 01:17:05 -0800 Subject: [PATCH] pnp: opl3sa2: adjust pnp_register_driver signature Remove the assumption that pnp_register_driver() returns the number of devices claimed. Signed-off-by: Bjorn Helgaas Cc: Adam Belay Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- sound/isa/opl3sa2.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'sound/isa') diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c index 56fcd8a946a4..c906e205d7d5 100644 --- a/sound/isa/opl3sa2.c +++ b/sound/isa/opl3sa2.c @@ -95,6 +95,7 @@ static struct platform_device *platform_devices[SNDRV_CARDS]; static int pnp_registered; static int pnpc_registered; #endif +static unsigned int snd_opl3sa2_devices; /* control ports */ #define OPL3SA2_PM_CTRL 0x01 @@ -760,6 +761,7 @@ static int __devinit snd_opl3sa2_pnp_detect(struct pnp_dev *pdev, } pnp_set_drvdata(pdev, card); dev++; + snd_opl3sa2_devices++; return 0; } @@ -826,6 +828,7 @@ static int __devinit snd_opl3sa2_pnp_cdetect(struct pnp_card_link *pcard, } pnp_set_card_drvdata(pcard, card); dev++; + snd_opl3sa2_devices++; return 0; } @@ -944,7 +947,7 @@ static void __init_or_module snd_opl3sa2_unregister_all(void) static int __init alsa_card_opl3sa2_init(void) { - int i, err, cards = 0; + int i, err; if ((err = platform_driver_register(&snd_opl3sa2_nonpnp_driver)) < 0) return err; @@ -964,23 +967,19 @@ static int __init alsa_card_opl3sa2_init(void) goto errout; } platform_devices[i] = device; - cards++; + snd_opl3sa2_devices++; } #ifdef CONFIG_PNP err = pnp_register_driver(&opl3sa2_pnp_driver); - if (err >= 0) { + if (!err) pnp_registered = 1; - cards += err; - } err = pnp_register_card_driver(&opl3sa2_pnpc_driver); - if (err >= 0) { + if (!err) pnpc_registered = 1; - cards += err; - } #endif - if (!cards) { + if (!snd_opl3sa2_devices) { #ifdef MODULE snd_printk(KERN_ERR "Yamaha OPL3-SA soundcard not found or device busy\n"); #endif -- cgit v1.2.3 From 5f53f4e2107fcfdd33da1cc34a86c9aef5e76af6 Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas Date: Mon, 27 Mar 2006 01:17:08 -0800 Subject: [PATCH] PNP: adjust pnp_register_card_driver() signature: ad1816a Remove the assumption that pnp_register_card_driver() returns the number of devices claimed. Signed-off-by: Bjorn Helgaas Cc: Adam Belay Cc: Jaroslav Kysela Acked-by: Takashi Iwai Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- sound/isa/ad1816a/ad1816a.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'sound/isa') diff --git a/sound/isa/ad1816a/ad1816a.c b/sound/isa/ad1816a/ad1816a.c index 7051f7798ed7..31f299aed281 100644 --- a/sound/isa/ad1816a/ad1816a.c +++ b/sound/isa/ad1816a/ad1816a.c @@ -262,6 +262,8 @@ static int __devinit snd_card_ad1816a_probe(int dev, struct pnp_card_link *pcard return 0; } +static unsigned int __devinitdata ad1816a_devices; + static int __devinit snd_ad1816a_pnp_detect(struct pnp_card_link *card, const struct pnp_card_device_id *id) { @@ -275,6 +277,7 @@ static int __devinit snd_ad1816a_pnp_detect(struct pnp_card_link *card, if (res < 0) return res; dev++; + ad1816a_devices++; return 0; } return -ENODEV; @@ -297,10 +300,13 @@ static struct pnp_card_driver ad1816a_pnpc_driver = { static int __init alsa_card_ad1816a_init(void) { - int cards; + int err; + + err = pnp_register_card_driver(&ad1816a_pnpc_driver); + if (err) + return err; - cards = pnp_register_card_driver(&ad1816a_pnpc_driver); - if (cards <= 0) { + if (!ad1816a_devices) { pnp_unregister_card_driver(&ad1816a_pnpc_driver); #ifdef MODULE printk(KERN_ERR "no AD1816A based soundcards found.\n"); -- cgit v1.2.3 From 51427ec0f222cb73b21f3849416a95d751bdd742 Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas Date: Mon, 27 Mar 2006 01:17:09 -0800 Subject: [PATCH] PNP: adjust pnp_register_card_driver() signature: als100 Remove the assumption that pnp_register_card_driver() returns the number of devices claimed. And fix a __init/__devinit issue. Signed-off-by: Bjorn Helgaas Cc: Adam Belay Cc: Jaroslav Kysela Acked-by: Takashi Iwai Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- sound/isa/als100.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'sound/isa') diff --git a/sound/isa/als100.c b/sound/isa/als100.c index 9b77c17b3f66..a52bd8a14c9b 100644 --- a/sound/isa/als100.c +++ b/sound/isa/als100.c @@ -199,7 +199,7 @@ static int __devinit snd_card_als100_pnp(int dev, struct snd_card_als100 *acard, return 0; } -static int __init snd_card_als100_probe(int dev, +static int __devinit snd_card_als100_probe(int dev, struct pnp_card_link *pcard, const struct pnp_card_device_id *pid) { @@ -281,6 +281,8 @@ static int __init snd_card_als100_probe(int dev, return 0; } +static unsigned int __devinitdata als100_devices; + static int __devinit snd_als100_pnp_detect(struct pnp_card_link *card, const struct pnp_card_device_id *id) { @@ -294,6 +296,7 @@ static int __devinit snd_als100_pnp_detect(struct pnp_card_link *card, if (res < 0) return res; dev++; + als100_devices++; return 0; } return -ENODEV; @@ -345,10 +348,13 @@ static struct pnp_card_driver als100_pnpc_driver = { static int __init alsa_card_als100_init(void) { - int cards; + int err; + + err = pnp_register_card_driver(&als100_pnpc_driver); + if (err) + return err; - cards = pnp_register_card_driver(&als100_pnpc_driver); - if (cards <= 0) { + if (!als100_devices) { pnp_unregister_card_driver(&als100_pnpc_driver); #ifdef MODULE snd_printk(KERN_ERR "no ALS100 based soundcards found\n"); -- cgit v1.2.3 From db2735eb9076c5176ec9dcbbaefd38e7d82f0e47 Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas Date: Mon, 27 Mar 2006 01:17:10 -0800 Subject: [PATCH] PNP: adjust pnp_register_card_driver() signature: azt2320 Remove the assumption that pnp_register_card_driver() returns the number of devices claimed. Signed-off-by: Bjorn Helgaas Cc: Adam Belay Cc: Jaroslav Kysela Acked-by: Takashi Iwai Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- sound/isa/azt2320.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'sound/isa') diff --git a/sound/isa/azt2320.c b/sound/isa/azt2320.c index a530691bf4f7..15e59283aac6 100644 --- a/sound/isa/azt2320.c +++ b/sound/isa/azt2320.c @@ -310,6 +310,8 @@ static int __devinit snd_card_azt2320_probe(int dev, return 0; } +static unsigned int __devinitdata azt2320_devices; + static int __devinit snd_azt2320_pnp_detect(struct pnp_card_link *card, const struct pnp_card_device_id *id) { @@ -323,6 +325,7 @@ static int __devinit snd_azt2320_pnp_detect(struct pnp_card_link *card, if (res < 0) return res; dev++; + azt2320_devices++; return 0; } return -ENODEV; @@ -372,10 +375,13 @@ static struct pnp_card_driver azt2320_pnpc_driver = { static int __init alsa_card_azt2320_init(void) { - int cards; + int err; + + err = pnp_register_card_driver(&azt2320_pnpc_driver); + if (err) + return err; - cards = pnp_register_card_driver(&azt2320_pnpc_driver); - if (cards <= 0) { + if (!azt2320_devices) { pnp_unregister_card_driver(&azt2320_pnpc_driver); #ifdef MODULE snd_printk(KERN_ERR "no AZT2320 based soundcards found\n"); -- cgit v1.2.3 From 07d58ad06b46e630a5ff6b10e9b81f370b175b56 Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas Date: Mon, 27 Mar 2006 01:17:11 -0800 Subject: [PATCH] PNP: adjust pnp_register_card_driver() signature: cmi8330 Remove the assumption that pnp_register_card_driver() returns the number of devices claimed. And fix some __init/__devinit issues. Signed-off-by: Bjorn Helgaas Cc: Adam Belay Cc: Jaroslav Kysela Acked-by: Takashi Iwai Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- sound/isa/cmi8330.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'sound/isa') diff --git a/sound/isa/cmi8330.c b/sound/isa/cmi8330.c index fd9bb2575de8..fa63048a8b9d 100644 --- a/sound/isa/cmi8330.c +++ b/sound/isa/cmi8330.c @@ -175,7 +175,7 @@ MODULE_DEVICE_TABLE(pnp_card, snd_cmi8330_pnpids); #endif -static struct ad1848_mix_elem snd_cmi8330_controls[] __initdata = { +static struct ad1848_mix_elem snd_cmi8330_controls[] __devinitdata = { AD1848_DOUBLE("Master Playback Volume", 0, CMI8330_MASTVOL, CMI8330_MASTVOL, 4, 0, 15, 0), AD1848_SINGLE("Loud Playback Switch", 0, CMI8330_MUTEMUX, 6, 1, 1), AD1848_DOUBLE("PCM Playback Switch", 0, AD1848_LEFT_OUTPUT, AD1848_RIGHT_OUTPUT, 7, 7, 1, 1), @@ -204,7 +204,7 @@ AD1848_SINGLE(SNDRV_CTL_NAME_IEC958("Input ",PLAYBACK,SWITCH), 0, CMI8330_MUTEMU }; #ifdef ENABLE_SB_MIXER -static struct sbmix_elem cmi8330_sb_mixers[] __initdata = { +static struct sbmix_elem cmi8330_sb_mixers[] __devinitdata = { SB_DOUBLE("SB Master Playback Volume", SB_DSP4_MASTER_DEV, (SB_DSP4_MASTER_DEV + 1), 3, 3, 31), SB_DOUBLE("Tone Control - Bass", SB_DSP4_BASS_DEV, (SB_DSP4_BASS_DEV + 1), 4, 4, 15), SB_DOUBLE("Tone Control - Treble", SB_DSP4_TREBLE_DEV, (SB_DSP4_TREBLE_DEV + 1), 4, 4, 15), @@ -222,7 +222,7 @@ SB_DOUBLE("SB Playback Volume", SB_DSP4_OGAIN_DEV, (SB_DSP4_OGAIN_DEV + 1), 6, 6 SB_SINGLE("SB Mic Auto Gain", SB_DSP4_MIC_AGC, 0, 1), }; -static unsigned char cmi8330_sb_init_values[][2] __initdata = { +static unsigned char cmi8330_sb_init_values[][2] __devinitdata = { { SB_DSP4_MASTER_DEV + 0, 0 }, { SB_DSP4_MASTER_DEV + 1, 0 }, { SB_DSP4_PCM_DEV + 0, 0 }, @@ -545,7 +545,7 @@ static int __devinit snd_cmi8330_probe(struct snd_card *card, int dev) return snd_card_register(card); } -static int __init snd_cmi8330_nonpnp_probe(struct platform_device *pdev) +static int __devinit snd_cmi8330_nonpnp_probe(struct platform_device *pdev) { struct snd_card *card; int err; @@ -607,6 +607,8 @@ static struct platform_driver snd_cmi8330_driver = { #ifdef CONFIG_PNP +static unsigned int __devinitdata cmi8330_pnp_devices; + static int __devinit snd_cmi8330_pnp_detect(struct pnp_card_link *pcard, const struct pnp_card_device_id *pid) { @@ -636,6 +638,7 @@ static int __devinit snd_cmi8330_pnp_detect(struct pnp_card_link *pcard, } pnp_set_card_drvdata(pcard, card); dev++; + cmi8330_pnp_devices++; return 0; } @@ -706,9 +709,9 @@ static int __init alsa_card_cmi8330_init(void) #ifdef CONFIG_PNP err = pnp_register_card_driver(&cmi8330_pnpc_driver); - if (err >= 0) { + if (!err) { pnp_registered = 1; - cards += err; + cards += cmi8330_pnp_devices; } #endif -- cgit v1.2.3 From 6736a6587b991477aae927c37176e8cab8689f9e Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas Date: Mon, 27 Mar 2006 01:17:12 -0800 Subject: [PATCH] PNP: adjust pnp_register_card_driver() signature: dt019x Remove the assumption that pnp_register_card_driver() returns the number of devices claimed. Signed-off-by: Bjorn Helgaas Cc: Adam Belay Cc: Jaroslav Kysela Acked-by: Takashi Iwai Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- sound/isa/dt019x.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'sound/isa') diff --git a/sound/isa/dt019x.c b/sound/isa/dt019x.c index 50e7bc5ef561..0acb4e5da47f 100644 --- a/sound/isa/dt019x.c +++ b/sound/isa/dt019x.c @@ -272,6 +272,8 @@ static int __devinit snd_card_dt019x_probe(int dev, struct pnp_card_link *pcard, return 0; } +static unsigned int __devinitdata dt019x_devices; + static int __devinit snd_dt019x_pnp_probe(struct pnp_card_link *card, const struct pnp_card_device_id *pid) { @@ -285,6 +287,7 @@ static int __devinit snd_dt019x_pnp_probe(struct pnp_card_link *card, if (res < 0) return res; dev++; + dt019x_devices++; return 0; } return -ENODEV; @@ -336,10 +339,13 @@ static struct pnp_card_driver dt019x_pnpc_driver = { static int __init alsa_card_dt019x_init(void) { - int cards = 0; + int err; + + err = pnp_register_card_driver(&dt019x_pnpc_driver); + if (err) + return err; - cards = pnp_register_card_driver(&dt019x_pnpc_driver); - if (cards <= 0) { + if (!dt019x_devices) { pnp_unregister_card_driver(&dt019x_pnpc_driver); #ifdef MODULE snd_printk(KERN_ERR "no DT-019X / ALS-007 based soundcards found\n"); -- cgit v1.2.3 From fea9739f2a1aed1cfb9b7af7cce66b28b68d4394 Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas Date: Mon, 27 Mar 2006 01:17:13 -0800 Subject: [PATCH] PNP: adjust pnp_register_card_driver() signature: es18xx Remove the assumption that pnp_register_card_driver() returns the number of devices claimed. And fix some __init/__devinit issues. Signed-off-by: Bjorn Helgaas Cc: Adam Belay Cc: Jaroslav Kysela Acked-by: Takashi Iwai Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- sound/isa/es18xx.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'sound/isa') diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c index 721955d26194..9fbc185b4cc2 100644 --- a/sound/isa/es18xx.c +++ b/sound/isa/es18xx.c @@ -2204,7 +2204,7 @@ static int __devinit snd_audiodrive_probe(struct snd_card *card, int dev) return snd_card_register(card); } -static int __init snd_es18xx_nonpnp_probe1(int dev, struct platform_device *devptr) +static int __devinit snd_es18xx_nonpnp_probe1(int dev, struct platform_device *devptr) { struct snd_card *card; int err; @@ -2221,7 +2221,7 @@ static int __init snd_es18xx_nonpnp_probe1(int dev, struct platform_device *devp return 0; } -static int __init snd_es18xx_nonpnp_probe(struct platform_device *pdev) +static int __devinit snd_es18xx_nonpnp_probe(struct platform_device *pdev) { int dev = pdev->id; int err; @@ -2297,6 +2297,8 @@ static struct platform_driver snd_es18xx_nonpnp_driver = { #ifdef CONFIG_PNP +static unsigned int __devinitdata es18xx_pnp_devices; + static int __devinit snd_audiodrive_pnp_detect(struct pnp_card_link *pcard, const struct pnp_card_device_id *pid) { @@ -2327,6 +2329,7 @@ static int __devinit snd_audiodrive_pnp_detect(struct pnp_card_link *pcard, pnp_set_card_drvdata(pcard, card); dev++; + es18xx_pnp_devices++; return 0; } @@ -2397,10 +2400,10 @@ static int __init alsa_card_es18xx_init(void) } #ifdef CONFIG_PNP - i = pnp_register_card_driver(&es18xx_pnpc_driver); - if (i >= 0) { + err = pnp_register_card_driver(&es18xx_pnpc_driver); + if (!err) { pnp_registered = 1; - cards += i; + cards += es18xx_pnp_devices; } #endif -- cgit v1.2.3 From 6a3a3a0260cf5a4e5942db8d56cae4db4dc139a6 Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas Date: Mon, 27 Mar 2006 01:17:14 -0800 Subject: [PATCH] PNP: adjust pnp_register_card_driver() signature: es968 Remove the assumption that pnp_register_card_driver() returns the number of devices claimed. And fix some __init/__devinit issues. Signed-off-by: Bjorn Helgaas Cc: Adam Belay Cc: Jaroslav Kysela Acked-by: Takashi Iwai Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- sound/isa/sb/es968.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'sound/isa') diff --git a/sound/isa/sb/es968.c b/sound/isa/sb/es968.c index 9da80bfa3027..d4d65b84265a 100644 --- a/sound/isa/sb/es968.c +++ b/sound/isa/sb/es968.c @@ -124,7 +124,7 @@ static int __devinit snd_card_es968_pnp(int dev, struct snd_card_es968 *acard, return 0; } -static int __init snd_card_es968_probe(int dev, +static int __devinit snd_card_es968_probe(int dev, struct pnp_card_link *pcard, const struct pnp_card_device_id *pid) { @@ -182,6 +182,8 @@ static int __init snd_card_es968_probe(int dev, return 0; } +static unsigned int __devinitdata es968_devices; + static int __devinit snd_es968_pnp_detect(struct pnp_card_link *card, const struct pnp_card_device_id *id) { @@ -195,6 +197,7 @@ static int __devinit snd_es968_pnp_detect(struct pnp_card_link *card, if (res < 0) return res; dev++; + es968_devices++; return 0; } return -ENODEV; @@ -246,8 +249,11 @@ static struct pnp_card_driver es968_pnpc_driver = { static int __init alsa_card_es968_init(void) { - int cards = pnp_register_card_driver(&es968_pnpc_driver); - if (cards <= 0) { + int err = pnp_register_card_driver(&es968_pnpc_driver); + if (err) + return err; + + if (!es968_devices) { pnp_unregister_card_driver(&es968_pnpc_driver); #ifdef MODULE snd_printk(KERN_ERR "no ES968 based soundcards found\n"); -- cgit v1.2.3 From ebdb71ea7b384ff3f32dd038dba0aad58580e832 Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas Date: Mon, 27 Mar 2006 01:17:14 -0800 Subject: [PATCH] PNP: adjust pnp_register_card_driver() signature: interwave Remove the assumption that pnp_register_card_driver() returns the number of devices claimed. And fix some __init/__devinit issues. Signed-off-by: Bjorn Helgaas Cc: Adam Belay Cc: Jaroslav Kysela Acked-by: Takashi Iwai Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- sound/isa/gus/interwave.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'sound/isa') diff --git a/sound/isa/gus/interwave.c b/sound/isa/gus/interwave.c index 2cacd0fa6871..de71b7a99c83 100644 --- a/sound/isa/gus/interwave.c +++ b/sound/isa/gus/interwave.c @@ -791,7 +791,7 @@ static int __devinit snd_interwave_probe(struct snd_card *card, int dev) return 0; } -static int __init snd_interwave_nonpnp_probe1(int dev, struct platform_device *devptr) +static int __devinit snd_interwave_nonpnp_probe1(int dev, struct platform_device *devptr) { struct snd_card *card; int err; @@ -809,7 +809,7 @@ static int __init snd_interwave_nonpnp_probe1(int dev, struct platform_device *d return 0; } -static int __init snd_interwave_nonpnp_probe(struct platform_device *pdev) +static int __devinit snd_interwave_nonpnp_probe(struct platform_device *pdev) { int dev = pdev->id; int err; @@ -867,6 +867,7 @@ static struct platform_driver snd_interwave_driver = { }; #ifdef CONFIG_PNP +static unsigned int __devinitdata interwave_pnp_devices; static int __devinit snd_interwave_pnp_detect(struct pnp_card_link *pcard, const struct pnp_card_device_id *pid) @@ -897,6 +898,7 @@ static int __devinit snd_interwave_pnp_detect(struct pnp_card_link *pcard, } pnp_set_card_drvdata(pcard, card); dev++; + interwave_pnp_devices++; return 0; } @@ -954,10 +956,10 @@ static int __init alsa_card_interwave_init(void) } /* ISA PnP cards */ - i = pnp_register_card_driver(&interwave_pnpc_driver); - if (i >= 0) { + err = pnp_register_card_driver(&interwave_pnpc_driver); + if (!err) { pnp_registered = 1; - cards += i; + cards += interwave_pnp_devices;; } if (!cards) { -- cgit v1.2.3 From 312fef308cb15e793d8902f1dbd318d01268d36e Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas Date: Mon, 27 Mar 2006 01:17:15 -0800 Subject: [PATCH] PNP: adjust pnp_register_card_driver() signature: sb16 Remove the assumption that pnp_register_card_driver() returns the number of devices claimed. And fix some __init/__devinit issues. Signed-off-by: Bjorn Helgaas Cc: Adam Belay Cc: Jaroslav Kysela Acked-by: Takashi Iwai Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- sound/isa/sb/sb16.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'sound/isa') diff --git a/sound/isa/sb/sb16.c b/sound/isa/sb/sb16.c index 5737ab76160c..21ea65925a9e 100644 --- a/sound/isa/sb/sb16.c +++ b/sound/isa/sb/sb16.c @@ -369,7 +369,7 @@ static struct snd_card *snd_sb16_card_new(int dev) return card; } -static int __init snd_sb16_probe(struct snd_card *card, int dev) +static int __devinit snd_sb16_probe(struct snd_card *card, int dev) { int xirq, xdma8, xdma16; struct snd_sb *chip; @@ -518,7 +518,7 @@ static int snd_sb16_resume(struct snd_card *card) } #endif -static int __init snd_sb16_nonpnp_probe1(int dev, struct platform_device *devptr) +static int __devinit snd_sb16_nonpnp_probe1(int dev, struct platform_device *devptr) { struct snd_card_sb16 *acard; struct snd_card *card; @@ -548,7 +548,7 @@ static int __init snd_sb16_nonpnp_probe1(int dev, struct platform_device *devptr } -static int __init snd_sb16_nonpnp_probe(struct platform_device *pdev) +static int __devinit snd_sb16_nonpnp_probe(struct platform_device *pdev) { int dev = pdev->id; int err; @@ -629,6 +629,7 @@ static struct platform_driver snd_sb16_nonpnp_driver = { #ifdef CONFIG_PNP +static unsigned int __devinitdata sb16_pnp_devices; static int __devinit snd_sb16_pnp_detect(struct pnp_card_link *pcard, const struct pnp_card_device_id *pid) @@ -651,6 +652,7 @@ static int __devinit snd_sb16_pnp_detect(struct pnp_card_link *pcard, } pnp_set_card_drvdata(pcard, card); dev++; + sb16_pnp_devices++; return 0; } @@ -727,10 +729,10 @@ static int __init alsa_card_sb16_init(void) } #ifdef CONFIG_PNP /* PnP cards at last */ - i = pnp_register_card_driver(&sb16_pnpc_driver); - if (i >= 0) { + err = pnp_register_card_driver(&sb16_pnpc_driver); + if (!err) { pnp_registered = 1; - cards += i; + cards += sb16_pnp_devices; } #endif -- cgit v1.2.3 From 38125956441c5cab28333414cee308d162507477 Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas Date: Mon, 27 Mar 2006 01:17:17 -0800 Subject: [PATCH] PNP: adjust pnp_register_card_driver() signature: sscape Remove the assumption that pnp_register_card_driver() returns the number of devices claimed. Signed-off-by: Bjorn Helgaas Cc: Adam Belay Cc: Jaroslav Kysela Acked-by: Takashi Iwai Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- sound/isa/sscape.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'sound/isa') diff --git a/sound/isa/sscape.c b/sound/isa/sscape.c index 29bba8cc3ef3..48e5552d3444 100644 --- a/sound/isa/sscape.c +++ b/sound/isa/sscape.c @@ -1255,7 +1255,7 @@ static int __devinit create_sscape(int dev, struct snd_card **rcardp) } -static int __init snd_sscape_probe(struct platform_device *pdev) +static int __devinit snd_sscape_probe(struct platform_device *pdev) { int dev = pdev->id; struct snd_card *card; @@ -1469,7 +1469,7 @@ static int __init sscape_init(void) if (ret < 0) return ret; #ifdef CONFIG_PNP - if (pnp_register_card_driver(&sscape_pnpc_driver) >= 0) + if (pnp_register_card_driver(&sscape_pnpc_driver) == 0) pnp_registered = 1; #endif return 0; -- cgit v1.2.3 From c94ded6e602594c8e66fd5b1ba832d5327f5c103 Mon Sep 17 00:00:00 2001 From: Bjorn Helgaas Date: Mon, 27 Mar 2006 01:17:18 -0800 Subject: [PATCH] PNP: adjust pnp_register_card_driver() signature: wavefront Remove the assumption that pnp_register_card_driver() returns the number of devices claimed. And fix some __init/__devinit issues. Signed-off-by: Bjorn Helgaas Cc: Adam Belay Cc: Jaroslav Kysela Acked-by: Takashi Iwai Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- sound/isa/wavefront/wavefront.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'sound/isa') diff --git a/sound/isa/wavefront/wavefront.c b/sound/isa/wavefront/wavefront.c index c0115bf9065e..2f13cd5d4dcb 100644 --- a/sound/isa/wavefront/wavefront.c +++ b/sound/isa/wavefront/wavefront.c @@ -589,7 +589,7 @@ snd_wavefront_probe (struct snd_card *card, int dev) return snd_card_register(card); } -static int __init snd_wavefront_nonpnp_probe(struct platform_device *pdev) +static int __devinit snd_wavefront_nonpnp_probe(struct platform_device *pdev) { int dev = pdev->id; struct snd_card *card; @@ -637,6 +637,7 @@ static struct platform_driver snd_wavefront_driver = { #ifdef CONFIG_PNP +static unsigned int __devinitdata wavefront_pnp_devices; static int __devinit snd_wavefront_pnp_detect(struct pnp_card_link *pcard, const struct pnp_card_device_id *pid) @@ -670,6 +671,7 @@ static int __devinit snd_wavefront_pnp_detect(struct pnp_card_link *pcard, pnp_set_card_drvdata(pcard, card); dev++; + wavefront_pnp_devices++; return 0; } @@ -729,10 +731,10 @@ static int __init alsa_card_wavefront_init(void) } #ifdef CONFIG_PNP - i = pnp_register_card_driver(&wavefront_pnpc_driver); - if (i >= 0) { + err = pnp_register_card_driver(&wavefront_pnpc_driver); + if (!err) { pnp_registered = 1; - cards += i; + cards += wavefront_pnp_devices; } #endif -- cgit v1.2.3