[media] ad5820: Fix sparse warning
authorSakari Ailus <sakari.ailus@linux.intel.com>
Fri, 16 Sep 2016 10:16:30 +0000 (07:16 -0300)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Mon, 24 Oct 2016 19:37:12 +0000 (17:37 -0200)
Use a type with explicit endianness in machine to big endian conversion.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/i2c/ad5820.c

index beab2f381b819da25c60547555faed2df9bbf764..a9026a91855e4e6b52b4a71e5392af34832dab26 100644 (file)
@@ -65,16 +65,17 @@ static int ad5820_write(struct ad5820_device *coil, u16 data)
 {
        struct i2c_client *client = v4l2_get_subdevdata(&coil->subdev);
        struct i2c_msg msg;
+       __be16 be_data;
        int r;
 
        if (!client->adapter)
                return -ENODEV;
 
-       data = cpu_to_be16(data);
+       be_data = cpu_to_be16(data);
        msg.addr  = client->addr;
        msg.flags = 0;
        msg.len   = 2;
-       msg.buf   = (u8 *)&data;
+       msg.buf   = (u8 *)&be_data;
 
        r = i2c_transfer(client->adapter, &msg, 1);
        if (r < 0) {