Browse Source

ALSA: Kill snd_assert() in sound/pci/*

Kill snd_assert() in sound/pci/*, either removed or replaced with
if () with snd_BUG_ON().

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
imx_3.10.17_1.0.0_ga
Takashi Iwai 12 years ago
committed by Jaroslav Kysela
parent
commit
da3cec35dd
70 changed files with 632 additions and 361 deletions
  1. +12
    -7
      sound/pci/ac97/ac97_codec.c
  2. +4
    -2
      sound/pci/ad1889.c
  3. +6
    -4
      sound/pci/ak4531_codec.c
  4. +7
    -3
      sound/pci/atiixp.c
  5. +7
    -3
      sound/pci/atiixp_modem.c
  6. +4
    -2
      sound/pci/azt3328.c
  7. +14
    -6
      sound/pci/ca0106/ca_midi.c
  8. +6
    -3
      sound/pci/cmipci.c
  9. +8
    -5
      sound/pci/cs4281.c
  10. +42
    -30
      sound/pci/cs46xx/cs46xx_lib.c
  11. +34
    -17
      sound/pci/cs46xx/dsp_spos.c
  12. +70
    -45
      sound/pci/cs46xx/dsp_spos_scb_lib.c
  13. +2
    -1
      sound/pci/echoaudio/darla20_dsp.c
  14. +5
    -3
      sound/pci/echoaudio/darla24_dsp.c
  15. +6
    -3
      sound/pci/echoaudio/echo3g_dsp.c
  16. +5
    -3
      sound/pci/echoaudio/echoaudio.c
  17. +7
    -4
      sound/pci/echoaudio/echoaudio_3g.c
  18. +13
    -8
      sound/pci/echoaudio/echoaudio_dsp.c
  19. +4
    -2
      sound/pci/echoaudio/echoaudio_gml.c
  20. +4
    -2
      sound/pci/echoaudio/gina20_dsp.c
  21. +7
    -4
      sound/pci/echoaudio/gina24_dsp.c
  22. +5
    -3
      sound/pci/echoaudio/indigo_dsp.c
  23. +5
    -3
      sound/pci/echoaudio/indigodj_dsp.c
  24. +5
    -3
      sound/pci/echoaudio/indigoio_dsp.c
  25. +6
    -3
      sound/pci/echoaudio/layla20_dsp.c
  26. +7
    -4
      sound/pci/echoaudio/layla24_dsp.c
  27. +8
    -5
      sound/pci/echoaudio/mia_dsp.c
  28. +4
    -2
      sound/pci/echoaudio/midi.c
  29. +4
    -2
      sound/pci/echoaudio/mona_dsp.c
  30. +4
    -2
      sound/pci/emu10k1/emu10k1_callback.c
  31. +14
    -9
      sound/pci/emu10k1/emu10k1_patch.c
  32. +12
    -6
      sound/pci/emu10k1/emu10k1x.c
  33. +4
    -2
      sound/pci/emu10k1/emufx.c
  34. +12
    -6
      sound/pci/emu10k1/emumpu401.c
  35. +13
    -6
      sound/pci/emu10k1/memory.c
  36. +6
    -3
      sound/pci/emu10k1/voice.c
  37. +2
    -1
      sound/pci/es1938.c
  38. +4
    -2
      sound/pci/es1968.c
  39. +14
    -7
      sound/pci/hda/hda_codec.c
  40. +2
    -1
      sound/pci/hda/hda_generic.c
  41. +2
    -1
      sound/pci/hda/hda_intel.c
  42. +4
    -2
      sound/pci/hda/patch_realtek.c
  43. +2
    -1
      sound/pci/ice1712/ak4xxx.c
  44. +6
    -3
      sound/pci/ice1712/ews.c
  45. +2
    -1
      sound/pci/ice1712/ice1712.c
  46. +2
    -1
      sound/pci/ice1712/ice1724.c
  47. +2
    -1
      sound/pci/ice1712/juli.c
  48. +2
    -2
      sound/pci/intel8x0.c
  49. +2
    -1
      sound/pci/intel8x0m.c
  50. +6
    -3
      sound/pci/korg1212/korg1212.c
  51. +7
    -3
      sound/pci/maestro3.c
  52. +2
    -2
      sound/pci/mixart/mixart.c
  53. +12
    -6
      sound/pci/mixart/mixart_core.c
  54. +13
    -6
      sound/pci/mixart/mixart_hwdep.c
  55. +4
    -4
      sound/pci/mixart/mixart_mixer.c
  56. +10
    -5
      sound/pci/nm256/nm256.c
  57. +4
    -2
      sound/pci/pcxhr/pcxhr.c
  58. +17
    -10
      sound/pci/pcxhr/pcxhr_core.c
  59. +9
    -6
      sound/pci/pcxhr/pcxhr_hwdep.c
  60. +12
    -6
      sound/pci/riptide/riptide.c
  61. +16
    -9
      sound/pci/rme9652/hdsp.c
  62. +19
    -15
      sound/pci/rme9652/hdspm.c
  63. +14
    -9
      sound/pci/rme9652/rme9652.c
  64. +6
    -4
      sound/pci/sonicvibes.c
  65. +14
    -8
      sound/pci/trident/trident_main.c
  66. +16
    -8
      sound/pci/trident/trident_memory.c
  67. +5
    -3
      sound/pci/via82xx.c
  68. +2
    -1
      sound/pci/via82xx_modem.c
  69. +8
    -4
      sound/pci/vx222/vx222_ops.c
  70. +14
    -7
      sound/pci/ymfpci/ymfpci_main.c

+ 12
- 7
sound/pci/ac97/ac97_codec.c View File

@ -1890,8 +1890,8 @@ int snd_ac97_bus(struct snd_card *card, int num, struct snd_ac97_bus_ops *ops,
.dev_free = snd_ac97_bus_dev_free,
};
snd_assert(card != NULL, return -EINVAL);
snd_assert(rbus != NULL, return -EINVAL);
if (snd_BUG_ON(!card))
return -EINVAL;
bus = kzalloc(sizeof(*bus), GFP_KERNEL);
if (bus == NULL)
return -ENOMEM;
@ -1906,7 +1906,8 @@ int snd_ac97_bus(struct snd_card *card, int num, struct snd_ac97_bus_ops *ops,
snd_ac97_bus_free(bus);
return err;
}
*rbus = bus;
if (rbus)
*rbus = bus;
return 0;
}
@ -1991,10 +1992,14 @@ int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template,
.dev_disconnect = snd_ac97_dev_disconnect,
};
snd_assert(rac97 != NULL, return -EINVAL);
*rac97 = NULL;
snd_assert(bus != NULL && template != NULL, return -EINVAL);
snd_assert(template->num < 4 && bus->codec[template->num] == NULL, return -EINVAL);
if (rac97)
*rac97 = NULL;
if (snd_BUG_ON(!bus || !template))
return -EINVAL;
if (snd_BUG_ON(template->num >= 4))
return -EINVAL;
if (bus->codec[template->num])
return -EBUSY;
card = bus->card;
ac97 = kzalloc(sizeof(*ac97), GFP_KERNEL);


+ 4
- 2
sound/pci/ad1889.c View File

@ -549,7 +549,8 @@ snd_ad1889_playback_pointer(struct snd_pcm_substream *ss)
ptr = ad1889_readl(chip, AD_DMA_WAVCA);
ptr -= chip->wave.addr;
snd_assert((ptr >= 0) && (ptr < chip->wave.size), return 0);
if (snd_BUG_ON(ptr >= chip->wave.size))
return 0;
return bytes_to_frames(ss->runtime, ptr);
}
@ -567,7 +568,8 @@ snd_ad1889_capture_pointer(struct snd_pcm_substream *ss)
ptr = ad1889_readl(chip, AD_DMA_ADCCA);
ptr -= chip->ramc.addr;
snd_assert((ptr >= 0) && (ptr < chip->ramc.size), return 0);
if (snd_BUG_ON(ptr >= chip->ramc.size))
return 0;
return bytes_to_frames(ss->runtime, ptr);
}


+ 6
- 4
sound/pci/ak4531_codec.c View File

@ -392,9 +392,10 @@ int __devinit snd_ak4531_mixer(struct snd_card *card,
.dev_free = snd_ak4531_dev_free,
};
snd_assert(rak4531 != NULL, return -EINVAL);
*rak4531 = NULL;
snd_assert(card != NULL && _ak4531 != NULL, return -EINVAL);
if (snd_BUG_ON(!card || !_ak4531))
return -EINVAL;
if (rak4531)
*rak4531 = NULL;
ak4531 = kzalloc(sizeof(*ak4531), GFP_KERNEL);
if (ak4531 == NULL)
return -ENOMEM;
@ -428,7 +429,8 @@ int __devinit snd_ak4531_mixer(struct snd_card *card,
#if 0
snd_ak4531_dump(ak4531);
#endif
*rak4531 = ak4531;
if (rak4531)
*rak4531 = ak4531;
return 0;
}


+ 7
- 3
sound/pci/atiixp.c View File

@ -722,7 +722,9 @@ static int snd_atiixp_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
struct atiixp_dma *dma = substream->runtime->private_data;
int err = 0;
snd_assert(dma->ops->enable_transfer && dma->ops->flush_dma, return -EINVAL);
if (snd_BUG_ON(!dma->ops->enable_transfer ||
!dma->ops->flush_dma))
return -EINVAL;
spin_lock(&chip->reg_lock);
switch (cmd) {
@ -1032,7 +1034,8 @@ static int snd_atiixp_pcm_open(struct snd_pcm_substream *substream,
struct snd_pcm_runtime *runtime = substream->runtime;
int err;
snd_assert(dma->ops && dma->ops->enable_dma, return -EINVAL);
if (snd_BUG_ON(!dma->ops || !dma->ops->enable_dma))
return -EINVAL;
if (dma->opened)
return -EBUSY;
@ -1064,7 +1067,8 @@ static int snd_atiixp_pcm_close(struct snd_pcm_substream *substream,
{
struct atiixp *chip = snd_pcm_substream_chip(substream);
/* disable DMA bits */
snd_assert(dma->ops && dma->ops->enable_dma, return -EINVAL);
if (snd_BUG_ON(!dma->ops || !dma->ops->enable_dma))
return -EINVAL;
spin_lock_irq(&chip->reg_lock);
dma->ops->enable_dma(chip, 0);
spin_unlock_irq(&chip->reg_lock);


