]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
[media] ov9640: use macro to request OmniVision OV9640 sensor private data
authorDavid Cohen <dacohen@gmail.com>
Wed, 8 Dec 2010 12:13:58 +0000 (09:13 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Fri, 31 Dec 2010 00:29:20 +0000 (22:29 -0200)
This cleanup patch creates macro to request OmniVision OV9640 private
data, which increases readability.

Signed-off-by: David Cohen <dacohen@gmail.com>
Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/ov9640.c

index 99e9e1d3c83b6aa1696fe46e107c6757e479b33e..c6d8e8a88d2dde28e921f574388ab6c32ec5ede4 100644 (file)
@@ -31,6 +31,8 @@
 
 #include "ov9640.h"
 
+#define to_ov9640_sensor(sd)   container_of(sd, struct ov9640_priv, subdev)
+
 /* default register setup */
 static const struct ov9640_reg ov9640_regs_dflt[] = {
        { OV9640_COM5,  OV9640_COM5_SYSCLK | OV9640_COM5_LONGEXP },
@@ -308,9 +310,7 @@ static unsigned long ov9640_query_bus_param(struct soc_camera_device *icd)
 /* Get status of additional camera capabilities */
 static int ov9640_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
 {
-       struct i2c_client *client = v4l2_get_subdevdata(sd);
-       struct ov9640_priv *priv = container_of(i2c_get_clientdata(client),
-                                       struct ov9640_priv, subdev);
+       struct ov9640_priv *priv = to_ov9640_sensor(sd);
 
        switch (ctrl->id) {
        case V4L2_CID_VFLIP:
@@ -327,8 +327,7 @@ static int ov9640_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
 static int ov9640_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
 {
        struct i2c_client *client = v4l2_get_subdevdata(sd);
-       struct ov9640_priv *priv = container_of(i2c_get_clientdata(client),
-                                       struct ov9640_priv, subdev);
+       struct ov9640_priv *priv = to_ov9640_sensor(sd);
 
        int ret = 0;
 
@@ -360,9 +359,7 @@ static int ov9640_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
 static int ov9640_g_chip_ident(struct v4l2_subdev *sd,
                                struct v4l2_dbg_chip_ident *id)
 {
-       struct i2c_client *client = v4l2_get_subdevdata(sd);
-       struct ov9640_priv *priv = container_of(i2c_get_clientdata(client),
-                                       struct ov9640_priv, subdev);
+       struct ov9640_priv *priv = to_ov9640_sensor(sd);
 
        id->ident       = priv->model;
        id->revision    = priv->revision;