Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[media] v4l: ov772x: simplify pointer dereference

Use a more direct way to obtain a pointer to struct ov772x_priv, where the
subdevice is available.

Signed-off-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

authored by

Guennadi Liakhovetski and committed by
Mauro Carvalho Chehab
c85bb69a 63c9718c

+7 -10
+7 -10
drivers/media/video/ov772x.c
··· 600 600 static int ov772x_s_stream(struct v4l2_subdev *sd, int enable) 601 601 { 602 602 struct i2c_client *client = v4l2_get_subdevdata(sd); 603 - struct ov772x_priv *priv = to_ov772x(client); 603 + struct ov772x_priv *priv = container_of(sd, struct ov772x_priv, subdev); 604 604 605 605 if (!enable) { 606 606 ov772x_mask_set(client, COM2, SOFT_SLEEP_MODE, SOFT_SLEEP_MODE); ··· 645 645 646 646 static int ov772x_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) 647 647 { 648 - struct i2c_client *client = v4l2_get_subdevdata(sd); 649 - struct ov772x_priv *priv = to_ov772x(client); 648 + struct ov772x_priv *priv = container_of(sd, struct ov772x_priv, subdev); 650 649 651 650 switch (ctrl->id) { 652 651 case V4L2_CID_VFLIP: ··· 664 665 static int ov772x_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) 665 666 { 666 667 struct i2c_client *client = v4l2_get_subdevdata(sd); 667 - struct ov772x_priv *priv = to_ov772x(client); 668 + struct ov772x_priv *priv = container_of(sd, struct ov772x_priv, subdev); 668 669 int ret = 0; 669 670 u8 val; 670 671 ··· 714 715 static int ov772x_g_chip_ident(struct v4l2_subdev *sd, 715 716 struct v4l2_dbg_chip_ident *id) 716 717 { 717 - struct i2c_client *client = v4l2_get_subdevdata(sd); 718 - struct ov772x_priv *priv = to_ov772x(client); 718 + struct ov772x_priv *priv = container_of(sd, struct ov772x_priv, subdev); 719 719 720 720 id->ident = priv->model; 721 721 id->revision = 0; ··· 953 955 struct v4l2_mbus_framefmt *mf) 954 956 { 955 957 struct i2c_client *client = v4l2_get_subdevdata(sd); 956 - struct ov772x_priv *priv = to_ov772x(client); 958 + struct ov772x_priv *priv = container_of(sd, struct ov772x_priv, subdev); 957 959 958 960 if (!priv->win || !priv->cfmt) { 959 961 u32 width = VGA_WIDTH, height = VGA_HEIGHT; ··· 976 978 struct v4l2_mbus_framefmt *mf) 977 979 { 978 980 struct i2c_client *client = v4l2_get_subdevdata(sd); 979 - struct ov772x_priv *priv = to_ov772x(client); 981 + struct ov772x_priv *priv = container_of(sd, struct ov772x_priv, subdev); 980 982 int ret = ov772x_set_params(client, &mf->width, &mf->height, 981 983 mf->code); 982 984 ··· 989 991 static int ov772x_try_fmt(struct v4l2_subdev *sd, 990 992 struct v4l2_mbus_framefmt *mf) 991 993 { 992 - struct i2c_client *client = v4l2_get_subdevdata(sd); 993 - struct ov772x_priv *priv = to_ov772x(client); 994 + struct ov772x_priv *priv = container_of(sd, struct ov772x_priv, subdev); 994 995 const struct ov772x_win_size *win; 995 996 int i; 996 997