+ 7
- 3
sound/pci/atiixp_modem.c View File

@ -674,7 +674,9 @@ static int snd_atiixp_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
struct atiixp_dma *dma = substream->runtime->private_data;
int err = 0;
snd_assert(dma->ops->enable_transfer && dma->ops->flush_dma, return -EINVAL);
if (snd_BUG_ON(!dma->ops->enable_transfer ||
!dma->ops->flush_dma))
return -EINVAL;
spin_lock(&chip->reg_lock);
switch(cmd) {
@ -865,7 +867,8 @@ static int snd_atiixp_pcm_open(struct snd_pcm_substream *substream,
.mask = 0,
};
snd_assert(dma->ops && dma->ops->enable_dma, return -EINVAL);
if (snd_BUG_ON(!dma->ops || !dma->ops->enable_dma))
return -EINVAL;
if (dma->opened)
return -EBUSY;
@ -895,7 +898,8 @@ static int snd_atiixp_pcm_close(struct snd_pcm_substream *substream,
{
struct atiixp_modem *chip = snd_pcm_substream_chip(substream);
/* disable DMA bits */
snd_assert(dma->ops && dma->ops->enable_dma, return -EINVAL);
if (snd_BUG_ON(!dma->ops || !dma->ops->enable_dma))
return -EINVAL;
spin_lock_irq(&chip->reg_lock);
dma->ops->enable_dma(chip, 0);
spin_unlock_irq(&chip->reg_lock);


+ 4
- 2
sound/pci/azt3328.c View File

@ -816,7 +816,8 @@ snd_azf3328_mixer_new(struct snd_azf3328 *chip)
int err;
snd_azf3328_dbgcallenter();
snd_assert(chip != NULL && chip->card != NULL, return -EINVAL);
if (snd_BUG_ON(!chip || !chip->card))
return -EINVAL;
card = chip->card;
@ -1471,7 +1472,8 @@ snd_azf3328_gameport_cooked_read(struct gameport *gameport,
u8 val;
unsigned long flags;
snd_assert(chip, return 0);
if (snd_BUG_ON(!chip))
return 0;
spin_lock_irqsave(&chip->reg_lock, flags);
val = snd_azf3328_game_inb(chip, IDX_GAME_LEGACY_COMPATIBLE);


+ 14
- 6
sound/pci/ca0106/ca_midi.c View File

@ -125,7 +125,8 @@ static int ca_midi_input_open(struct snd_rawmidi_substream *substream)
struct snd_ca_midi *midi = substream->rmidi->private_data;
unsigned long flags;
snd_assert(midi->dev_id, return -ENXIO);
if (snd_BUG_ON(!midi->dev_id))
return -ENXIO;
spin_lock_irqsave(&midi->open_lock, flags);
midi->midi_mode |= CA_MIDI_MODE_INPUT;
midi->substream_input = substream;
@ -144,7 +145,8 @@ static int ca_midi_output_open(struct snd_rawmidi_substream *substream)
struct snd_ca_midi *midi = substream->rmidi->private_data;
unsigned long flags;
snd_assert(midi->dev_id, return -ENXIO);
if (snd_BUG_ON(!midi->dev_id))
return -ENXIO;
spin_lock_irqsave(&midi->open_lock, flags);
midi->midi_mode |= CA_MIDI_MODE_OUTPUT;
midi->substream_output = substream;
@ -163,7 +165,8 @@ static int ca_midi_input_close(struct snd_rawmidi_substream *substream)
struct snd_ca_midi *midi = substream->rmidi->private_data;
unsigned long flags;
snd_assert(midi->dev_id, return -ENXIO);
if (snd_BUG_ON(!midi->dev_id))
return -ENXIO;
spin_lock_irqsave(&midi->open_lock, flags);
midi->interrupt_disable(midi,midi->rx_enable);
midi->midi_mode &= ~CA_MIDI_MODE_INPUT;
@ -181,7 +184,9 @@ static int ca_midi_output_close(struct snd_rawmidi_substream *substream)
{
struct snd_ca_midi *midi = substream->rmidi->private_data;
unsigned long flags;
snd_assert(midi->dev_id, return -ENXIO);
if (snd_BUG_ON(!midi->dev_id))
return -ENXIO;
spin_lock_irqsave(&midi->open_lock, flags);
@ -201,7 +206,9 @@ static int ca_midi_output_close(struct snd_rawmidi_substream *substream)
static void ca_midi_input_trigger(struct snd_rawmidi_substream *substream, int up)
{
struct snd_ca_midi *midi = substream->rmidi->private_data;
snd_assert(midi->dev_id, return);
if (snd_BUG_ON(!midi->dev_id))
return;
if (up) {
midi->interrupt_enable(midi,midi->rx_enable);
@ -215,7 +222,8 @@ static void ca_midi_output_trigger(struct snd_rawmidi_substream *substream, int
struct snd_ca_midi *midi = substream->rmidi->private_data;
unsigned long flags;
snd_assert(midi->dev_id, return);
if (snd_BUG_ON(!midi->dev_id))
return;
if (up) {
int max = 4;


+ 6
- 3
sound/pci/cmipci.c View File

@ -2357,7 +2357,8 @@ static int snd_cmipci_uswitch_get(struct snd_kcontrol *kcontrol,
{
struct cmipci_switch_args *args;
args = (struct cmipci_switch_args *)kcontrol->private_value;
snd_assert(args != NULL, return -EINVAL);
if (snd_BUG_ON(!args))
return -EINVAL;
return _snd_cmipci_uswitch_get(kcontrol, ucontrol, args);
}
@ -2401,7 +2402,8 @@ static int snd_cmipci_uswitch_put(struct snd_kcontrol *kcontrol,
{
struct cmipci_switch_args *args;
args = (struct cmipci_switch_args *)kcontrol->private_value;
snd_assert(args != NULL, return -EINVAL);
if (snd_BUG_ON(!args))
return -EINVAL;
return _snd_cmipci_uswitch_put(kcontrol, ucontrol, args);
}
@ -2662,7 +2664,8 @@ static int __devinit snd_cmipci_mixer_new(struct cmipci *cm, int pcm_spdif_devic
unsigned int idx;
int err;
snd_assert(cm != NULL && cm->card != NULL, return -EINVAL);
if (snd_BUG_ON(!cm || !cm->card))
return -EINVAL;
card = cm->card;


+ 8
- 5
sound/pci/cs4281.c View File

@ -766,13 +766,13 @@ static void snd_cs4281_mode(struct cs4281 *chip, struct cs4281_dma *dma,
if (!capture) {
if (dma->left_slot == chip->src_left_play_slot) {
unsigned int val = snd_cs4281_rate(runtime->rate, NULL);
snd_assert(dma->right_slot == chip->src_right_play_slot, );
snd_BUG_ON(dma->right_slot != chip->src_right_play_slot);
snd_cs4281_pokeBA0(chip, BA0_DACSR, val);
}
} else {
if (dma->left_slot == chip->src_left_rec_slot) {
unsigned int val = snd_cs4281_rate(runtime->rate, NULL);
snd_assert(dma->right_slot == chip->src_right_rec_slot, );
snd_BUG_ON(dma->right_slot != chip->src_right_rec_slot);
snd_cs4281_pokeBA0(chip, BA0_ADCSR, val);
}
}
@ -1209,7 +1209,8 @@ static void snd_cs4281_gameport_trigger(struct gameport *gameport)
{
struct cs4281 *chip = gameport_get_port_data(gameport);
snd_assert(chip, return);
if (snd_BUG_ON(!chip))
return;
snd_cs4281_pokeBA0(chip, BA0_JSPT, 0xff);
}
@ -1217,7 +1218,8 @@ static unsigned char snd_cs4281_gameport_read(struct gameport *gameport)
{
struct cs4281 *chip = gameport_get_port_data(gameport);
snd_assert(chip, return 0);
if (snd_BUG_ON(!chip))
return 0;
return snd_cs4281_peekBA0(chip, BA0_JSPT);
}
@ -1228,7 +1230,8 @@ static int snd_cs4281_gameport_cooked_read(struct gameport *gameport,
struct cs4281 *chip = gameport_get_port_data(gameport);
unsigned js1, js2, jst;
snd_assert(chip, return 0);
if (snd_BUG_ON(!chip))
return 0;
js1 = snd_cs4281_peekBA0(chip, BA0_JSC1);
js2 = snd_cs4281_peekBA0(chip, BA0_JSC2);


+ 42
- 30
sound/pci/cs46xx/cs46xx_lib.c View File

@ -90,9 +90,10 @@ static unsigned short snd_cs46xx_codec_read(struct snd_cs46xx *chip,
int count;
unsigned short result,tmp;
u32 offset = 0;
snd_assert ( (codec_index == CS46XX_PRIMARY_CODEC_INDEX) ||
(codec_index == CS46XX_SECONDARY_CODEC_INDEX),
return -EINVAL);
if (snd_BUG_ON(codec_index != CS46XX_PRIMARY_CODEC_INDEX &&
codec_index != CS46XX_SECONDARY_CODEC_INDEX))
return -EINVAL;
chip->active_ctrl(chip, 1);
@ -212,9 +213,9 @@ static unsigned short snd_cs46xx_ac97_read(struct snd_ac97 * ac97,
unsigned short val;
int codec_index = ac97->num;
snd_assert(codec_index == CS46XX_PRIMARY_CODEC_INDEX ||
codec_index == CS46XX_SECONDARY_CODEC_INDEX,
return 0xffff);
if (snd_BUG_ON(codec_index != CS46XX_PRIMARY_CODEC_INDEX &&
codec_index != CS46XX_SECONDARY_CODEC_INDEX))
return 0xffff;
val = snd_cs46xx_codec_read(chip, reg, codec_index);
@ -229,9 +230,9 @@ static void snd_cs46xx_codec_write(struct snd_cs46xx *chip,
{
int count;
snd_assert ((codec_index == CS46XX_PRIMARY_CODEC_INDEX) ||
(codec_index == CS46XX_SECONDARY_CODEC_INDEX),
return);
if (snd_BUG_ON(codec_index != CS46XX_PRIMARY_CODEC_INDEX &&
codec_index != CS46XX_SECONDARY_CODEC_INDEX))
return;
chip->active_ctrl(chip, 1);
@ -294,9 +295,9 @@ static void snd_cs46xx_ac97_write(struct snd_ac97 *ac97,
struct snd_cs46xx *chip = ac97->private_data;
int codec_index = ac97->num;
snd_assert(codec_index == CS46XX_PRIMARY_CODEC_INDEX ||
codec_index == CS46XX_SECONDARY_CODEC_INDEX,
return);
if (snd_BUG_ON(codec_index != CS46XX_PRIMARY_CODEC_INDEX &&
codec_index != CS46XX_SECONDARY_CODEC_INDEX))
return;
snd_cs46xx_codec_write(chip, reg, val, codec_index);
}
@ -315,7 +316,8 @@ int snd_cs46xx_download(struct snd_cs46xx *chip,
unsigned int bank = offset >> 16;
offset = offset & 0xffff;
snd_assert(!(offset & 3) && !(len & 3), return -EINVAL);
if (snd_BUG_ON((offset & 3) || (len & 3)))
return -EINVAL;
dst = chip->region.idx[bank+1].remap_addr + offset;
len /= sizeof(u32);
@ -343,7 +345,8 @@ int snd_cs46xx_clear_BA1(struct snd_cs46xx *chip,
unsigned int bank = offset >> 16;
offset = offset & 0xffff;
snd_assert(!(offset & 3) && !(len & 3), return -EINVAL);
if (snd_BUG_ON((offset & 3) || (len & 3)))
return -EINVAL;
dst = chip->region.idx[bank+1].remap_addr + offset;
len /= sizeof(u32);
@ -722,7 +725,9 @@ static snd_pcm_uframes_t snd_cs46xx_playback_direct_pointer(struct snd_pcm_subst
struct snd_cs46xx *chip = snd_pcm_substream_chip(substream);
size_t ptr;
struct snd_cs46xx_pcm *cpcm = substream->runtime->private_data;
snd_assert (cpcm->pcm_channel,return -ENXIO);
if (snd_BUG_ON(!cpcm->pcm_channel))
return -ENXIO;
#ifdef CONFIG_SND_CS46XX_NEW_DSP
ptr = snd_cs46xx_peek(chip, (cpcm->pcm_channel->pcm_reader_scb->address + 2) << 2);
@ -740,7 +745,8 @@ static snd_pcm_uframes_t snd_cs46xx_playback_indirect_pointer(struct snd_pcm_sub
struct snd_cs46xx_pcm *cpcm = substream->runtime->private_data;
#ifdef CONFIG_SND_CS46XX_NEW_DSP
snd_assert (cpcm->pcm_channel,return -ENXIO);
if (snd_BUG_ON(!cpcm->pcm_channel))
return -ENXIO;
ptr = snd_cs46xx_peek(chip, (cpcm->pcm_channel->pcm_reader_scb->address + 2) << 2);
#else
ptr = snd_cs46xx_peek(chip, BA1_PBA);
@ -908,7 +914,8 @@ static int snd_cs46xx_playback_hw_params(struct snd_pcm_substream *substream,
cpcm = runtime->private_data;
#ifdef CONFIG_SND_CS46XX_NEW_DSP
snd_assert (sample_rate != 0, return -ENXIO);
if (snd_BUG_ON(!sample_rate))
return -ENXIO;
mutex_lock(&chip->spos_mutex);
@ -917,7 +924,7 @@ static int snd_cs46xx_playback_hw_params(struct snd_pcm_substream *substream,
return -ENXIO;
}
snd_assert (cpcm->pcm_channel != NULL);
snd_BUG_ON(!cpcm->pcm_channel);
if (!cpcm->pcm_channel) {
mutex_unlock(&chip->spos_mutex);
return -ENXIO;
@ -952,7 +959,7 @@ static int snd_cs46xx_playback_hw_params(struct snd_pcm_substream *substream,
} else if (cpcm->pcm_channel_id == DSP_IEC958_CHANNEL) {
substream->ops = &snd_cs46xx_playback_iec958_ops;
} else {
snd_assert(0);
snd_BUG();
}
#else
substream->ops = &snd_cs46xx_playback_ops;
@ -981,7 +988,7 @@ static int snd_cs46xx_playback_hw_params(struct snd_pcm_substream *substream,
} else if (cpcm->pcm_channel_id == DSP_IEC958_CHANNEL) {
substream->ops = &snd_cs46xx_playback_indirect_iec958_ops;
} else {
snd_assert(0);
snd_BUG();
}
#else
substream->ops = &snd_cs46xx_playback_indirect_ops;
@ -1029,7 +1036,8 @@ static int snd_cs46xx_playback_prepare(struct snd_pcm_substream *substream)
cpcm = runtime->private_data;
#ifdef CONFIG_SND_CS46XX_NEW_DSP
snd_assert (cpcm->pcm_channel != NULL, return -ENXIO);
if (snd_BUG_ON(!cpcm->pcm_channel))
return -ENXIO;
pfie = snd_cs46xx_peek(chip, (cpcm->pcm_channel->pcm_reader_scb->address + 1) << 2 );
pfie &= ~0x0000f03f;
@ -1714,9 +1722,9 @@ static void snd_cs46xx_mixer_free_ac97(struct snd_ac97 *ac97)
{
struct snd_cs46xx *chip = ac97->private_data;
snd_assert ((ac97 == chip->ac97[CS46XX_PRIMARY_CODEC_INDEX]) ||
(ac97 == chip->ac97[CS46XX_SECONDARY_CODEC_INDEX]),
return);
if (snd_BUG_ON(ac97 != chip->ac97[CS46XX_PRIMARY_CODEC_INDEX] &&
ac97 != chip->ac97[CS46XX_SECONDARY_CODEC_INDEX]))
return;
if (ac97 == chip->ac97[CS46XX_PRIMARY_CODEC_INDEX]) {
chip->ac97[CS46XX_PRIMARY_CODEC_INDEX] = NULL;
@ -1864,7 +1872,7 @@ static int snd_cs46xx_iec958_put(struct snd_kcontrol *kcontrol,
break;
default:
res = -EINVAL;
snd_assert(0, (void)0);
snd_BUG(); /* should never happen ... */
}
return res;
@ -2236,7 +2244,7 @@ static void snd_cs46xx_codec_reset (struct snd_ac97 * ac97)
snd_printdd("cs46xx: CODOEC2 mode %04x\n",0x3);
snd_cs46xx_ac97_write(ac97,AC97_CSR_ACMODE,0x3);
} else {
snd_assert(0); /* should never happen ... */
snd_BUG(); /* should never happen ... */
}
udelay(50);
@ -2553,7 +2561,8 @@ static void snd_cs46xx_gameport_trigger(struct gameport *gameport)
{
struct snd_cs46xx *chip = gameport_get_port_data(gameport);
snd_assert(chip, return);
if (snd_BUG_ON(!chip))
return;
snd_cs46xx_pokeBA0(chip, BA0_JSPT, 0xFF); //outb(gameport->io, 0xFF);
}
@ -2561,7 +2570,8 @@ static unsigned char snd_cs46xx_gameport_read(struct gameport *gameport)
{
struct snd_cs46xx *chip = gameport_get_port_data(gameport);
snd_assert(chip, return 0);
if (snd_BUG_ON(!chip))
return 0;
return snd_cs46xx_peekBA0(chip, BA0_JSPT); //inb(gameport->io);
}
@ -2570,7 +2580,8 @@ static int snd_cs46xx_gameport_cooked_read(struct gameport *gameport, int *axes,
struct snd_cs46xx *chip = gameport_get_port_data(gameport);
unsigned js1, js2, jst;
snd_assert(chip, return 0);
if (snd_BUG_ON(!chip))
return 0;
js1 = snd_cs46xx_peekBA0(chip, BA0_JSC1);
js2 = snd_cs46xx_peekBA0(chip, BA0_JSC2);
@ -2754,7 +2765,8 @@ static int snd_cs46xx_free(struct snd_cs46xx *chip)
{
int idx;
snd_assert(chip != NULL, return -EINVAL);
if (snd_BUG_ON(!chip))
return -EINVAL;
if (chip->active_ctrl)
chip->active_ctrl(chip, 1);


+ 34
- 17
sound/pci/cs46xx/dsp_spos.c View File

@ -63,7 +63,8 @@ static int shadow_and_reallocate_code (struct snd_cs46xx * chip, u32 * data, u32
u32 mop_operands,mop_type,wide_op;
struct dsp_spos_instance * ins = chip->dsp_spos_instance;
snd_assert( ((size % 2) == 0), return -EINVAL);
if (snd_BUG_ON(size %2))
return -EINVAL;
while (i < size) {
loval = data[i++];
@ -289,7 +290,8 @@ void cs46xx_dsp_spos_destroy (struct snd_cs46xx * chip)
int i;
struct dsp_spos_instance * ins = chip->dsp_spos_instance;
snd_assert(ins != NULL, return);
if (snd_BUG_ON(!ins))
return;
mutex_lock(&chip->spos_mutex);
for (i = 0; i < ins->nscb; ++i) {
@ -404,7 +406,8 @@ int cs46xx_dsp_load_module (struct snd_cs46xx * chip, struct dsp_module_desc * m
/* if module has a code segment it must have
symbol table */
snd_assert(module->symbol_table.symbols != NULL ,return -ENOMEM);
if (snd_BUG_ON(!module->symbol_table.symbols))
return -ENOMEM;
if (add_symbols(chip,module)) {
snd_printk(KERN_ERR "dsp_spos: failed to load symbol table\n");
return -ENOMEM;
@ -1369,7 +1372,8 @@ int cs46xx_dsp_scb_and_task_init (struct snd_cs46xx *chip)
valid_slots = snd_cs46xx_peekBA0(chip, BA0_ACOSV);
snd_assert (chip->nr_ac97_codecs == 1 || chip->nr_ac97_codecs == 2);
if (snd_BUG_ON(chip->nr_ac97_codecs != 1 && chip->nr_ac97_codecs != 2))
goto _fail_end;
if (chip->nr_ac97_codecs == 1) {
/* output on slot 5 and 11
@ -1609,11 +1613,14 @@ static int cs46xx_dsp_async_init (struct snd_cs46xx *chip,
spdifo_scb_desc = cs46xx_dsp_create_scb(chip,"SPDIFOSCB",(u32 *)&spdifo_scb,SPDIFO_SCB_INST);
snd_assert(spdifo_scb_desc, return -EIO);
if (snd_BUG_ON(!spdifo_scb_desc))
return -EIO;
spdifi_scb_desc = cs46xx_dsp_create_scb(chip,"SPDIFISCB",(u32 *)&spdifi_scb,SPDIFI_SCB_INST);
snd_assert(spdifi_scb_desc, return -EIO);
if (snd_BUG_ON(!spdifi_scb_desc))
return -EIO;
async_codec_scb_desc = cs46xx_dsp_create_scb(chip,"AsynCodecInputSCB",(u32 *)&async_codec_input_scb, HFG_TREE_SCB);
snd_assert(async_codec_scb_desc, return -EIO);
if (snd_BUG_ON(!async_codec_scb_desc))
return -EIO;
async_codec_scb_desc->parent_scb_ptr = NULL;
async_codec_scb_desc->next_scb_ptr = spdifi_scb_desc;
@ -1698,8 +1705,10 @@ int cs46xx_dsp_enable_spdif_in (struct snd_cs46xx *chip)
chip->active_ctrl(chip, 1);
chip->amplifier_ctrl(chip, 1);
snd_assert (ins->asynch_rx_scb == NULL,return -EINVAL);
snd_assert (ins->spdif_in_src != NULL,return -EINVAL);
if (snd_BUG_ON(ins->asynch_rx_scb))
return -EINVAL;
if (snd_BUG_ON(!ins->spdif_in_src))
return -EINVAL;
mutex_lock(&chip->spos_mutex);
@ -1754,8 +1763,10 @@ int cs46xx_dsp_disable_spdif_in (struct snd_cs46xx *chip)
{
struct dsp_spos_instance * ins = chip->dsp_spos_instance;
snd_assert (ins->asynch_rx_scb != NULL, return -EINVAL);
snd_assert (ins->spdif_in_src != NULL,return -EINVAL);
if (snd_BUG_ON(!ins->asynch_rx_scb))
return -EINVAL;
if (snd_BUG_ON(!ins->spdif_in_src))
return -EINVAL;
mutex_lock(&chip->spos_mutex);
@ -1780,8 +1791,10 @@ int cs46xx_dsp_enable_pcm_capture (struct snd_cs46xx *chip)
{
struct dsp_spos_instance * ins = chip->dsp_spos_instance;
snd_assert (ins->pcm_input == NULL,return -EINVAL);
snd_assert (ins->ref_snoop_scb != NULL,return -EINVAL);
if (snd_BUG_ON(ins->pcm_input))
return -EINVAL;
if (snd_BUG_ON(!ins->ref_snoop_scb))
return -EINVAL;
mutex_lock(&chip->spos_mutex);
ins->pcm_input = cs46xx_add_record_source(chip,ins->ref_snoop_scb,PCMSERIALIN_PCM_SCB_ADDR,
@ -1795,7 +1808,8 @@ int cs46xx_dsp_disable_pcm_capture (struct snd_cs46xx *chip)
{
struct dsp_spos_instance * ins = chip->dsp_spos_instance;
snd_assert (ins->pcm_input != NULL,return -EINVAL);
if (snd_BUG_ON(!ins->pcm_input))
return -EINVAL;
mutex_lock(&chip->spos_mutex);
cs46xx_dsp_remove_scb (chip,ins->pcm_input);
@ -1809,8 +1823,10 @@ int cs46xx_dsp_enable_adc_capture (struct snd_cs46xx *chip)
{
struct dsp_spos_instance * ins = chip->dsp_spos_instance;
snd_assert (ins->adc_input == NULL,return -EINVAL);
snd_assert (ins->codec_in_scb != NULL,return -EINVAL);
if (snd_BUG_ON(ins->adc_input))
return -EINVAL;
if (snd_BUG_ON(!ins->codec_in_scb))
return -EINVAL;
mutex_lock(&chip->spos_mutex);
ins->adc_input = cs46xx_add_record_source(chip,ins->codec_in_scb,PCMSERIALIN_SCB_ADDR,
@ -1824,7 +1840,8 @@ int cs46xx_dsp_disable_adc_capture (struct snd_cs46xx *chip)
{
struct dsp_spos_instance * ins = chip->dsp_spos_instance;
snd_assert (ins->adc_input != NULL,return -EINVAL);
if (snd_BUG_ON(!ins->adc_input))
return -EINVAL;
mutex_lock(&chip->spos_mutex);
cs46xx_dsp_remove_scb (chip,ins->adc_input);


+ 70
- 45
sound/pci/cs46xx/dsp_spos_scb_lib.c View File

@ -46,8 +46,11 @@ static void remove_symbol (struct snd_cs46xx * chip, struct dsp_symbol_entry * s
struct dsp_spos_instance * ins = chip->dsp_spos_instance;
int symbol_index = (int)(symbol - ins->symbol_table.symbols);
snd_assert(ins->symbol_table.nsymbols > 0,return);
snd_assert(symbol_index >= 0 && symbol_index < ins->symbol_table.nsymbols, return);
if (snd_BUG_ON(ins->symbol_table.nsymbols <= 0))
return;
if (snd_BUG_ON(symbol_index < 0 ||
symbol_index >= ins->symbol_table.nsymbols))
return;
ins->symbol_table.symbols[symbol_index].deleted = 1;
@ -116,8 +119,9 @@ static void _dsp_unlink_scb (struct snd_cs46xx *chip, struct dsp_scb_descriptor
if ( scb->parent_scb_ptr ) {
/* unlink parent SCB */
snd_assert ((scb->parent_scb_ptr->sub_list_ptr == scb ||
scb->parent_scb_ptr->next_scb_ptr == scb),return);
if (snd_BUG_ON(scb->parent_scb_ptr->sub_list_ptr != scb &&
scb->parent_scb_ptr->next_scb_ptr != scb))
return;
if (scb->parent_scb_ptr->sub_list_ptr == scb) {
@ -140,7 +144,6 @@ static void _dsp_unlink_scb (struct snd_cs46xx *chip, struct dsp_scb_descriptor
scb->next_scb_ptr = ins->the_null_scb;
}
} else {
/* snd_assert ( (scb->sub_list_ptr == ins->the_null_scb), return); */
scb->parent_scb_ptr->next_scb_ptr = scb->next_scb_ptr;
if (scb->next_scb_ptr != ins->the_null_scb) {
@ -181,16 +184,17 @@ void cs46xx_dsp_remove_scb (struct snd_cs46xx *chip, struct dsp_scb_descriptor *
unsigned long flags;
/* check integrety */
snd_assert ( (scb->index >= 0 &&
scb->index < ins->nscb &&
(ins->scbs + scb->index) == scb), return );
if (snd_BUG_ON(scb->index < 0 ||
scb->index >= ins->nscb ||
(ins->scbs + scb->index) != scb))
return;
#if 0
/* can't remove a SCB with childs before
removing childs first */
snd_assert ( (scb->sub_list_ptr == ins->the_null_scb &&
scb->next_scb_ptr == ins->the_null_scb),
goto _end);
if (snd_BUG_ON(scb->sub_list_ptr != ins->the_null_scb ||
scb->next_scb_ptr != ins->the_null_scb))
goto _end;
#endif
spin_lock_irqsave(&scb->lock, flags);
@ -198,7 +202,8 @@ void cs46xx_dsp_remove_scb (struct snd_cs46xx *chip, struct dsp_scb_descriptor *
spin_unlock_irqrestore(&scb->lock, flags);
cs46xx_dsp_proc_free_scb_desc(scb);
snd_assert (scb->scb_symbol != NULL, return );
if (snd_BUG_ON(!scb->scb_symbol))
return;
remove_symbol (chip,scb->scb_symbol);
ins->scbs[scb->index].deleted = 1;
@ -234,7 +239,6 @@ void cs46xx_dsp_proc_free_scb_desc (struct dsp_scb_descriptor * scb)
snd_info_free_entry(scb->proc_info);
scb->proc_info = NULL;
snd_assert (scb_info != NULL, return);
kfree (scb_info);
}
}
@ -291,7 +295,8 @@ _dsp_create_generic_scb (struct snd_cs46xx *chip, char * name, u32 * scb_data, u
unsigned long flags;
snd_assert (ins->the_null_scb != NULL,return NULL);
if (snd_BUG_ON(!ins->the_null_scb))
return NULL;
/* fill the data that will be wroten to DSP */
scb_data[SCBsubListPtr] =
@ -321,18 +326,20 @@ _dsp_create_generic_scb (struct snd_cs46xx *chip, char * name, u32 * scb_data, u
#endif
/* link to parent SCB */
if (scb_child_type == SCB_ON_PARENT_NEXT_SCB) {
snd_assert ( (scb->parent_scb_ptr->next_scb_ptr == ins->the_null_scb),
return NULL);
if (snd_BUG_ON(scb->parent_scb_ptr->next_scb_ptr !=
ins->the_null_scb))
return NULL;
scb->parent_scb_ptr->next_scb_ptr = scb;
} else if (scb_child_type == SCB_ON_PARENT_SUBLIST_SCB) {
snd_assert ( (scb->parent_scb_ptr->sub_list_ptr == ins->the_null_scb),
return NULL);
if (snd_BUG_ON(scb->parent_scb_ptr->sub_list_ptr !=
ins->the_null_scb))
return NULL;
scb->parent_scb_ptr->sub_list_ptr = scb;
} else {
snd_assert (0,return NULL);
snd_BUG();
}
spin_lock_irqsave(&chip->reg_lock, flags);
@ -675,7 +682,7 @@ cs46xx_dsp_create_src_task_scb(struct snd_cs46xx * chip, char * scb_name,
if (pass_through) {
/* wont work with any other rate than
the native DSP rate */
snd_assert (rate == 48000);
snd_BUG_ON(rate != 48000);
scb = cs46xx_dsp_create_generic_scb(chip,scb_name,(u32 *)&src_task_scb,
dest,"DMAREADER",parent_scb,
@ -1142,7 +1149,8 @@ find_next_free_scb (struct snd_cs46xx * chip, struct dsp_scb_descriptor * from)
struct dsp_scb_descriptor * scb = from;
while (scb->next_scb_ptr != ins->the_null_scb) {
snd_assert (scb->next_scb_ptr != NULL, return NULL);
if (snd_BUG_ON(!scb->next_scb_ptr))
return NULL;
scb = scb->next_scb_ptr;
}
@ -1246,10 +1254,11 @@ cs46xx_dsp_create_pcm_channel (struct snd_cs46xx * chip,
break;
case DSP_PCM_S71_CHANNEL:
/* TODO */
snd_assert(0);
snd_BUG();
break;
case DSP_IEC958_CHANNEL:
snd_assert (ins->asynch_tx_scb != NULL, return NULL);
if (snd_BUG_ON(!ins->asynch_tx_scb))
return NULL;
mixer_scb = ins->asynch_tx_scb;
/* if sample rate is set to 48khz we pass
@ -1262,7 +1271,7 @@ cs46xx_dsp_create_pcm_channel (struct snd_cs46xx * chip,
}
break;
default:
snd_assert (0);
snd_BUG();
return NULL;
}
/* default sample rate is 44100 */
@ -1308,7 +1317,8 @@ cs46xx_dsp_create_pcm_channel (struct snd_cs46xx * chip,
break;
}
}
snd_assert (src_index != -1,return NULL);
if (snd_BUG_ON(src_index == -1))
return NULL;
/* we need to create a new SRC SCB */
if (mixer_scb->sub_list_ptr == ins->the_null_scb) {
@ -1462,9 +1472,10 @@ void cs46xx_dsp_destroy_pcm_channel (struct snd_cs46xx * chip,
struct dsp_spos_instance * ins = chip->dsp_spos_instance;
unsigned long flags;
snd_assert(pcm_channel->active, return );
snd_assert(ins->npcm_channels > 0, return );
snd_assert(pcm_channel->src_scb->ref_count > 0, return );
if (snd_BUG_ON(!pcm_channel->active ||
ins->npcm_channels <= 0 ||
pcm_channel->src_scb->ref_count <= 0))
return;
spin_lock_irqsave(&chip->reg_lock, flags);
pcm_channel->unlinked = 1;
@ -1479,8 +1490,9 @@ void cs46xx_dsp_destroy_pcm_channel (struct snd_cs46xx * chip,
if (!pcm_channel->src_scb->ref_count) {
cs46xx_dsp_remove_scb(chip,pcm_channel->src_scb);
snd_assert (pcm_channel->src_slot >= 0 && pcm_channel->src_slot < DSP_MAX_SRC_NR,
return );
if (snd_BUG_ON(pcm_channel->src_slot < 0 ||
pcm_channel->src_slot >= DSP_MAX_SRC_NR))
return;
ins->src_scb_slots[pcm_channel->src_slot] = 0;
ins->nsrc_scb --;
@ -1490,11 +1502,11 @@ void cs46xx_dsp_destroy_pcm_channel (struct snd_cs46xx * chip,
int cs46xx_dsp_pcm_unlink (struct snd_cs46xx * chip,
struct dsp_pcm_channel_descriptor * pcm_channel)
{
struct dsp_spos_instance * ins = chip->dsp_spos_instance;
unsigned long flags;
snd_assert(pcm_channel->active,return -EIO);
snd_assert(ins->npcm_channels > 0,return -EIO);
if (snd_BUG_ON(!pcm_channel->active ||
chip->dsp_spos_instance->npcm_channels <= 0))
return -EIO;
spin_lock(&pcm_channel->src_scb->lock);
@ -1537,7 +1549,7 @@ int cs46xx_dsp_pcm_link (struct snd_cs46xx * chip,
src_scb->sub_list_ptr = pcm_channel->pcm_reader_scb;
snd_assert (pcm_channel->pcm_reader_scb->parent_scb_ptr == NULL, ; );
snd_BUG_ON(pcm_channel->pcm_reader_scb->parent_scb_ptr);
pcm_channel->pcm_reader_scb->parent_scb_ptr = parent_scb;
spin_lock_irqsave(&chip->reg_lock, flags);
@ -1564,7 +1576,8 @@ cs46xx_add_record_source (struct snd_cs46xx *chip, struct dsp_scb_descriptor * s
struct dsp_scb_descriptor * pcm_input;
int insert_point;
snd_assert (ins->record_mixer_scb != NULL,return NULL);
if (snd_BUG_ON(!ins->record_mixer_scb))
return NULL;
if (ins->record_mixer_scb->sub_list_ptr != ins->the_null_scb) {
parent = find_next_free_scb (chip,ins->record_mixer_scb->sub_list_ptr);
@ -1583,7 +1596,8 @@ cs46xx_add_record_source (struct snd_cs46xx *chip, struct dsp_scb_descriptor * s
int cs46xx_src_unlink(struct snd_cs46xx *chip, struct dsp_scb_descriptor * src)
{
snd_assert (src->parent_scb_ptr != NULL, return -EINVAL );
if (snd_BUG_ON(!src->parent_scb_ptr))
return -EINVAL;
/* mute SCB */
cs46xx_dsp_scb_set_volume (chip,src,0,0);
@ -1598,8 +1612,10 @@ int cs46xx_src_link(struct snd_cs46xx *chip, struct dsp_scb_descriptor * src)
struct dsp_spos_instance * ins = chip->dsp_spos_instance;
struct dsp_scb_descriptor * parent_scb;
snd_assert (src->parent_scb_ptr == NULL, return -EINVAL );
snd_assert(ins->master_mix_scb !=NULL, return -EINVAL );
if (snd_BUG_ON(src->parent_scb_ptr))
return -EINVAL;
if (snd_BUG_ON(!ins->master_mix_scb))
return -EINVAL;
if (ins->master_mix_scb->sub_list_ptr != ins->the_null_scb) {
parent_scb = find_next_free_scb (chip,ins->master_mix_scb->sub_list_ptr);
@ -1635,8 +1651,11 @@ int cs46xx_dsp_enable_spdif_out (struct snd_cs46xx *chip)
return -EBUSY;
}
snd_assert (ins->asynch_tx_scb == NULL, return -EINVAL);
snd_assert (ins->master_mix_scb->next_scb_ptr == ins->the_null_scb, return -EINVAL);
if (snd_BUG_ON(ins->asynch_tx_scb))
return -EINVAL;
if (snd_BUG_ON(ins->master_mix_scb->next_scb_ptr !=
ins->the_null_scb))
return -EINVAL;
/* reset output snooper sample buffer pointer */
snd_cs46xx_poke (chip, (ins->ref_snoop_scb->address + 2) << 2,
@ -1676,10 +1695,15 @@ int cs46xx_dsp_disable_spdif_out (struct snd_cs46xx *chip)
}
/* check integrety */
snd_assert (ins->asynch_tx_scb != NULL, return -EINVAL);
snd_assert (ins->spdif_pcm_input_scb != NULL,return -EINVAL);
snd_assert (ins->master_mix_scb->next_scb_ptr == ins->asynch_tx_scb, return -EINVAL);
snd_assert (ins->asynch_tx_scb->parent_scb_ptr == ins->master_mix_scb, return -EINVAL);
if (snd_BUG_ON(!ins->asynch_tx_scb))
return -EINVAL;
if (snd_BUG_ON(!ins->spdif_pcm_input_scb))
return -EINVAL;
if (snd_BUG_ON(ins->master_mix_scb->next_scb_ptr != ins->asynch_tx_scb))
return -EINVAL;
if (snd_BUG_ON(ins->asynch_tx_scb->parent_scb_ptr !=
ins->master_mix_scb))
return -EINVAL;
cs46xx_dsp_remove_scb (chip,ins->spdif_pcm_input_scb);
cs46xx_dsp_remove_scb (chip,ins->asynch_tx_scb);
@ -1734,7 +1758,8 @@ int cs46xx_iec958_post_close (struct snd_cs46xx *chip)
{
struct dsp_spos_instance * ins = chip->dsp_spos_instance;
snd_assert (ins->asynch_tx_scb != NULL, return -EINVAL);
if (snd_BUG_ON(!ins->asynch_tx_scb))
return -EINVAL;
ins->spdif_status_out &= ~DSP_SPDIF_STATUS_PLAYBACK_OPEN;


+ 2
- 1
sound/pci/echoaudio/darla20_dsp.c View File

@ -34,7 +34,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
int err;
DE_INIT(("init_hw() - Darla20\n"));
snd_assert((subdevice_id & 0xfff0) == DARLA20, return -ENODEV);
if (snd_BUG_ON((subdevice_id & 0xfff0) != DARLA20))
return -ENODEV;
if ((err = init_dsp_comm_page(chip))) {
DE_INIT(("init_hw - could not initialize DSP comm page\n"));


+ 5
- 3
sound/pci/echoaudio/darla24_dsp.c View File

@ -34,7 +34,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
int err;
DE_INIT(("init_hw() - Darla24\n"));
snd_assert((subdevice_id & 0xfff0) == DARLA24, return -ENODEV);
if (snd_BUG_ON((subdevice_id & 0xfff0) != DARLA24))
return -ENODEV;
if ((err = init_dsp_comm_page(chip))) {
DE_INIT(("init_hw - could not initialize DSP comm page\n"));
@ -148,8 +149,9 @@ static int set_sample_rate(struct echoaudio *chip, u32 rate)
static int set_input_clock(struct echoaudio *chip, u16 clock)
{
snd_assert(clock == ECHO_CLOCK_INTERNAL ||
clock == ECHO_CLOCK_ESYNC, return -EINVAL);
if (snd_BUG_ON(clock != ECHO_CLOCK_INTERNAL &&
clock != ECHO_CLOCK_ESYNC))
return -EINVAL;
chip->input_clock = clock;
return set_sample_rate(chip, chip->sample_rate);
}


+ 6
- 3
sound/pci/echoaudio/echo3g_dsp.c View File

@ -47,7 +47,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
local_irq_enable();
DE_INIT(("init_hw() - Echo3G\n"));
snd_assert((subdevice_id & 0xfff0) == ECHO3G, return -ENODEV);
if (snd_BUG_ON((subdevice_id & 0xfff0) != ECHO3G))
return -ENODEV;
if ((err = init_dsp_comm_page(chip))) {
DE_INIT(("init_hw - could not initialize DSP comm page\n"));
@ -104,9 +105,11 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
if ((err = init_line_levels(chip)) < 0)
return err;
err = set_digital_mode(chip, DIGITAL_MODE_SPDIF_RCA);
snd_assert(err >= 0, return err);
if (err < 0)
return err;
err = set_phantom_power(chip, 0);
snd_assert(err >= 0, return err);
if (err < 0)
return err;
err = set_professional_spdif(chip, TRUE);
DE_INIT(("init_hw done\n"));


+ 5
- 3
sound/pci/echoaudio/echoaudio.c View File

@ -503,7 +503,7 @@ static int init_engine(struct snd_pcm_substream *substream,
if (pipe->index >= 0) {
DE_HWP(("hwp_ie free(%d)\n", pipe->index));
err = free_pipes(chip, pipe);
snd_assert(!err);
snd_BUG_ON(err);
chip->substream[pipe->index] = NULL;
}
@ -690,8 +690,10 @@ static int pcm_prepare(struct snd_pcm_substream *substream)
return -EINVAL;
}
snd_assert(pipe_index < px_num(chip), return -EINVAL);
snd_assert(is_pipe_allocated(chip, pipe_index), return -EINVAL);
if (snd_BUG_ON(pipe_index >= px_num(chip)))
return -EINVAL;
if (snd_BUG_ON(!is_pipe_allocated(chip, pipe_index)))
return -EINVAL;
set_audio_format(chip, pipe_index, &format);
return 0;
}


+ 7
- 4
sound/pci/echoaudio/echoaudio_3g.c View File

@ -103,9 +103,11 @@ static int set_digital_mode(struct echoaudio *chip, u8 mode)
int err, i, o;
/* All audio channels must be closed before changing the digital mode */
snd_assert(!chip->pipe_alloc_mask, return -EAGAIN);
if (snd_BUG_ON(chip->pipe_alloc_mask))
return -EAGAIN;
snd_assert(chip->digital_modes & (1 << mode), return -EINVAL);
if (snd_BUG_ON(!(chip->digital_modes & (1 << mode))))
return -EINVAL;
previous_mode = chip->digital_mode;
err = dsp_set_digital_mode(chip, mode);
@ -267,8 +269,9 @@ static int set_sample_rate(struct echoaudio *chip, u32 rate)
return 0;
}
snd_assert(rate < 50000 || chip->digital_mode != DIGITAL_MODE_ADAT,
return -EINVAL);
if (snd_BUG_ON(rate >= 50000 &&
chip->digital_mode == DIGITAL_MODE_ADAT))
return -EINVAL;
clock = 0;
control_reg = le32_to_cpu(chip->comm_page->control_register);


+ 13
- 8
sound/pci/echoaudio/echoaudio_dsp.c View File

@ -474,7 +474,8 @@ static int load_firmware(struct echoaudio *chip)
const struct firmware *fw;
int box_type, err;
snd_assert(chip->dsp_code_to_load && chip->comm_page, return -EPERM);
if (snd_BUG_ON(!chip->dsp_code_to_load || !chip->comm_page))
return -EPERM;
/* See if the ASIC is present and working - only if the DSP is already loaded */
if (chip->dsp_code) {
@ -512,8 +513,8 @@ static int load_firmware(struct echoaudio *chip)
/* Set the nominal level for an input or output bus (true = -10dBV, false = +4dBu) */
static int set_nominal_level(struct echoaudio *chip, u16 index, char consumer)
{
snd_assert(index < num_busses_out(chip) + num_busses_in(chip),
return -EINVAL);
if (snd_BUG_ON(index >= num_busses_out(chip) + num_busses_in(chip)))
return -EINVAL;
/* Wait for the handshake (OK even if ASIC is not loaded) */
if (wait_handshake(chip))
@ -536,7 +537,8 @@ static int set_nominal_level(struct echoaudio *chip, u16 index, char consumer)
/* Set the gain for a single physical output channel (dB). */
static int set_output_gain(struct echoaudio *chip, u16 channel, s8 gain)
{
snd_assert(channel < num_busses_out(chip), return -EINVAL);
if (snd_BUG_ON(channel >= num_busses_out(chip)))
return -EINVAL;
if (wait_handshake(chip))
return -EIO;
@ -554,8 +556,9 @@ static int set_output_gain(struct echoaudio *chip, u16 channel, s8 gain)
static int set_monitor_gain(struct echoaudio *chip, u16 output, u16 input,
s8 gain)
{
snd_assert(output < num_busses_out(chip) &&
input < num_busses_in(chip), return -EINVAL);
if (snd_BUG_ON(output >= num_busses_out(chip) ||
input >= num_busses_in(chip)))
return -EINVAL;
if (wait_handshake(chip))
return -EIO;
@ -1065,8 +1068,10 @@ static int free_pipes(struct echoaudio *chip, struct audiopipe *pipe)
int i;
DE_ACT(("free_pipes: Pipe %d\n", pipe->index));
snd_assert(is_pipe_allocated(chip, pipe->index), return -EINVAL);
snd_assert(pipe->state == PIPE_STATE_STOPPED, return -EINVAL);
if (snd_BUG_ON(!is_pipe_allocated(chip, pipe->index)))
return -EINVAL;
if (snd_BUG_ON(pipe->state != PIPE_STATE_STOPPED))
return -EINVAL;
for (channel_mask = i = 0; i < pipe->interleave; i++)
channel_mask |= 1 << (pipe->index + i);


+ 4
- 2
sound/pci/echoaudio/echoaudio_gml.c View File

@ -112,9 +112,11 @@ static int set_digital_mode(struct echoaudio *chip, u8 mode)
return -EIO;
/* All audio channels must be closed before changing the digital mode */
snd_assert(!chip->pipe_alloc_mask, return -EAGAIN);
if (snd_BUG_ON(chip->pipe_alloc_mask))
return -EAGAIN;
snd_assert(chip->digital_modes & (1 << mode), return -EINVAL);
if (snd_BUG_ON(!(chip->digital_modes & (1 << mode))))
return -EINVAL;
previous_mode = chip->digital_mode;
err = dsp_set_digital_mode(chip, mode);


+ 4
- 2
sound/pci/echoaudio/gina20_dsp.c View File

@ -38,7 +38,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
int err;
DE_INIT(("init_hw() - Gina20\n"));
snd_assert((subdevice_id & 0xfff0) == GINA20, return -ENODEV);
if (snd_BUG_ON((subdevice_id & 0xfff0) != GINA20))
return -ENODEV;
if ((err = init_dsp_comm_page(chip))) {
DE_INIT(("init_hw - could not initialize DSP comm page\n"));
@ -177,7 +178,8 @@ static int set_input_clock(struct echoaudio *chip, u16 clock)
/* Set input bus gain (one unit is 0.5dB !) */
static int set_input_gain(struct echoaudio *chip, u16 input, int gain)
{
snd_assert(input < num_busses_in(chip), return -EINVAL);
if (snd_BUG_ON(input >= num_busses_in(chip)))
return -EINVAL;
if (wait_handshake(chip))
return -EIO;


+ 7
- 4
sound/pci/echoaudio/gina24_dsp.c View File

@ -43,7 +43,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
int err;
DE_INIT(("init_hw() - Gina24\n"));
snd_assert((subdevice_id & 0xfff0) == GINA24, return -ENODEV);
if (snd_BUG_ON((subdevice_id & 0xfff0) != GINA24))
return -ENODEV;
if ((err = init_dsp_comm_page(chip))) {
DE_INIT(("init_hw - could not initialize DSP comm page\n"));
@ -84,7 +85,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
if ((err = init_line_levels(chip)) < 0)
return err;
err = set_digital_mode(chip, DIGITAL_MODE_SPDIF_RCA);
snd_assert(err >= 0, return err);
if (err < 0)
return err;
err = set_professional_spdif(chip, TRUE);
DE_INIT(("init_hw done\n"));
@ -163,8 +165,9 @@ static int set_sample_rate(struct echoaudio *chip, u32 rate)
{
u32 control_reg, clock;
snd_assert(rate < 50000 || chip->digital_mode != DIGITAL_MODE_ADAT,
return -EINVAL);
if (snd_BUG_ON(rate >= 50000 &&
chip->digital_mode == DIGITAL_MODE_ADAT))
return -EINVAL;
/* Only set the clock for internal mode. */
if (chip->input_clock != ECHO_CLOCK_INTERNAL) {


+ 5
- 3
sound/pci/echoaudio/indigo_dsp.c View File

@ -39,7 +39,8 @@ static int init_hw(struct echoaudio *chip, u16 device_id, u16 subdevice_id)
int err;
DE_INIT(("init_hw() - Indigo\n"));
snd_assert((subdevice_id & 0xfff0) == INDIGO, return -ENODEV);
if (snd_BUG_ON((subdevice_id & 0xfff0) != INDIGO))
return -ENODEV;
if ((err = init_dsp_comm_page(chip))) {
DE_INIT(("init_hw - could not initialize DSP comm page\n"));
@ -143,8 +144,9 @@ static int set_vmixer_gain(struct echoaudio *chip, u16 output, u16 pipe,
{
int index;
snd_assert(pipe < num_pipes_out(chip) &&
output < num_busses_out(chip), return -EINVAL);
if (snd_BUG_ON(pipe >= num_pipes_out(chip) ||
output >= num_busses_out(chip)))
return -EINVAL;