]> 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 979f7da641ce28f0bc13e7c98f0664004e9bd5f6..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);
@@ -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);