This is an automatic generated email to let you know that the following patch 
were queued at the 
http://git.linuxtv.org/media_tree.git tree:

Subject: [media] smiapp: Define macros for obtaining properties of register 
definitions
Author:  Sakari Ailus <[email protected]>
Date:    Thu Apr 10 10:08:59 2014 -0300

The register address, width and flags are encoded as a 32-bit value. Add
macros for obtaining these separately. Use the macros in register access
functions.

Signed-off-by: Sakari Ailus <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>

 drivers/media/i2c/smiapp/smiapp-regs.c |   13 +++++++------
 drivers/media/i2c/smiapp/smiapp-regs.h |    4 ++++
 2 files changed, 11 insertions(+), 6 deletions(-)

---

http://git.linuxtv.org/media_tree.git?a=commitdiff;h=f5d65070d49f707a06bf00c147f02848659a6a0b

diff --git a/drivers/media/i2c/smiapp/smiapp-regs.c 
b/drivers/media/i2c/smiapp/smiapp-regs.c
index eb5146a..a209800 100644
--- a/drivers/media/i2c/smiapp/smiapp-regs.c
+++ b/drivers/media/i2c/smiapp/smiapp-regs.c
@@ -165,7 +165,7 @@ static int __smiapp_read(struct smiapp_sensor *sensor, u32 
reg, u32 *val,
                         bool only8)
 {
        struct i2c_client *client = v4l2_get_subdevdata(&sensor->src->sd);
-       unsigned int len = (u8)(reg >> 16);
+       u8 len = SMIAPP_REG_WIDTH(reg);
        int rval;
 
        if (len != SMIAPP_REG_8BIT && len != SMIAPP_REG_16BIT
@@ -173,9 +173,10 @@ static int __smiapp_read(struct smiapp_sensor *sensor, u32 
reg, u32 *val,
                return -EINVAL;
 
        if (len == SMIAPP_REG_8BIT || !only8)
-               rval = ____smiapp_read(sensor, (u16)reg, len, val);
+               rval = ____smiapp_read(sensor, SMIAPP_REG_ADDR(reg), len, val);
        else
-               rval = ____smiapp_read_8only(sensor, (u16)reg, len, val);
+               rval = ____smiapp_read_8only(sensor, SMIAPP_REG_ADDR(reg), len,
+                                            val);
        if (rval < 0)
                return rval;
 
@@ -227,9 +228,9 @@ int smiapp_write_no_quirk(struct smiapp_sensor *sensor, u32 
reg, u32 val)
        struct i2c_msg msg;
        unsigned char data[6];
        unsigned int retries;
-       unsigned int flags = reg >> 24;
-       unsigned int len = (u8)(reg >> 16);
-       u16 offset = reg;
+       u8 flags = SMIAPP_REG_FLAGS(reg);
+       u8 len = SMIAPP_REG_WIDTH(reg);
+       u16 offset = SMIAPP_REG_ADDR(reg);
        int r;
 
        if ((len != SMIAPP_REG_8BIT && len != SMIAPP_REG_16BIT &&
diff --git a/drivers/media/i2c/smiapp/smiapp-regs.h 
b/drivers/media/i2c/smiapp/smiapp-regs.h
index 81957cb..3552112 100644
--- a/drivers/media/i2c/smiapp/smiapp-regs.h
+++ b/drivers/media/i2c/smiapp/smiapp-regs.h
@@ -28,6 +28,10 @@
 #include <linux/i2c.h>
 #include <linux/types.h>
 
+#define SMIAPP_REG_ADDR(reg)           ((u16)reg)
+#define SMIAPP_REG_WIDTH(reg)          ((u8)(reg >> 16))
+#define SMIAPP_REG_FLAGS(reg)          ((u8)(reg >> 24))
+
 /* Use upper 8 bits of the type field for flags */
 #define SMIAPP_REG_FLAG_FLOAT          (1 << 24)
 

_______________________________________________
linuxtv-commits mailing list
[email protected]
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to