nfsd: filter readdir results in V4ROOT case
[safe/jmp/linux-2.6] / sound / i2c / cs8427.c
index e601caa..020a5d5 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *  Routines for control of the CS8427 via i2c bus
  *  IEC958 (S/PDIF) receiver & transmitter by Cirrus Logic
- *  Copyright (c) by Jaroslav Kysela <perex@suse.cz>
+ *  Copyright (c) by Jaroslav Kysela <perex@perex.cz>
  *
  *
  *   This program is free software; you can redistribute it and/or modify
  *
  */
 
-#include <sound/driver.h>
 #include <linux/slab.h>
 #include <linux/delay.h>
 #include <linux/init.h>
+#include <asm/unaligned.h>
 #include <sound/core.h>
 #include <sound/control.h>
 #include <sound/pcm.h>
@@ -32,7 +32,7 @@
 
 static void snd_cs8427_reset(struct snd_i2c_device *cs8427);
 
-MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
+MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>");
 MODULE_DESCRIPTION("IEC958 (S/PDIF) receiver & transmitter by Cirrus Logic");
 MODULE_LICENSE("GPL");
 
@@ -265,10 +265,7 @@ int snd_cs8427_create(struct snd_i2c_bus *bus,
                goto __fail;
        }
        /* write default channel status bytes */
-       buf[0] = ((unsigned char)(SNDRV_PCM_DEFAULT_CON_SPDIF >> 0));
-       buf[1] = ((unsigned char)(SNDRV_PCM_DEFAULT_CON_SPDIF >> 8));
-       buf[2] = ((unsigned char)(SNDRV_PCM_DEFAULT_CON_SPDIF >> 16));
-       buf[3] = ((unsigned char)(SNDRV_PCM_DEFAULT_CON_SPDIF >> 24));
+       put_unaligned_le32(SNDRV_PCM_DEFAULT_CON_SPDIF, buf);
        memset(buf + 4, 0, 24 - 4);
        if (snd_cs8427_send_corudata(device, 0, buf, 24) < 0)
                goto __fail;
@@ -317,7 +314,8 @@ static void snd_cs8427_reset(struct snd_i2c_device *cs8427)
        unsigned long end_time;
        int data, aes3input = 0;
 
-       snd_assert(cs8427, return);
+       if (snd_BUG_ON(!cs8427))
+               return;
        chip = cs8427->private_data;
        snd_i2c_lock(cs8427->bus);
        if ((chip->regmap[CS8427_REG_CLOCKSOURCE] & CS8427_RXDAES3INPUT) ==
@@ -529,7 +527,8 @@ int snd_cs8427_iec958_build(struct snd_i2c_device *cs8427,
        unsigned int idx;
        int err;
 
-       snd_assert(play_substream && cap_substream, return -EINVAL);
+       if (snd_BUG_ON(!play_substream || !cap_substream))
+               return -EINVAL;
        for (idx = 0; idx < ARRAY_SIZE(snd_cs8427_iec958_controls); idx++) {
                kctl = snd_ctl_new1(&snd_cs8427_iec958_controls[idx], cs8427);
                if (kctl == NULL)
@@ -546,7 +545,8 @@ int snd_cs8427_iec958_build(struct snd_i2c_device *cs8427,
 
        chip->playback.substream = play_substream;
        chip->capture.substream = cap_substream;
-       snd_assert(chip->playback.pcm_ctl, return -EIO);
+       if (snd_BUG_ON(!chip->playback.pcm_ctl))
+               return -EIO;
        return 0;
 }
 
@@ -556,7 +556,8 @@ int snd_cs8427_iec958_active(struct snd_i2c_device *cs8427, int active)
 {
        struct cs8427 *chip;
 
-       snd_assert(cs8427, return -ENXIO);
+       if (snd_BUG_ON(!cs8427))
+               return -ENXIO;
        chip = cs8427->private_data;
        if (active)
                memcpy(chip->playback.pcm_status,
@@ -576,7 +577,8 @@ int snd_cs8427_iec958_pcm(struct snd_i2c_device *cs8427, unsigned int rate)
        char *status;
        int err, reset;
 
-       snd_assert(cs8427, return -ENXIO);
+       if (snd_BUG_ON(!cs8427))
+               return -ENXIO;
        chip = cs8427->private_data;
        status = chip->playback.pcm_status;
        snd_i2c_lock(cs8427->bus);