microblaze: Fix sg_dma_len() regression
[safe/jmp/linux-2.6] / sound / i2c / i2c.c
index 1e58a96..eb7c7d0 100644 (file)
@@ -20,7 +20,6 @@
  *
  */
 
-#include <sound/driver.h>
 #include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/string.h>
@@ -50,7 +49,8 @@ static int snd_i2c_bus_free(struct snd_i2c_bus *bus)
        struct snd_i2c_bus *slave;
        struct snd_i2c_device *device;
 
-       snd_assert(bus != NULL, return -EINVAL);
+       if (snd_BUG_ON(!bus))
+               return -EINVAL;
        while (!list_empty(&bus->devices)) {
                device = snd_i2c_device(bus->devices.next);
                snd_i2c_device_free(device);
@@ -98,7 +98,8 @@ int snd_i2c_bus_create(struct snd_card *card, const char *name,
                bus->master = master;
        }
        strlcpy(bus->name, name, sizeof(bus->name));
-       if ((err = snd_device_new(card, SNDRV_DEV_BUS, bus, &ops)) < 0) {
+       err = snd_device_new(card, SNDRV_DEV_BUS, bus, &ops);
+       if (err < 0) {
                snd_i2c_bus_free(bus);
                return err;
        }
@@ -114,7 +115,8 @@ int snd_i2c_device_create(struct snd_i2c_bus *bus, const char *name,
        struct snd_i2c_device *device;
 
        *rdevice = NULL;
-       snd_assert(bus != NULL, return -EINVAL);
+       if (snd_BUG_ON(!bus))
+               return -EINVAL;
        device = kzalloc(sizeof(*device), GFP_KERNEL);
        if (device == NULL)
                return -ENOMEM;
@@ -245,7 +247,8 @@ static int snd_i2c_bit_sendbyte(struct snd_i2c_bus *bus, unsigned char data)
 
        for (i = 7; i >= 0; i--)
                snd_i2c_bit_send(bus, !!(data & (1 << i)));
-       if ((err = snd_i2c_bit_ack(bus)) < 0)
+       err = snd_i2c_bit_ack(bus);
+       if (err < 0)
                return err;
        return 0;
 }
@@ -277,12 +280,14 @@ static int snd_i2c_bit_sendbytes(struct snd_i2c_device *device,
        if (device->flags & SND_I2C_DEVICE_ADDRTEN)
                return -EIO;            /* not yet implemented */
        snd_i2c_bit_start(bus);
-       if ((err = snd_i2c_bit_sendbyte(bus, device->addr << 1)) < 0) {
+       err = snd_i2c_bit_sendbyte(bus, device->addr << 1);
+       if (err < 0) {
                snd_i2c_bit_hw_stop(bus);
                return err;
        }
        while (count-- > 0) {
-               if ((err = snd_i2c_bit_sendbyte(bus, *bytes++)) < 0) {
+               err = snd_i2c_bit_sendbyte(bus, *bytes++);
+               if (err < 0) {
                        snd_i2c_bit_hw_stop(bus);
                        return err;
                }
@@ -301,12 +306,14 @@ static int snd_i2c_bit_readbytes(struct snd_i2c_device *device,
        if (device->flags & SND_I2C_DEVICE_ADDRTEN)
                return -EIO;            /* not yet implemented */
        snd_i2c_bit_start(bus);
-       if ((err = snd_i2c_bit_sendbyte(bus, (device->addr << 1) | 1)) < 0) {
+       err = snd_i2c_bit_sendbyte(bus, (device->addr << 1) | 1);
+       if (err < 0) {
                snd_i2c_bit_hw_stop(bus);
                return err;
        }
        while (count-- > 0) {
-               if ((err = snd_i2c_bit_readbyte(bus, count == 0)) < 0) {
+               err = snd_i2c_bit_readbyte(bus, count == 0);
+               if (err < 0) {
                        snd_i2c_bit_hw_stop(bus);
                        return err;
                }