mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 22:21:40 +00:00
ALSA: emu10k1: Fix assignment in if condition
PCI EMU10k1 driver code contains a few 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-41-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
549717fc5b
commit
12bda1076c
@ -107,18 +107,22 @@ static int snd_card_emu10k1_probe(struct pci_dev *pci,
|
||||
max_buffer_size[dev] = 32;
|
||||
else if (max_buffer_size[dev] > 1024)
|
||||
max_buffer_size[dev] = 1024;
|
||||
if ((err = snd_emu10k1_create(card, pci, extin[dev], extout[dev],
|
||||
(long)max_buffer_size[dev] * 1024 * 1024,
|
||||
enable_ir[dev], subsystem[dev],
|
||||
&emu)) < 0)
|
||||
err = snd_emu10k1_create(card, pci, extin[dev], extout[dev],
|
||||
(long)max_buffer_size[dev] * 1024 * 1024,
|
||||
enable_ir[dev], subsystem[dev],
|
||||
&emu);
|
||||
if (err < 0)
|
||||
goto error;
|
||||
card->private_data = emu;
|
||||
emu->delay_pcm_irq = delay_pcm_irq[dev] & 0x1f;
|
||||
if ((err = snd_emu10k1_pcm(emu, 0)) < 0)
|
||||
err = snd_emu10k1_pcm(emu, 0);
|
||||
if (err < 0)
|
||||
goto error;
|
||||
if ((err = snd_emu10k1_pcm_mic(emu, 1)) < 0)
|
||||
err = snd_emu10k1_pcm_mic(emu, 1);
|
||||
if (err < 0)
|
||||
goto error;
|
||||
if ((err = snd_emu10k1_pcm_efx(emu, 2)) < 0)
|
||||
err = snd_emu10k1_pcm_efx(emu, 2);
|
||||
if (err < 0)
|
||||
goto error;
|
||||
/* This stores the periods table. */
|
||||
if (emu->card_capabilities->ca0151_chip) { /* P16V */
|
||||
@ -128,26 +132,33 @@ static int snd_card_emu10k1_probe(struct pci_dev *pci,
|
||||
goto error;
|
||||
}
|
||||
|
||||
if ((err = snd_emu10k1_mixer(emu, 0, 3)) < 0)
|
||||
err = snd_emu10k1_mixer(emu, 0, 3);
|
||||
if (err < 0)
|
||||
goto error;
|
||||
|
||||
if ((err = snd_emu10k1_timer(emu, 0)) < 0)
|
||||
err = snd_emu10k1_timer(emu, 0);
|
||||
if (err < 0)
|
||||
goto error;
|
||||
|
||||
if ((err = snd_emu10k1_pcm_multi(emu, 3)) < 0)
|
||||
err = snd_emu10k1_pcm_multi(emu, 3);
|
||||
if (err < 0)
|
||||
goto error;
|
||||
if (emu->card_capabilities->ca0151_chip) { /* P16V */
|
||||
if ((err = snd_p16v_pcm(emu, 4)) < 0)
|
||||
err = snd_p16v_pcm(emu, 4);
|
||||
if (err < 0)
|
||||
goto error;
|
||||
}
|
||||
if (emu->audigy) {
|
||||
if ((err = snd_emu10k1_audigy_midi(emu)) < 0)
|
||||
err = snd_emu10k1_audigy_midi(emu);
|
||||
if (err < 0)
|
||||
goto error;
|
||||
} else {
|
||||
if ((err = snd_emu10k1_midi(emu)) < 0)
|
||||
err = snd_emu10k1_midi(emu);
|
||||
if (err < 0)
|
||||
goto error;
|
||||
}
|
||||
if ((err = snd_emu10k1_fx8010_new(emu, 0)) < 0)
|
||||
err = snd_emu10k1_fx8010_new(emu, 0);
|
||||
if (err < 0)
|
||||
goto error;
|
||||
#ifdef ENABLE_SYNTH
|
||||
if (snd_seq_device_new(card, 1, SNDRV_SEQ_DEV_ID_EMU10K1_SYNTH,
|
||||
@ -174,7 +185,8 @@ static int snd_card_emu10k1_probe(struct pci_dev *pci,
|
||||
"%s (rev.%d, serial:0x%x) at 0x%lx, irq %i",
|
||||
card->shortname, emu->revision, emu->serial, emu->port, emu->irq);
|
||||
|
||||
if ((err = snd_card_register(card)) < 0)
|
||||
err = snd_card_register(card);
|
||||
if (err < 0)
|
||||
goto error;
|
||||
|
||||
if (emu->card_capabilities->emu_model)
|
||||
|
@ -90,7 +90,8 @@ snd_emu10k1_synth_get_voice(struct snd_emu10k1 *hw)
|
||||
if (best[i].voice >= 0) {
|
||||
int ch;
|
||||
vp = &emu->voices[best[i].voice];
|
||||
if ((ch = vp->ch) < 0) {
|
||||
ch = vp->ch;
|
||||
if (ch < 0) {
|
||||
/*
|
||||
dev_warn(emu->card->dev,
|
||||
"synth_get_voice: ch < 0 (%d) ??", i);
|
||||
|
@ -436,7 +436,8 @@ int snd_emu10k1_fx8010_unregister_irq_handler(struct snd_emu10k1 *emu,
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&emu->fx8010.irq_lock, flags);
|
||||
if ((tmp = emu->fx8010.irq_handlers) == irq) {
|
||||
tmp = emu->fx8010.irq_handlers;
|
||||
if (tmp == irq) {
|
||||
emu->fx8010.irq_handlers = tmp->next;
|
||||
if (emu->fx8010.irq_handlers == NULL) {
|
||||
snd_emu10k1_intr_disable(emu, INTE_FXDSPENABLE);
|
||||
@ -871,7 +872,9 @@ static int snd_emu10k1_add_controls(struct snd_emu10k1 *emu,
|
||||
}
|
||||
knew.private_value = (unsigned long)ctl;
|
||||
*ctl = *nctl;
|
||||
if ((err = snd_ctl_add(emu->card, kctl = snd_ctl_new1(&knew, emu))) < 0) {
|
||||
kctl = snd_ctl_new1(&knew, emu);
|
||||
err = snd_ctl_add(emu->card, kctl);
|
||||
if (err < 0) {
|
||||
kfree(ctl);
|
||||
kfree(knew.tlv.p);
|
||||
goto __error;
|
||||
@ -2403,7 +2406,8 @@ static int _snd_emu10k1_init_efx(struct snd_emu10k1 *emu)
|
||||
while (ptr < 0x200)
|
||||
OP(icode, &ptr, iACC3, C_00000000, C_00000000, C_00000000, C_00000000);
|
||||
|
||||
if ((err = snd_emu10k1_fx8010_tram_setup(emu, ipcm->buffer_size)) < 0)
|
||||
err = snd_emu10k1_fx8010_tram_setup(emu, ipcm->buffer_size);
|
||||
if (err < 0)
|
||||
goto __err;
|
||||
icode->gpr_add_control_count = i;
|
||||
icode->gpr_add_controls = controls;
|
||||
@ -2681,7 +2685,8 @@ int snd_emu10k1_fx8010_new(struct snd_emu10k1 *emu, int device)
|
||||
struct snd_hwdep *hw;
|
||||
int err;
|
||||
|
||||
if ((err = snd_hwdep_new(emu->card, "FX8010", device, &hw)) < 0)
|
||||
err = snd_hwdep_new(emu->card, "FX8010", device, &hw);
|
||||
if (err < 0)
|
||||
return err;
|
||||
strcpy(hw->name, "EMU10K1 (FX8010)");
|
||||
hw->iface = SNDRV_HWDEP_IFACE_EMU10K1;
|
||||
|
@ -1119,7 +1119,8 @@ static int snd_audigy_spdif_output_rate_put(struct snd_kcontrol *kcontrol,
|
||||
reg = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, 0);
|
||||
tmp = reg & ~A_SPDIF_RATE_MASK;
|
||||
tmp |= val;
|
||||
if ((change = (tmp != reg)))
|
||||
change = (tmp != reg);
|
||||
if (change)
|
||||
snd_emu10k1_ptr_write(emu, A_SPDIF_SAMPLERATE, 0, tmp);
|
||||
spin_unlock_irqrestore(&emu->reg_lock, flags);
|
||||
return change;
|
||||
@ -1903,7 +1904,8 @@ int snd_emu10k1_mixer(struct snd_emu10k1 *emu,
|
||||
.read = snd_emu10k1_ac97_read,
|
||||
};
|
||||
|
||||
if ((err = snd_ac97_bus(emu->card, 0, &ops, NULL, &pbus)) < 0)
|
||||
err = snd_ac97_bus(emu->card, 0, &ops, NULL, &pbus);
|
||||
if (err < 0)
|
||||
return err;
|
||||
pbus->no_vra = 1; /* we don't need VRA */
|
||||
|
||||
@ -1911,7 +1913,8 @@ int snd_emu10k1_mixer(struct snd_emu10k1 *emu,
|
||||
ac97.private_data = emu;
|
||||
ac97.private_free = snd_emu10k1_mixer_free_ac97;
|
||||
ac97.scaps = AC97_SCAP_NO_SPDIF;
|
||||
if ((err = snd_ac97_mixer(pbus, &ac97, &emu->ac97)) < 0) {
|
||||
err = snd_ac97_mixer(pbus, &ac97, &emu->ac97);
|
||||
if (err < 0) {
|
||||
if (emu->card_capabilities->ac97_chip == 1)
|
||||
return err;
|
||||
dev_info(emu->card->dev,
|
||||
@ -1991,38 +1994,50 @@ int snd_emu10k1_mixer(struct snd_emu10k1 *emu,
|
||||
rename_ctl(card, "Aux2 Capture Volume", "Line3 Capture Volume");
|
||||
rename_ctl(card, "Mic Capture Volume", "Unknown1 Capture Volume");
|
||||
}
|
||||
if ((kctl = emu->ctl_send_routing = snd_ctl_new1(&snd_emu10k1_send_routing_control, emu)) == NULL)
|
||||
kctl = emu->ctl_send_routing = snd_ctl_new1(&snd_emu10k1_send_routing_control, emu);
|
||||
if (!kctl)
|
||||
return -ENOMEM;
|
||||
kctl->id.device = pcm_device;
|
||||
if ((err = snd_ctl_add(card, kctl)))
|
||||
err = snd_ctl_add(card, kctl);
|
||||
if (err)
|
||||
return err;
|
||||
if ((kctl = emu->ctl_send_volume = snd_ctl_new1(&snd_emu10k1_send_volume_control, emu)) == NULL)
|
||||
kctl = emu->ctl_send_volume = snd_ctl_new1(&snd_emu10k1_send_volume_control, emu);
|
||||
if (!kctl)
|
||||
return -ENOMEM;
|
||||
kctl->id.device = pcm_device;
|
||||
if ((err = snd_ctl_add(card, kctl)))
|
||||
err = snd_ctl_add(card, kctl);
|
||||
if (err)
|
||||
return err;
|
||||
if ((kctl = emu->ctl_attn = snd_ctl_new1(&snd_emu10k1_attn_control, emu)) == NULL)
|
||||
kctl = emu->ctl_attn = snd_ctl_new1(&snd_emu10k1_attn_control, emu);
|
||||
if (!kctl)
|
||||
return -ENOMEM;
|
||||
kctl->id.device = pcm_device;
|
||||
if ((err = snd_ctl_add(card, kctl)))
|
||||
err = snd_ctl_add(card, kctl);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
if ((kctl = emu->ctl_efx_send_routing = snd_ctl_new1(&snd_emu10k1_efx_send_routing_control, emu)) == NULL)
|
||||
kctl = emu->ctl_efx_send_routing = snd_ctl_new1(&snd_emu10k1_efx_send_routing_control, emu);
|
||||
if (!kctl)
|
||||
return -ENOMEM;
|
||||
kctl->id.device = multi_device;
|
||||
if ((err = snd_ctl_add(card, kctl)))
|
||||
err = snd_ctl_add(card, kctl);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
if ((kctl = emu->ctl_efx_send_volume = snd_ctl_new1(&snd_emu10k1_efx_send_volume_control, emu)) == NULL)
|
||||
kctl = emu->ctl_efx_send_volume = snd_ctl_new1(&snd_emu10k1_efx_send_volume_control, emu);
|
||||
if (!kctl)
|
||||
return -ENOMEM;
|
||||
kctl->id.device = multi_device;
|
||||
if ((err = snd_ctl_add(card, kctl)))
|
||||
err = snd_ctl_add(card, kctl);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
if ((kctl = emu->ctl_efx_attn = snd_ctl_new1(&snd_emu10k1_efx_attn_control, emu)) == NULL)
|
||||
kctl = emu->ctl_efx_attn = snd_ctl_new1(&snd_emu10k1_efx_attn_control, emu);
|
||||
if (!kctl)
|
||||
return -ENOMEM;
|
||||
kctl->id.device = multi_device;
|
||||
if ((err = snd_ctl_add(card, kctl)))
|
||||
err = snd_ctl_add(card, kctl);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
/* initialize the routing and volume table for each pcm playback stream */
|
||||
@ -2069,42 +2084,53 @@ int snd_emu10k1_mixer(struct snd_emu10k1 *emu,
|
||||
|
||||
if (! emu->card_capabilities->ecard) { /* FIXME: APS has these controls? */
|
||||
/* sb live! and audigy */
|
||||
if ((kctl = snd_ctl_new1(&snd_emu10k1_spdif_mask_control, emu)) == NULL)
|
||||
kctl = snd_ctl_new1(&snd_emu10k1_spdif_mask_control, emu);
|
||||
if (!kctl)
|
||||
return -ENOMEM;
|
||||
if (!emu->audigy)
|
||||
kctl->id.device = emu->pcm_efx->device;
|
||||
if ((err = snd_ctl_add(card, kctl)))
|
||||
err = snd_ctl_add(card, kctl);
|
||||
if (err)
|
||||
return err;
|
||||
if ((kctl = snd_ctl_new1(&snd_emu10k1_spdif_control, emu)) == NULL)
|
||||
kctl = snd_ctl_new1(&snd_emu10k1_spdif_control, emu);
|
||||
if (!kctl)
|
||||
return -ENOMEM;
|
||||
if (!emu->audigy)
|
||||
kctl->id.device = emu->pcm_efx->device;
|
||||
if ((err = snd_ctl_add(card, kctl)))
|
||||
err = snd_ctl_add(card, kctl);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
||||
if (emu->card_capabilities->emu_model) {
|
||||
; /* Disable the snd_audigy_spdif_shared_spdif */
|
||||
} else if (emu->audigy) {
|
||||
if ((kctl = snd_ctl_new1(&snd_audigy_shared_spdif, emu)) == NULL)
|
||||
kctl = snd_ctl_new1(&snd_audigy_shared_spdif, emu);
|
||||
if (!kctl)
|
||||
return -ENOMEM;
|
||||
if ((err = snd_ctl_add(card, kctl)))
|
||||
err = snd_ctl_add(card, kctl);
|
||||
if (err)
|
||||
return err;
|
||||
#if 0
|
||||
if ((kctl = snd_ctl_new1(&snd_audigy_spdif_output_rate, emu)) == NULL)
|
||||
kctl = snd_ctl_new1(&snd_audigy_spdif_output_rate, emu);
|
||||
if (!kctl)
|
||||
return -ENOMEM;
|
||||
if ((err = snd_ctl_add(card, kctl)))
|
||||
err = snd_ctl_add(card, kctl);
|
||||
if (err)
|
||||
return err;
|
||||
#endif
|
||||
} else if (! emu->card_capabilities->ecard) {
|
||||
/* sb live! */
|
||||
if ((kctl = snd_ctl_new1(&snd_emu10k1_shared_spdif, emu)) == NULL)
|
||||
kctl = snd_ctl_new1(&snd_emu10k1_shared_spdif, emu);
|
||||
if (!kctl)
|
||||
return -ENOMEM;
|
||||
if ((err = snd_ctl_add(card, kctl)))
|
||||
err = snd_ctl_add(card, kctl);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
if (emu->card_capabilities->ca0151_chip) { /* P16V */
|
||||
if ((err = snd_p16v_mixer(emu)))
|
||||
err = snd_p16v_mixer(emu);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -319,7 +319,8 @@ static int emu10k1_midi_init(struct snd_emu10k1 *emu, struct snd_emu10k1_midi *m
|
||||
struct snd_rawmidi *rmidi;
|
||||
int err;
|
||||
|
||||
if ((err = snd_rawmidi_new(emu->card, name, device, 1, 1, &rmidi)) < 0)
|
||||
err = snd_rawmidi_new(emu->card, name, device, 1, 1, &rmidi);
|
||||
if (err < 0)
|
||||
return err;
|
||||
midi->emu = emu;
|
||||
spin_lock_init(&midi->open_lock);
|
||||
@ -342,7 +343,8 @@ int snd_emu10k1_midi(struct snd_emu10k1 *emu)
|
||||
struct snd_emu10k1_midi *midi = &emu->midi;
|
||||
int err;
|
||||
|
||||
if ((err = emu10k1_midi_init(emu, midi, 0, "EMU10K1 MPU-401 (UART)")) < 0)
|
||||
err = emu10k1_midi_init(emu, midi, 0, "EMU10K1 MPU-401 (UART)");
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
midi->tx_enable = INTE_MIDITXENABLE;
|
||||
@ -360,7 +362,8 @@ int snd_emu10k1_audigy_midi(struct snd_emu10k1 *emu)
|
||||
int err;
|
||||
|
||||
midi = &emu->midi;
|
||||
if ((err = emu10k1_midi_init(emu, midi, 0, "Audigy MPU-401 (UART)")) < 0)
|
||||
err = emu10k1_midi_init(emu, midi, 0, "Audigy MPU-401 (UART)");
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
midi->tx_enable = INTE_MIDITXENABLE;
|
||||
@ -371,7 +374,8 @@ int snd_emu10k1_audigy_midi(struct snd_emu10k1 *emu)
|
||||
midi->interrupt = snd_emu10k1_midi_interrupt;
|
||||
|
||||
midi = &emu->midi2;
|
||||
if ((err = emu10k1_midi_init(emu, midi, 1, "Audigy MPU-401 #2")) < 0)
|
||||
err = emu10k1_midi_init(emu, midi, 1, "Audigy MPU-401 #2");
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
midi->tx_enable = INTE_A_MIDITXENABLE2;
|
||||
|
@ -25,7 +25,8 @@ static void snd_emu10k1_pcm_interrupt(struct snd_emu10k1 *emu,
|
||||
{
|
||||
struct snd_emu10k1_pcm *epcm;
|
||||
|
||||
if ((epcm = voice->epcm) == NULL)
|
||||
epcm = voice->epcm;
|
||||
if (!epcm)
|
||||
return;
|
||||
if (epcm->substream == NULL)
|
||||
return;
|
||||
@ -399,7 +400,8 @@ static int snd_emu10k1_playback_hw_params(struct snd_pcm_substream *substream,
|
||||
size_t alloc_size;
|
||||
int err;
|
||||
|
||||
if ((err = snd_emu10k1_pcm_channel_alloc(epcm, params_channels(hw_params))) < 0)
|
||||
err = snd_emu10k1_pcm_channel_alloc(epcm, params_channels(hw_params));
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
alloc_size = params_buffer_bytes(hw_params);
|
||||
@ -1124,11 +1126,13 @@ static int snd_emu10k1_playback_open(struct snd_pcm_substream *substream)
|
||||
runtime->private_data = epcm;
|
||||
runtime->private_free = snd_emu10k1_pcm_free_substream;
|
||||
runtime->hw = snd_emu10k1_playback;
|
||||
if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) {
|
||||
err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);
|
||||
if (err < 0) {
|
||||
kfree(epcm);
|
||||
return err;
|
||||
}
|
||||
if ((err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 256, UINT_MAX)) < 0) {
|
||||
err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 256, UINT_MAX);
|
||||
if (err < 0) {
|
||||
kfree(epcm);
|
||||
return err;
|
||||
}
|
||||
@ -1380,7 +1384,8 @@ int snd_emu10k1_pcm(struct snd_emu10k1 *emu, int device)
|
||||
struct snd_pcm_substream *substream;
|
||||
int err;
|
||||
|
||||
if ((err = snd_pcm_new(emu->card, "emu10k1", device, 32, 1, &pcm)) < 0)
|
||||
err = snd_pcm_new(emu->card, "emu10k1", device, 32, 1, &pcm);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
pcm->private_data = emu;
|
||||
@ -1412,7 +1417,8 @@ int snd_emu10k1_pcm_multi(struct snd_emu10k1 *emu, int device)
|
||||
struct snd_pcm_substream *substream;
|
||||
int err;
|
||||
|
||||
if ((err = snd_pcm_new(emu->card, "emu10k1", device, 1, 0, &pcm)) < 0)
|
||||
err = snd_pcm_new(emu->card, "emu10k1", device, 1, 0, &pcm);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
pcm->private_data = emu;
|
||||
@ -1446,7 +1452,8 @@ int snd_emu10k1_pcm_mic(struct snd_emu10k1 *emu, int device)
|
||||
struct snd_pcm *pcm;
|
||||
int err;
|
||||
|
||||
if ((err = snd_pcm_new(emu->card, "emu10k1 mic", device, 0, 1, &pcm)) < 0)
|
||||
err = snd_pcm_new(emu->card, "emu10k1 mic", device, 0, 1, &pcm);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
pcm->private_data = emu;
|
||||
@ -1774,7 +1781,8 @@ int snd_emu10k1_pcm_efx(struct snd_emu10k1 *emu, int device)
|
||||
struct snd_kcontrol *kctl;
|
||||
int err;
|
||||
|
||||
if ((err = snd_pcm_new(emu->card, "emu10k1 efx", device, 8, 1, &pcm)) < 0)
|
||||
err = snd_pcm_new(emu->card, "emu10k1 efx", device, 8, 1, &pcm);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
pcm->private_data = emu;
|
||||
|
@ -169,16 +169,20 @@ static int unmap_memblk(struct snd_emu10k1 *emu, struct snd_emu10k1_memblk *blk)
|
||||
struct snd_emu10k1_memblk *q;
|
||||
|
||||
/* calculate the expected size of empty region */
|
||||
if ((p = blk->mapped_link.prev) != &emu->mapped_link_head) {
|
||||
p = blk->mapped_link.prev;
|
||||
if (p != &emu->mapped_link_head) {
|
||||
q = get_emu10k1_memblk(p, mapped_link);
|
||||
start_page = q->mapped_page + q->pages;
|
||||
} else
|
||||
} else {
|
||||
start_page = 1;
|
||||
if ((p = blk->mapped_link.next) != &emu->mapped_link_head) {
|
||||
}
|
||||
p = blk->mapped_link.next;
|
||||
if (p != &emu->mapped_link_head) {
|
||||
q = get_emu10k1_memblk(p, mapped_link);
|
||||
end_page = q->mapped_page;
|
||||
} else
|
||||
} else {
|
||||
end_page = (emu->address_mode ? MAX_ALIGN_PAGES1 : MAX_ALIGN_PAGES0);
|
||||
}
|
||||
|
||||
/* remove links */
|
||||
list_del(&blk->mapped_link);
|
||||
@ -267,7 +271,8 @@ int snd_emu10k1_memblk_map(struct snd_emu10k1 *emu, struct snd_emu10k1_memblk *b
|
||||
spin_unlock_irqrestore(&emu->memblk_lock, flags);
|
||||
return 0;
|
||||
}
|
||||
if ((err = map_memblk(emu, blk)) < 0) {
|
||||
err = map_memblk(emu, blk);
|
||||
if (err < 0) {
|
||||
/* no enough page - try to unmap some blocks */
|
||||
/* starting from the oldest block */
|
||||
p = emu->mapped_order_link_head.next;
|
||||
@ -454,13 +459,15 @@ static void get_single_page_range(struct snd_util_memhdr *hdr,
|
||||
struct snd_emu10k1_memblk *q;
|
||||
int first_page, last_page;
|
||||
first_page = blk->first_page;
|
||||
if ((p = blk->mem.list.prev) != &hdr->block) {
|
||||
p = blk->mem.list.prev;
|
||||
if (p != &hdr->block) {
|
||||
q = get_emu10k1_memblk(p, mem.list);
|
||||
if (q->last_page == first_page)
|
||||
first_page++; /* first page was already allocated */
|
||||
}
|
||||
last_page = blk->last_page;
|
||||
if ((p = blk->mem.list.next) != &hdr->block) {
|
||||
p = blk->mem.list.next;
|
||||
if (p != &hdr->block) {
|
||||
q = get_emu10k1_memblk(p, mem.list);
|
||||
if (q->first_page == last_page)
|
||||
last_page--; /* last page was already allocated */
|
||||
|
@ -194,7 +194,8 @@ static int snd_p16v_pcm_open_playback_channel(struct snd_pcm_substream *substrea
|
||||
#endif /* debug */
|
||||
/* channel->interrupt = snd_p16v_pcm_channel_interrupt; */
|
||||
channel->epcm = epcm;
|
||||
if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0)
|
||||
err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
runtime->sync.id32[0] = substream->pcm->card->number;
|
||||
@ -242,7 +243,8 @@ static int snd_p16v_pcm_open_capture_channel(struct snd_pcm_substream *substream
|
||||
#endif /* debug */
|
||||
/* channel->interrupt = snd_p16v_pcm_channel_interrupt; */
|
||||
channel->epcm = epcm;
|
||||
if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0)
|
||||
err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
return 0;
|
||||
@ -589,7 +591,8 @@ int snd_p16v_pcm(struct snd_emu10k1 *emu, int device)
|
||||
/* dev_dbg(emu->card->dev, "snd_p16v_pcm called. device=%d\n", device); */
|
||||
emu->p16v_device_offset = device;
|
||||
|
||||
if ((err = snd_pcm_new(emu->card, "p16v", device, 1, capture, &pcm)) < 0)
|
||||
err = snd_pcm_new(emu->card, "p16v", device, 1, capture, &pcm);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
pcm->private_data = emu;
|
||||
@ -808,8 +811,8 @@ int snd_p16v_mixer(struct snd_emu10k1 *emu)
|
||||
struct snd_card *card = emu->card;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(p16v_mixer_controls); i++) {
|
||||
if ((err = snd_ctl_add(card, snd_ctl_new1(&p16v_mixer_controls[i],
|
||||
emu))) < 0)
|
||||
err = snd_ctl_add(card, snd_ctl_new1(&p16v_mixer_controls[i], emu));
|
||||
if (err < 0)
|
||||
return err;
|
||||
}
|
||||
return 0;
|
||||
|
@ -72,7 +72,8 @@ int snd_emu10k1_timer(struct snd_emu10k1 *emu, int device)
|
||||
tid.card = emu->card->number;
|
||||
tid.device = device;
|
||||
tid.subdevice = 0;
|
||||
if ((err = snd_timer_new(emu->card, "EMU10K1", &tid, &timer)) >= 0) {
|
||||
err = snd_timer_new(emu->card, "EMU10K1", &tid, &timer);
|
||||
if (err >= 0) {
|
||||
strcpy(timer->name, "EMU10K1 timer");
|
||||
timer->private_data = emu;
|
||||
timer->hw = snd_emu10k1_timer_hw;
|
||||
|
Loading…
Reference in New Issue
Block a user