]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - sound/pci/riptide/riptide.c
ALSA: Kill snd_assert() in sound/pci/*
[linux-2.6-omap-h63xx.git] / sound / pci / riptide / riptide.c
index 9408b1eeec40d551615334250d809d8aaf1acdc2..124f9a2f1535eaa286f20b8d2a946c63686843d8 100644 (file)
@@ -682,7 +682,7 @@ static union firmware_version firmware_versions[] = {
        },
 };
 
-static u32 atoh(unsigned char *in, unsigned int len)
+static u32 atoh(const unsigned char *in, unsigned int len)
 {
        u32 sum = 0;
        unsigned int mult = 1;
@@ -702,12 +702,12 @@ static u32 atoh(unsigned char *in, unsigned int len)
        return sum;
 }
 
-static int senddata(struct cmdif *cif, unsigned char *in, u32 offset)
+static int senddata(struct cmdif *cif, const unsigned char *in, u32 offset)
 {
        u32 addr;
        u32 data;
        u32 i;
-       unsigned char *p;
+       const unsigned char *p;
 
        i = atoh(&in[1], 2);
        addr = offset + atoh(&in[3], 4);
@@ -726,10 +726,10 @@ static int senddata(struct cmdif *cif, unsigned char *in, u32 offset)
        return 0;
 }
 
-static int loadfirmware(struct cmdif *cif, unsigned char *img,
+static int loadfirmware(struct cmdif *cif, const unsigned char *img,
                        unsigned int size)
 {
-       unsigned char *in;
+       const unsigned char *in;
        u32 laddr, saddr, t, val;
        int err = 0;
 
@@ -865,7 +865,8 @@ static int sendcmd(struct cmdif *cif, u32 flags, u32 cmd, u32 parm,
        struct riptideport *hwport;
        struct cmdport *cmdport = NULL;
 
-       snd_assert(cif, return -EINVAL);
+       if (snd_BUG_ON(!cif))
+               return -EINVAL;
 
        hwport = cif->hwport;
        if (cif->errcnt > MAX_ERROR_COUNT) {
@@ -1490,7 +1491,8 @@ static int snd_riptide_prepare(struct snd_pcm_substream *substream)
        int err = 0;
        snd_pcm_format_t format;
 
-       snd_assert(cif && data, return -EINVAL);
+       if (snd_BUG_ON(!cif || !data))
+               return -EINVAL;
 
        snd_printdd("prepare id %d ch: %d f:0x%x r:%d\n", data->id,
                    runtime->channels, runtime->format, runtime->rate);
@@ -1630,14 +1632,14 @@ static int snd_riptide_playback_open(struct snd_pcm_substream *substream)
        struct snd_riptide *chip = snd_pcm_substream_chip(substream);
        struct snd_pcm_runtime *runtime = substream->runtime;
        struct pcmhw *data;
-       int index = substream->number;
+       int sub_num = substream->number;
 
-       chip->playback_substream[index] = substream;
+       chip->playback_substream[sub_num] = substream;
        runtime->hw = snd_riptide_playback;
        data = kzalloc(sizeof(struct pcmhw), GFP_KERNEL);
-       data->paths = lbus_play_paths[index];
-       data->id = play_ids[index];
-       data->source = play_sources[index];
+       data->paths = lbus_play_paths[sub_num];
+       data->id = play_ids[sub_num];
+       data->source = play_sources[sub_num];
        data->intdec[0] = 0xff;
        data->intdec[1] = 0xff;
        data->state = ST_STOP;
@@ -1670,10 +1672,10 @@ static int snd_riptide_playback_close(struct snd_pcm_substream *substream)
 {
        struct snd_riptide *chip = snd_pcm_substream_chip(substream);
        struct pcmhw *data = get_pcmhwdev(substream);
-       int index = substream->number;
+       int sub_num = substream->number;
 
        substream->runtime->private_data = NULL;
-       chip->playback_substream[index] = NULL;
+       chip->playback_substream[sub_num] = NULL;
        kfree(data);
        return 0;
 }
@@ -1772,7 +1774,8 @@ snd_riptide_codec_write(struct snd_ac97 *ac97, unsigned short reg,
        union cmdret rptr = CMDRET_ZERO;
        int i = 0;
 
-       snd_assert(cif, return);
+       if (snd_BUG_ON(!cif))
+               return;
 
        snd_printdd("Write AC97 reg 0x%x 0x%x\n", reg, val);
        do {
@@ -1790,7 +1793,8 @@ static unsigned short snd_riptide_codec_read(struct snd_ac97 *ac97,
        struct cmdif *cif = chip->cif;
        union cmdret rptr = CMDRET_ZERO;
 
-       snd_assert(cif, return 0);
+       if (snd_BUG_ON(!cif))
+               return 0;
 
        if (SEND_RACR(cif, reg, &rptr) != 0)
                SEND_RACR(cif, reg, &rptr);
@@ -1804,7 +1808,8 @@ static int snd_riptide_initialize(struct snd_riptide *chip)
        unsigned int device_id;
        int err;
 
-       snd_assert(chip, return -EINVAL);
+       if (snd_BUG_ON(!chip))
+               return -EINVAL;
 
        cif = chip->cif;
        if (!cif) {
@@ -1836,7 +1841,8 @@ static int snd_riptide_free(struct snd_riptide *chip)
 {
        struct cmdif *cif;
 
-       snd_assert(chip, return 0);
+       if (!chip)
+               return 0;
 
        if ((cif = chip->cif)) {
                SET_GRESET(cif->hwport);