Merge git://git.kernel.org/pub/scm/linux/kernel/git/wim/linux-2.6-watchdog
[cascardo/linux.git] / drivers / media / video / ov772x.c
index 25eb5d6..48895ef 100644 (file)
@@ -599,8 +599,8 @@ static int ov772x_reset(struct i2c_client *client)
 
 static int ov772x_s_stream(struct v4l2_subdev *sd, int enable)
 {
-       struct i2c_client *client = sd->priv;
-       struct ov772x_priv *priv = to_ov772x(client);
+       struct i2c_client *client = v4l2_get_subdevdata(sd);
+       struct ov772x_priv *priv = container_of(sd, struct ov772x_priv, subdev);
 
        if (!enable) {
                ov772x_mask_set(client, COM2, SOFT_SLEEP_MODE, SOFT_SLEEP_MODE);
@@ -645,8 +645,7 @@ static unsigned long ov772x_query_bus_param(struct soc_camera_device *icd)
 
 static int ov772x_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
 {
-       struct i2c_client *client = sd->priv;
-       struct ov772x_priv *priv = to_ov772x(client);
+       struct ov772x_priv *priv = container_of(sd, struct ov772x_priv, subdev);
 
        switch (ctrl->id) {
        case V4L2_CID_VFLIP:
@@ -664,8 +663,8 @@ static int ov772x_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
 
 static int ov772x_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
 {
-       struct i2c_client *client = sd->priv;
-       struct ov772x_priv *priv = to_ov772x(client);
+       struct i2c_client *client = v4l2_get_subdevdata(sd);
+       struct ov772x_priv *priv = container_of(sd, struct ov772x_priv, subdev);
        int ret = 0;
        u8 val;
 
@@ -715,8 +714,7 @@ static int ov772x_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
 static int ov772x_g_chip_ident(struct v4l2_subdev *sd,
                               struct v4l2_dbg_chip_ident *id)
 {
-       struct i2c_client *client = sd->priv;
-       struct ov772x_priv *priv = to_ov772x(client);
+       struct ov772x_priv *priv = container_of(sd, struct ov772x_priv, subdev);
 
        id->ident    = priv->model;
        id->revision = 0;
@@ -728,7 +726,7 @@ static int ov772x_g_chip_ident(struct v4l2_subdev *sd,
 static int ov772x_g_register(struct v4l2_subdev *sd,
                             struct v4l2_dbg_register *reg)
 {
-       struct i2c_client *client = sd->priv;
+       struct i2c_client *client = v4l2_get_subdevdata(sd);
        int ret;
 
        reg->size = 1;
@@ -747,7 +745,7 @@ static int ov772x_g_register(struct v4l2_subdev *sd,
 static int ov772x_s_register(struct v4l2_subdev *sd,
                             struct v4l2_dbg_register *reg)
 {
-       struct i2c_client *client = sd->priv;
+       struct i2c_client *client = v4l2_get_subdevdata(sd);
 
        if (reg->reg > 0xff ||
            reg->val > 0xff)
@@ -954,8 +952,8 @@ static int ov772x_cropcap(struct v4l2_subdev *sd, struct v4l2_cropcap *a)
 static int ov772x_g_fmt(struct v4l2_subdev *sd,
                        struct v4l2_mbus_framefmt *mf)
 {
-       struct i2c_client *client = sd->priv;
-       struct ov772x_priv *priv = to_ov772x(client);
+       struct i2c_client *client = v4l2_get_subdevdata(sd);
+       struct ov772x_priv *priv = container_of(sd, struct ov772x_priv, subdev);
 
        if (!priv->win || !priv->cfmt) {
                u32 width = VGA_WIDTH, height = VGA_HEIGHT;
@@ -977,8 +975,8 @@ static int ov772x_g_fmt(struct v4l2_subdev *sd,
 static int ov772x_s_fmt(struct v4l2_subdev *sd,
                        struct v4l2_mbus_framefmt *mf)
 {
-       struct i2c_client *client = sd->priv;
-       struct ov772x_priv *priv = to_ov772x(client);
+       struct i2c_client *client = v4l2_get_subdevdata(sd);
+       struct ov772x_priv *priv = container_of(sd, struct ov772x_priv, subdev);
        int ret = ov772x_set_params(client, &mf->width, &mf->height,
                                    mf->code);
 
@@ -991,8 +989,7 @@ static int ov772x_s_fmt(struct v4l2_subdev *sd,
 static int ov772x_try_fmt(struct v4l2_subdev *sd,
                          struct v4l2_mbus_framefmt *mf)
 {
-       struct i2c_client *client = sd->priv;
-       struct ov772x_priv *priv = to_ov772x(client);
+       struct ov772x_priv *priv = container_of(sd, struct ov772x_priv, subdev);
        const struct ov772x_win_size *win;
        int i;