]> git.karo-electronics.de Git - linux-beck.git/commitdiff
staging:iio:ad799x: Use i2c_smbus_{read,write}_word_data_swapped
authorLars-Peter Clausen <lars@metafoo.de>
Tue, 26 Mar 2013 18:43:00 +0000 (18:43 +0000)
committerJonathan Cameron <jic23@kernel.org>
Fri, 29 Mar 2013 09:16:46 +0000 (09:16 +0000)
Use i2c_smbus_{read,write}_word_data_swapped instead of open-coding it.

Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Jonathan Cameron <jic23@kernel.org>
drivers/staging/iio/adc/ad799x_core.c

index d12a4b264891f0e0dc31d49f8dfdcd6dd0d2e94e..8d2012cfa59eb986d87556921962e57cdb2b2123 100644 (file)
@@ -48,13 +48,13 @@ static int ad799x_i2c_read16(struct ad799x_state *st, u8 reg, u16 *data)
        struct i2c_client *client = st->client;
        int ret = 0;
 
-       ret = i2c_smbus_read_word_data(client, reg);
+       ret = i2c_smbus_read_word_swapped(client, reg);
        if (ret < 0) {
                dev_err(&client->dev, "I2C read error\n");
                return ret;
        }
 
-       *data = swab16((u16)ret);
+       *data = (u16)ret;
 
        return 0;
 }
@@ -80,7 +80,7 @@ static int ad799x_i2c_write16(struct ad799x_state *st, u8 reg, u16 data)
        struct i2c_client *client = st->client;
        int ret = 0;
 
-       ret = i2c_smbus_write_word_data(client, reg, swab16(data));
+       ret = i2c_smbus_write_word_swapped(client, reg, data);
        if (ret < 0)
                dev_err(&client->dev, "I2C write error\n");