mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-23 12:14:10 +08:00
ALSA: gus: Fix assignment in if condition
ISA GUS driver code contains lots of assignments in if condition, which is a bad coding style that may confuse readers and occasionally lead to bugs. This patch is merely for coding-style fixes, no functional changes. Link: https://lore.kernel.org/r/20210608140540.17885-5-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
c305366a37
commit
310efd3aab
@ -165,12 +165,14 @@ int snd_gus_create(struct snd_card *card,
|
||||
gus->gf1.reg_timerctrl = GUSP(gus, TIMERCNTRL);
|
||||
gus->gf1.reg_timerdata = GUSP(gus, TIMERDATA);
|
||||
/* allocate resources */
|
||||
if ((gus->gf1.res_port1 = request_region(port, 16, "GUS GF1 (Adlib/SB)")) == NULL) {
|
||||
gus->gf1.res_port1 = request_region(port, 16, "GUS GF1 (Adlib/SB)");
|
||||
if (!gus->gf1.res_port1) {
|
||||
snd_printk(KERN_ERR "gus: can't grab SB port 0x%lx\n", port);
|
||||
snd_gus_free(gus);
|
||||
return -EBUSY;
|
||||
}
|
||||
if ((gus->gf1.res_port2 = request_region(port + 0x100, 12, "GUS GF1 (Synth)")) == NULL) {
|
||||
gus->gf1.res_port2 = request_region(port + 0x100, 12, "GUS GF1 (Synth)");
|
||||
if (!gus->gf1.res_port2) {
|
||||
snd_printk(KERN_ERR "gus: can't grab synth port 0x%lx\n", port + 0x100);
|
||||
snd_gus_free(gus);
|
||||
return -EBUSY;
|
||||
@ -215,7 +217,8 @@ int snd_gus_create(struct snd_card *card,
|
||||
gus->gf1.pcm_channels = pcm_channels;
|
||||
gus->gf1.volume_ramp = 25;
|
||||
gus->gf1.smooth_pan = 1;
|
||||
if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, gus, &ops)) < 0) {
|
||||
err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, gus, &ops);
|
||||
if (err < 0) {
|
||||
snd_gus_free(gus);
|
||||
return err;
|
||||
}
|
||||
@ -404,14 +407,17 @@ int snd_gus_initialize(struct snd_gus_card *gus)
|
||||
int err;
|
||||
|
||||
if (!gus->interwave) {
|
||||
if ((err = snd_gus_check_version(gus)) < 0) {
|
||||
err = snd_gus_check_version(gus);
|
||||
if (err < 0) {
|
||||
snd_printk(KERN_ERR "version check failed\n");
|
||||
return err;
|
||||
}
|
||||
if ((err = snd_gus_detect_memory(gus)) < 0)
|
||||
err = snd_gus_detect_memory(gus);
|
||||
if (err < 0)
|
||||
return err;
|
||||
}
|
||||
if ((err = snd_gus_init_dma_irq(gus, 1)) < 0)
|
||||
err = snd_gus_init_dma_irq(gus, 1);
|
||||
if (err < 0)
|
||||
return err;
|
||||
snd_gf1_start(gus);
|
||||
gus->initialized = 1;
|
||||
|
@ -210,7 +210,8 @@ int snd_gf1_mem_free(struct snd_gf1_mem * alloc, unsigned int address)
|
||||
struct snd_gf1_mem_block *block;
|
||||
|
||||
snd_gf1_mem_lock(alloc, 0);
|
||||
if ((block = snd_gf1_mem_look(alloc, address)) != NULL) {
|
||||
block = snd_gf1_mem_look(alloc, address);
|
||||
if (block) {
|
||||
result = snd_gf1_mem_xfree(alloc, block);
|
||||
snd_gf1_mem_lock(alloc, 1);
|
||||
return result;
|
||||
|
@ -162,12 +162,14 @@ int snd_gf1_new_mixer(struct snd_gus_card * gus)
|
||||
if (!gus->ics_flag) {
|
||||
max = gus->ess_flag ? 1 : ARRAY_SIZE(snd_gf1_controls);
|
||||
for (idx = 0; idx < max; idx++) {
|
||||
if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_gf1_controls[idx], gus))) < 0)
|
||||
err = snd_ctl_add(card, snd_ctl_new1(&snd_gf1_controls[idx], gus));
|
||||
if (err < 0)
|
||||
return err;
|
||||
}
|
||||
} else {
|
||||
for (idx = 0; idx < ARRAY_SIZE(snd_ics_controls); idx++) {
|
||||
if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_ics_controls[idx], gus))) < 0)
|
||||
err = snd_ctl_add(card, snd_ctl_new1(&snd_ics_controls[idx], gus));
|
||||
if (err < 0)
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
@ -430,17 +430,19 @@ static int snd_gf1_pcm_playback_hw_params(struct snd_pcm_substream *substream,
|
||||
snd_gf1_mem_free(&gus->gf1.mem_alloc, pcmp->memory);
|
||||
pcmp->memory = 0;
|
||||
}
|
||||
if ((block = snd_gf1_mem_alloc(&gus->gf1.mem_alloc,
|
||||
SNDRV_GF1_MEM_OWNER_DRIVER,
|
||||
"GF1 PCM",
|
||||
runtime->dma_bytes, 1, 32,
|
||||
NULL)) == NULL)
|
||||
block = snd_gf1_mem_alloc(&gus->gf1.mem_alloc,
|
||||
SNDRV_GF1_MEM_OWNER_DRIVER,
|
||||
"GF1 PCM",
|
||||
runtime->dma_bytes, 1, 32,
|
||||
NULL);
|
||||
if (!block)
|
||||
return -ENOMEM;
|
||||
pcmp->memory = block->ptr;
|
||||
}
|
||||
pcmp->voices = params_channels(hw_params);
|
||||
if (pcmp->pvoices[0] == NULL) {
|
||||
if ((pcmp->pvoices[0] = snd_gf1_alloc_voice(pcmp->gus, SNDRV_GF1_VOICE_TYPE_PCM, 0, 0)) == NULL)
|
||||
pcmp->pvoices[0] = snd_gf1_alloc_voice(pcmp->gus, SNDRV_GF1_VOICE_TYPE_PCM, 0, 0);
|
||||
if (!pcmp->pvoices[0])
|
||||
return -ENOMEM;
|
||||
pcmp->pvoices[0]->handler_wave = snd_gf1_pcm_interrupt_wave;
|
||||
pcmp->pvoices[0]->handler_volume = snd_gf1_pcm_interrupt_volume;
|
||||
@ -448,7 +450,8 @@ static int snd_gf1_pcm_playback_hw_params(struct snd_pcm_substream *substream,
|
||||
pcmp->pvoices[0]->private_data = pcmp;
|
||||
}
|
||||
if (pcmp->voices > 1 && pcmp->pvoices[1] == NULL) {
|
||||
if ((pcmp->pvoices[1] = snd_gf1_alloc_voice(pcmp->gus, SNDRV_GF1_VOICE_TYPE_PCM, 0, 0)) == NULL)
|
||||
pcmp->pvoices[1] = snd_gf1_alloc_voice(pcmp->gus, SNDRV_GF1_VOICE_TYPE_PCM, 0, 0);
|
||||
if (!pcmp->pvoices[1])
|
||||
return -ENOMEM;
|
||||
pcmp->pvoices[1]->handler_wave = snd_gf1_pcm_interrupt_wave;
|
||||
pcmp->pvoices[1]->handler_volume = snd_gf1_pcm_interrupt_volume;
|
||||
@ -689,7 +692,8 @@ static int snd_gf1_pcm_playback_open(struct snd_pcm_substream *substream)
|
||||
printk(KERN_DEBUG "playback.buffer = 0x%lx, gf1.pcm_buffer = 0x%lx\n",
|
||||
(long) pcm->playback.buffer, (long) gus->gf1.pcm_buffer);
|
||||
#endif
|
||||
if ((err = snd_gf1_dma_init(gus)) < 0)
|
||||
err = snd_gf1_dma_init(gus);
|
||||
if (err < 0)
|
||||
return err;
|
||||
pcmp->flags = SNDRV_GF1_PCM_PFLG_NONE;
|
||||
pcmp->substream = substream;
|
||||
@ -888,7 +892,8 @@ int snd_gf1_pcm_new(struct snd_gus_card *gus, int pcm_dev, int control_index)
|
||||
kctl = snd_ctl_new1(&snd_gf1_pcm_volume_control1, gus);
|
||||
else
|
||||
kctl = snd_ctl_new1(&snd_gf1_pcm_volume_control, gus);
|
||||
if ((err = snd_ctl_add(card, kctl)) < 0)
|
||||
err = snd_ctl_add(card, kctl);
|
||||
if (err < 0)
|
||||
return err;
|
||||
kctl->id.index = control_index;
|
||||
|
||||
|
@ -232,7 +232,8 @@ int snd_gf1_rawmidi_new(struct snd_gus_card *gus, int device)
|
||||
struct snd_rawmidi *rmidi;
|
||||
int err;
|
||||
|
||||
if ((err = snd_rawmidi_new(gus->card, "GF1", device, 1, 1, &rmidi)) < 0)
|
||||
err = snd_rawmidi_new(gus->card, "GF1", device, 1, 1, &rmidi);
|
||||
if (err < 0)
|
||||
return err;
|
||||
strcpy(rmidi->name, gus->interwave ? "AMD InterWave" : "GF1");
|
||||
snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT, &snd_gf1_uart_output);
|
||||
|
@ -113,14 +113,16 @@ static int snd_gusclassic_detect(struct snd_gus_card *gus)
|
||||
unsigned char d;
|
||||
|
||||
snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 0); /* reset GF1 */
|
||||
if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 0) {
|
||||
d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET);
|
||||
if ((d & 0x07) != 0) {
|
||||
snd_printdd("[0x%lx] check 1 failed - 0x%x\n", gus->gf1.port, d);
|
||||
return -ENODEV;
|
||||
}
|
||||
udelay(160);
|
||||
snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 1); /* release reset */
|
||||
udelay(160);
|
||||
if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 1) {
|
||||
d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET);
|
||||
if ((d & 0x07) != 1) {
|
||||
snd_printdd("[0x%lx] check 2 failed - 0x%x\n", gus->gf1.port, d);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
@ -177,14 +177,16 @@ static int snd_gusextreme_detect(struct snd_gus_card *gus,
|
||||
udelay(100);
|
||||
|
||||
snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 0); /* reset GF1 */
|
||||
if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 0) {
|
||||
d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET);
|
||||
if ((d & 0x07) != 0) {
|
||||
snd_printdd("[0x%lx] check 1 failed - 0x%x\n", gus->gf1.port, d);
|
||||
return -EIO;
|
||||
}
|
||||
udelay(160);
|
||||
snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 1); /* release reset */
|
||||
udelay(160);
|
||||
if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 1) {
|
||||
d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET);
|
||||
if ((d & 0x07) != 1) {
|
||||
snd_printdd("[0x%lx] check 2 failed - 0x%x\n", gus->gf1.port, d);
|
||||
return -EIO;
|
||||
}
|
||||
|
@ -71,14 +71,16 @@ static int snd_gusmax_detect(struct snd_gus_card *gus)
|
||||
unsigned char d;
|
||||
|
||||
snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 0); /* reset GF1 */
|
||||
if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 0) {
|
||||
d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET);
|
||||
if ((d & 0x07) != 0) {
|
||||
snd_printdd("[0x%lx] check 1 failed - 0x%x\n", gus->gf1.port, d);
|
||||
return -ENODEV;
|
||||
}
|
||||
udelay(160);
|
||||
snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 1); /* release reset */
|
||||
udelay(160);
|
||||
if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 1) {
|
||||
d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET);
|
||||
if ((d & 0x07) != 1) {
|
||||
snd_printdd("[0x%lx] check 2 failed - 0x%x\n", gus->gf1.port, d);
|
||||
return -ENODEV;
|
||||
}
|
||||
@ -136,20 +138,24 @@ static int snd_gusmax_mixer(struct snd_wss *chip)
|
||||
/* reassign AUXA to SYNTHESIZER */
|
||||
strcpy(id1.name, "Aux Playback Switch");
|
||||
strcpy(id2.name, "Synth Playback Switch");
|
||||
if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0)
|
||||
err = snd_ctl_rename_id(card, &id1, &id2);
|
||||
if (err < 0)
|
||||
return err;
|
||||
strcpy(id1.name, "Aux Playback Volume");
|
||||
strcpy(id2.name, "Synth Playback Volume");
|
||||
if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0)
|
||||
err = snd_ctl_rename_id(card, &id1, &id2);
|
||||
if (err < 0)
|
||||
return err;
|
||||
/* reassign AUXB to CD */
|
||||
strcpy(id1.name, "Aux Playback Switch"); id1.index = 1;
|
||||
strcpy(id2.name, "CD Playback Switch");
|
||||
if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0)
|
||||
err = snd_ctl_rename_id(card, &id1, &id2);
|
||||
if (err < 0)
|
||||
return err;
|
||||
strcpy(id1.name, "Aux Playback Volume");
|
||||
strcpy(id2.name, "CD Playback Volume");
|
||||
if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0)
|
||||
err = snd_ctl_rename_id(card, &id1, &id2);
|
||||
if (err < 0)
|
||||
return err;
|
||||
#if 0
|
||||
/* reassign Mono Input to MIC */
|
||||
@ -209,7 +215,8 @@ static int snd_gusmax_probe(struct device *pdev, unsigned int dev)
|
||||
|
||||
xirq = irq[dev];
|
||||
if (xirq == SNDRV_AUTO_IRQ) {
|
||||
if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) {
|
||||
xirq = snd_legacy_find_free_irq(possible_irqs);
|
||||
if (xirq < 0) {
|
||||
snd_printk(KERN_ERR PFX "unable to find a free IRQ\n");
|
||||
err = -EBUSY;
|
||||
goto _err;
|
||||
@ -217,7 +224,8 @@ static int snd_gusmax_probe(struct device *pdev, unsigned int dev)
|
||||
}
|
||||
xdma1 = dma1[dev];
|
||||
if (xdma1 == SNDRV_AUTO_DMA) {
|
||||
if ((xdma1 = snd_legacy_find_free_dma(possible_dmas)) < 0) {
|
||||
xdma1 = snd_legacy_find_free_dma(possible_dmas);
|
||||
if (xdma1 < 0) {
|
||||
snd_printk(KERN_ERR PFX "unable to find a free DMA1\n");
|
||||
err = -EBUSY;
|
||||
goto _err;
|
||||
@ -225,7 +233,8 @@ static int snd_gusmax_probe(struct device *pdev, unsigned int dev)
|
||||
}
|
||||
xdma2 = dma2[dev];
|
||||
if (xdma2 == SNDRV_AUTO_DMA) {
|
||||
if ((xdma2 = snd_legacy_find_free_dma(possible_dmas)) < 0) {
|
||||
xdma2 = snd_legacy_find_free_dma(possible_dmas);
|
||||
if (xdma2 < 0) {
|
||||
snd_printk(KERN_ERR PFX "unable to find a free DMA2\n");
|
||||
err = -EBUSY;
|
||||
goto _err;
|
||||
@ -260,13 +269,15 @@ static int snd_gusmax_probe(struct device *pdev, unsigned int dev)
|
||||
if (err < 0)
|
||||
goto _err;
|
||||
|
||||
if ((err = snd_gusmax_detect(gus)) < 0)
|
||||
err = snd_gusmax_detect(gus);
|
||||
if (err < 0)
|
||||
goto _err;
|
||||
|
||||
maxcard->gus_status_reg = gus->gf1.reg_irqstat;
|
||||
maxcard->pcm_status_reg = gus->gf1.port + 0x10c + 2;
|
||||
snd_gusmax_init(dev, card, gus);
|
||||
if ((err = snd_gus_initialize(gus)) < 0)
|
||||
err = snd_gus_initialize(gus);
|
||||
if (err < 0)
|
||||
goto _err;
|
||||
|
||||
if (!gus->max_flag) {
|
||||
@ -307,7 +318,8 @@ static int snd_gusmax_probe(struct device *pdev, unsigned int dev)
|
||||
goto _err;
|
||||
|
||||
if (pcm_channels[dev] > 0) {
|
||||
if ((err = snd_gf1_pcm_new(gus, 1, 1)) < 0)
|
||||
err = snd_gf1_pcm_new(gus, 1, 1);
|
||||
if (err < 0)
|
||||
goto _err;
|
||||
}
|
||||
err = snd_gusmax_mixer(wss);
|
||||
|
@ -204,7 +204,8 @@ static int snd_interwave_detect_stb(struct snd_interwave *iwcard,
|
||||
port = 0x360;
|
||||
}
|
||||
while (port <= 0x380) {
|
||||
if ((iwcard->i2c_res = request_region(port, 1, "InterWave (I2C bus)")) != NULL)
|
||||
iwcard->i2c_res = request_region(port, 1, "InterWave (I2C bus)");
|
||||
if (iwcard->i2c_res)
|
||||
break;
|
||||
port += 0x10;
|
||||
}
|
||||
@ -217,11 +218,13 @@ static int snd_interwave_detect_stb(struct snd_interwave *iwcard,
|
||||
}
|
||||
|
||||
sprintf(name, "InterWave-%i", card->number);
|
||||
if ((err = snd_i2c_bus_create(card, name, NULL, &bus)) < 0)
|
||||
err = snd_i2c_bus_create(card, name, NULL, &bus);
|
||||
if (err < 0)
|
||||
return err;
|
||||
bus->private_value = port;
|
||||
bus->hw_ops.bit = &snd_interwave_i2c_bit_ops;
|
||||
if ((err = snd_tea6330t_detect(bus, 0)) < 0)
|
||||
err = snd_tea6330t_detect(bus, 0);
|
||||
if (err < 0)
|
||||
return err;
|
||||
*rbus = bus;
|
||||
return 0;
|
||||
@ -241,14 +244,16 @@ static int snd_interwave_detect(struct snd_interwave *iwcard,
|
||||
int d;
|
||||
|
||||
snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 0); /* reset GF1 */
|
||||
if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 0) {
|
||||
d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET);
|
||||
if ((d & 0x07) != 0) {
|
||||
snd_printdd("[0x%lx] check 1 failed - 0x%x\n", gus->gf1.port, d);
|
||||
return -ENODEV;
|
||||
}
|
||||
udelay(160);
|
||||
snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 1); /* release reset */
|
||||
udelay(160);
|
||||
if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 1) {
|
||||
d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET);
|
||||
if ((d & 0x07) != 1) {
|
||||
snd_printdd("[0x%lx] check 2 failed - 0x%x\n", gus->gf1.port, d);
|
||||
return -ENODEV;
|
||||
}
|
||||
@ -493,16 +498,20 @@ static int snd_interwave_mixer(struct snd_wss *chip)
|
||||
#if 0
|
||||
/* remove mono microphone controls */
|
||||
strcpy(id1.name, "Mic Playback Switch");
|
||||
if ((err = snd_ctl_remove_id(card, &id1)) < 0)
|
||||
err = snd_ctl_remove_id(card, &id1);
|
||||
if (err < 0)
|
||||
return err;
|
||||
strcpy(id1.name, "Mic Playback Volume");
|
||||
if ((err = snd_ctl_remove_id(card, &id1)) < 0)
|
||||
err = snd_ctl_remove_id(card, &id1);
|
||||
if (err < 0)
|
||||
return err;
|
||||
#endif
|
||||
/* add new master and mic controls */
|
||||
for (idx = 0; idx < ARRAY_SIZE(snd_interwave_controls); idx++)
|
||||
if ((err = snd_ctl_add(card, snd_ctl_new1(&snd_interwave_controls[idx], chip))) < 0)
|
||||
for (idx = 0; idx < ARRAY_SIZE(snd_interwave_controls); idx++) {
|
||||
err = snd_ctl_add(card, snd_ctl_new1(&snd_interwave_controls[idx], chip));
|
||||
if (err < 0)
|
||||
return err;
|
||||
}
|
||||
snd_wss_out(chip, CS4231_LINE_LEFT_OUTPUT, 0x9f);
|
||||
snd_wss_out(chip, CS4231_LINE_RIGHT_OUTPUT, 0x9f);
|
||||
snd_wss_out(chip, CS4231_LEFT_MIC_INPUT, 0x9f);
|
||||
@ -510,20 +519,24 @@ static int snd_interwave_mixer(struct snd_wss *chip)
|
||||
/* reassign AUXA to SYNTHESIZER */
|
||||
strcpy(id1.name, "Aux Playback Switch");
|
||||
strcpy(id2.name, "Synth Playback Switch");
|
||||
if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0)
|
||||
err = snd_ctl_rename_id(card, &id1, &id2);
|
||||
if (err < 0)
|
||||
return err;
|
||||
strcpy(id1.name, "Aux Playback Volume");
|
||||
strcpy(id2.name, "Synth Playback Volume");
|
||||
if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0)
|
||||
err = snd_ctl_rename_id(card, &id1, &id2);
|
||||
if (err < 0)
|
||||
return err;
|
||||
/* reassign AUXB to CD */
|
||||
strcpy(id1.name, "Aux Playback Switch"); id1.index = 1;
|
||||
strcpy(id2.name, "CD Playback Switch");
|
||||
if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0)
|
||||
err = snd_ctl_rename_id(card, &id1, &id2);
|
||||
if (err < 0)
|
||||
return err;
|
||||
strcpy(id1.name, "Aux Playback Volume");
|
||||
strcpy(id2.name, "CD Playback Volume");
|
||||
if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0)
|
||||
err = snd_ctl_rename_id(card, &id1, &id2);
|
||||
if (err < 0)
|
||||
return err;
|
||||
return 0;
|
||||
}
|
||||
@ -633,18 +646,20 @@ static int snd_interwave_probe(struct snd_card *card, int dev)
|
||||
xdma1 = dma1[dev];
|
||||
xdma2 = dma2[dev];
|
||||
|
||||
if ((err = snd_gus_create(card,
|
||||
port[dev],
|
||||
-xirq, xdma1, xdma2,
|
||||
0, 32,
|
||||
pcm_channels[dev], effect[dev], &gus)) < 0)
|
||||
err = snd_gus_create(card,
|
||||
port[dev],
|
||||
-xirq, xdma1, xdma2,
|
||||
0, 32,
|
||||
pcm_channels[dev], effect[dev], &gus);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
if ((err = snd_interwave_detect(iwcard, gus, dev
|
||||
err = snd_interwave_detect(iwcard, gus, dev
|
||||
#ifdef SNDRV_STB
|
||||
, &i2c_bus
|
||||
, &i2c_bus
|
||||
#endif
|
||||
)) < 0)
|
||||
);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
iwcard->gus_status_reg = gus->gf1.reg_irqstat;
|
||||
@ -652,7 +667,8 @@ static int snd_interwave_probe(struct snd_card *card, int dev)
|
||||
|
||||
snd_interwave_init(dev, gus);
|
||||
snd_interwave_detect_memory(gus);
|
||||
if ((err = snd_gus_initialize(gus)) < 0)
|
||||
err = snd_gus_initialize(gus);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
if (request_irq(xirq, snd_interwave_interrupt, 0,
|
||||
@ -708,19 +724,23 @@ static int snd_interwave_probe(struct snd_card *card, int dev)
|
||||
strcpy(id1.name, "Master Playback Switch");
|
||||
strcpy(id2.name, id1.name);
|
||||
id2.index = 1;
|
||||
if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0)
|
||||
err = snd_ctl_rename_id(card, &id1, &id2);
|
||||
if (err < 0)
|
||||
return err;
|
||||
strcpy(id1.name, "Master Playback Volume");
|
||||
strcpy(id2.name, id1.name);
|
||||
if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0)
|
||||
err = snd_ctl_rename_id(card, &id1, &id2);
|
||||
if (err < 0)
|
||||
return err;
|
||||
if ((err = snd_tea6330t_update_mixer(card, i2c_bus, 0, 1)) < 0)
|
||||
err = snd_tea6330t_update_mixer(card, i2c_bus, 0, 1);
|
||||
if (err < 0)
|
||||
return err;
|
||||
}
|
||||
#endif
|
||||
|
||||
gus->uart_enable = midi[dev];
|
||||
if ((err = snd_gf1_rawmidi_new(gus, 0)) < 0)
|
||||
err = snd_gf1_rawmidi_new(gus, 0);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
#ifndef SNDRV_STB
|
||||
@ -758,7 +778,8 @@ static int snd_interwave_isa_probe1(int dev, struct device *devptr)
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
if ((err = snd_interwave_probe(card, dev)) < 0) {
|
||||
err = snd_interwave_probe(card, dev);
|
||||
if (err < 0) {
|
||||
snd_card_free(card);
|
||||
return err;
|
||||
}
|
||||
@ -786,19 +807,22 @@ static int snd_interwave_isa_probe(struct device *pdev,
|
||||
static const int possible_dmas[] = {0, 1, 3, 5, 6, 7, -1};
|
||||
|
||||
if (irq[dev] == SNDRV_AUTO_IRQ) {
|
||||
if ((irq[dev] = snd_legacy_find_free_irq(possible_irqs)) < 0) {
|
||||
irq[dev] = snd_legacy_find_free_irq(possible_irqs);
|
||||
if (irq[dev] < 0) {
|
||||
snd_printk(KERN_ERR PFX "unable to find a free IRQ\n");
|
||||
return -EBUSY;
|
||||
}
|
||||
}
|
||||
if (dma1[dev] == SNDRV_AUTO_DMA) {
|
||||
if ((dma1[dev] = snd_legacy_find_free_dma(possible_dmas)) < 0) {
|
||||
dma1[dev] = snd_legacy_find_free_dma(possible_dmas);
|
||||
if (dma1[dev] < 0) {
|
||||
snd_printk(KERN_ERR PFX "unable to find a free DMA1\n");
|
||||
return -EBUSY;
|
||||
}
|
||||
}
|
||||
if (dma2[dev] == SNDRV_AUTO_DMA) {
|
||||
if ((dma2[dev] = snd_legacy_find_free_dma(possible_dmas)) < 0) {
|
||||
dma2[dev] = snd_legacy_find_free_dma(possible_dmas);
|
||||
if (dma2[dev] < 0) {
|
||||
snd_printk(KERN_ERR PFX "unable to find a free DMA2\n");
|
||||
return -EBUSY;
|
||||
}
|
||||
@ -853,11 +877,13 @@ static int snd_interwave_pnp_detect(struct pnp_card_link *pcard,
|
||||
if (res < 0)
|
||||
return res;
|
||||
|
||||
if ((res = snd_interwave_pnp(dev, card->private_data, pcard, pid)) < 0) {
|
||||
res = snd_interwave_pnp(dev, card->private_data, pcard, pid);
|
||||
if (res < 0) {
|
||||
snd_card_free(card);
|
||||
return res;
|
||||
}
|
||||
if ((res = snd_interwave_probe(card, dev)) < 0) {
|
||||
res = snd_interwave_probe(card, dev);
|
||||
if (res < 0) {
|
||||
snd_card_free(card);
|
||||
return res;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user