media: ov5670: get rid of a series of __be warnings
authorMauro Carvalho Chehab <mchehab@s-opensource.com>
Thu, 22 Mar 2018 17:44:33 +0000 (13:44 -0400)
committerMauro Carvalho Chehab <mchehab@s-opensource.com>
Fri, 23 Mar 2018 10:28:41 +0000 (06:28 -0400)
There are some troubles on this driver with respect to the usage
of __be16 and __b32 macros:

drivers/media/i2c/ov5670.c:1857:27: warning: incorrect type in initializer (different base types)
drivers/media/i2c/ov5670.c:1857:27:    expected unsigned short [unsigned] [usertype] reg_addr_be
drivers/media/i2c/ov5670.c:1857:27:    got restricted __be16 [usertype] <noident>
drivers/media/i2c/ov5670.c:1880:16: warning: cast to restricted __be32
drivers/media/i2c/ov5670.c:1880:16: warning: cast to restricted __be32
drivers/media/i2c/ov5670.c:1880:16: warning: cast to restricted __be32
drivers/media/i2c/ov5670.c:1880:16: warning: cast to restricted __be32
drivers/media/i2c/ov5670.c:1880:16: warning: cast to restricted __be32
drivers/media/i2c/ov5670.c:1880:16: warning: cast to restricted __be32
drivers/media/i2c/ov5670.c:1901:13: warning: incorrect type in assignment (different base types)
drivers/media/i2c/ov5670.c:1901:13:    expected unsigned int [unsigned] [usertype] val
drivers/media/i2c/ov5670.c:1901:13:    got restricted __be32 [usertype] <noident>

Fix them.

Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
drivers/media/i2c/ov5670.c

index 556a95c307814c95c4912e810dd6de91fef79d87..d2db480da1b9db07d0c4c91a9256345bfb8663e9 100644 (file)
@@ -1853,8 +1853,8 @@ static int ov5670_read_reg(struct ov5670 *ov5670, u16 reg, unsigned int len,
        struct i2c_client *client = v4l2_get_subdevdata(&ov5670->sd);
        struct i2c_msg msgs[2];
        u8 *data_be_p;
-       u32 data_be = 0;
-       u16 reg_addr_be = cpu_to_be16(reg);
+       __be32 data_be = 0;
+       __be16 reg_addr_be = cpu_to_be16(reg);
        int ret;
 
        if (len > 4)
@@ -1891,6 +1891,7 @@ static int ov5670_write_reg(struct ov5670 *ov5670, u16 reg, unsigned int len,
        int val_i;
        u8 buf[6];
        u8 *val_p;
+       __be32 tmp;
 
        if (len > 4)
                return -EINVAL;
@@ -1898,8 +1899,8 @@ static int ov5670_write_reg(struct ov5670 *ov5670, u16 reg, unsigned int len,
        buf[0] = reg >> 8;
        buf[1] = reg & 0xff;
 
-       val = cpu_to_be32(val);
-       val_p = (u8 *)&val;
+       tmp = cpu_to_be32(val);
+       val_p = (u8 *)&tmp;
        buf_i = 2;
        val_i = 4 - len;