aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
authorGuennadi Liakhovetski <g.liakhovetski@gmx.de>2010-12-30 06:37:06 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-12-30 19:29:23 -0500
commitc85bb69af09988f728aca825c11267c9d06ba32e (patch)
tree37824018b8d3f8e493a06333810cfe4a7e718997 /drivers/media/video
parent63c9718c1a4595d51f5b70ed4aed6cee5aea875b (diff)
[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>
Diffstat (limited to 'drivers/media/video')
-rw-r--r--drivers/media/video/ov772x.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/drivers/media/video/ov772x.c b/drivers/media/video/ov772x.c
index a84b770352f9..48895ef863ff 100644
--- a/drivers/media/video/ov772x.c
+++ b/drivers/media/video/ov772x.c
@@ -600,7 +600,7 @@ static int ov772x_reset(struct i2c_client *client)
600static int ov772x_s_stream(struct v4l2_subdev *sd, int enable) 600static int ov772x_s_stream(struct v4l2_subdev *sd, int enable)
601{ 601{
602 struct i2c_client *client = v4l2_get_subdevdata(sd); 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 if (!enable) { 605 if (!enable) {
606 ov772x_mask_set(client, COM2, SOFT_SLEEP_MODE, SOFT_SLEEP_MODE); 606 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)
645 645
646static int ov772x_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) 646static int ov772x_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
647{ 647{
648 struct i2c_client *client = v4l2_get_subdevdata(sd); 648 struct ov772x_priv *priv = container_of(sd, struct ov772x_priv, subdev);
649 struct ov772x_priv *priv = to_ov772x(client);
650 649
651 switch (ctrl->id) { 650 switch (ctrl->id) {
652 case V4L2_CID_VFLIP: 651 case V4L2_CID_VFLIP:
@@ -665,7 +664,7 @@ static int ov772x_g_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
665static int ov772x_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl) 664static int ov772x_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
666{ 665{
667 struct i2c_client *client = v4l2_get_subdevdata(sd); 666 struct i2c_client *client = v4l2_get_subdevdata(sd);
668 struct ov772x_priv *priv = to_ov772x(client); 667 struct ov772x_priv *priv = container_of(sd, struct ov772x_priv, subdev);
669 int ret = 0; 668 int ret = 0;
670 u8 val; 669 u8 val;
671 670
@@ -715,8 +714,7 @@ static int ov772x_s_ctrl(struct v4l2_subdev *sd, struct v4l2_control *ctrl)
715static int ov772x_g_chip_ident(struct v4l2_subdev *sd, 714static int ov772x_g_chip_ident(struct v4l2_subdev *sd,
716 struct v4l2_dbg_chip_ident *id) 715 struct v4l2_dbg_chip_ident *id)
717{ 716{
718 struct i2c_client *client = v4l2_get_subdevdata(sd); 717 struct ov772x_priv *priv = container_of(sd, struct ov772x_priv, subdev);
719 struct ov772x_priv *priv = to_ov772x(client);
720 718
721 id->ident = priv->model; 719 id->ident = priv->model;
722 id->revision = 0; 720 id->revision = 0;
@@ -955,7 +953,7 @@ static int ov772x_g_fmt(struct v4l2_subdev *sd,
955 struct v4l2_mbus_framefmt *mf) 953 struct v4l2_mbus_framefmt *mf)
956{ 954{
957 struct i2c_client *client = v4l2_get_subdevdata(sd); 955 struct i2c_client *client = v4l2_get_subdevdata(sd);
958 struct ov772x_priv *priv = to_ov772x(client); 956 struct ov772x_priv *priv = container_of(sd, struct ov772x_priv, subdev);
959 957
960 if (!priv->win || !priv->cfmt) { 958 if (!priv->win || !priv->cfmt) {
961 u32 width = VGA_WIDTH, height = VGA_HEIGHT; 959 u32 width = VGA_WIDTH, height = VGA_HEIGHT;
@@ -978,7 +976,7 @@ static int ov772x_s_fmt(struct v4l2_subdev *sd,
978 struct v4l2_mbus_framefmt *mf) 976 struct v4l2_mbus_framefmt *mf)
979{ 977{
980 struct i2c_client *client = v4l2_get_subdevdata(sd); 978 struct i2c_client *client = v4l2_get_subdevdata(sd);
981 struct ov772x_priv *priv = to_ov772x(client); 979 struct ov772x_priv *priv = container_of(sd, struct ov772x_priv, subdev);
982 int ret = ov772x_set_params(client, &mf->width, &mf->height, 980 int ret = ov772x_set_params(client, &mf->width, &mf->height,
983 mf->code); 981 mf->code);
984 982
@@ -991,8 +989,7 @@ static int ov772x_s_fmt(struct v4l2_subdev *sd,
991static int ov772x_try_fmt(struct v4l2_subdev *sd, 989static int ov772x_try_fmt(struct v4l2_subdev *sd,
992 struct v4l2_mbus_framefmt *mf) 990 struct v4l2_mbus_framefmt *mf)
993{ 991{
994 struct i2c_client *client = v4l2_get_subdevdata(sd); 992 struct ov772x_priv *priv = container_of(sd, struct ov772x_priv, subdev);
995 struct ov772x_priv *priv = to_ov772x(client);
996 const struct ov772x_win_size *win; 993 const struct ov772x_win_size *win;
997 int i; 994 int i;
998 995