From patchwork Sat Dec 25 23:48:51 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guennadi Liakhovetski X-Patchwork-Id: 432991 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id oBPNnJad007151 for ; Sat, 25 Dec 2010 23:49:20 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751186Ab0LYXtA (ORCPT ); Sat, 25 Dec 2010 18:49:00 -0500 Received: from moutng.kundenserver.de ([212.227.17.10]:65006 "EHLO moutng.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751107Ab0LYXs7 (ORCPT ); Sat, 25 Dec 2010 18:48:59 -0500 Received: from axis700.grange (pD9EB9458.dip0.t-ipconnect.de [217.235.148.88]) by mrelayeu.kundenserver.de (node=mrbap0) with ESMTP (Nemesis) id 0MIyEr-1PZ7ta3voX-002Wo6; Sun, 26 Dec 2010 00:48:52 +0100 Received: by axis700.grange (Postfix, from userid 1000) id 89DECE6A7C; Sun, 26 Dec 2010 00:48:51 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by axis700.grange (Postfix) with ESMTP id 7B6001067DC; Sun, 26 Dec 2010 00:48:51 +0100 (CET) Date: Sun, 26 Dec 2010 00:48:51 +0100 (CET) From: Guennadi Liakhovetski X-X-Sender: lyakh@axis700.grange To: Linux Media Mailing List cc: Kuninori Morimoto Subject: [PATCH v2] v4l: ov772x: simplify pointer dereference In-Reply-To: Message-ID: References: MIME-Version: 1.0 X-Provags-ID: V02:K0:w4JDxGk97xWyORii1c8RqMH6j/LyE60us2MpN70Q+YU D6LR0rjvOtllO64NZvRC+RLZfBrkNyVpzoFXpCq/CXVLSqj6mu wWH1ZfWW2oF7ljHRFJBU2Fv+hHNh6qME+iiOjsPYw9A2W1NAX5 DyUL0umIdsdL0+PF19KEvw+o7g9Mp0d0QDdId3Kcx58Wo47Jrb bB40LWgeL/uQqcsq71B9RmJfu6F68dn02vAyuHr04w= Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Sat, 25 Dec 2010 23:49:20 +0000 (UTC) diff --git a/drivers/media/video/ov772x.c b/drivers/media/video/ov772x.c index a84b770..48895ef 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) static int ov772x_s_stream(struct v4l2_subdev *sd, int enable) { struct i2c_client *client = v4l2_get_subdevdata(sd); - struct ov772x_priv *priv = to_ov772x(client); + 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 = v4l2_get_subdevdata(sd); - 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: @@ -665,7 +664,7 @@ 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 = v4l2_get_subdevdata(sd); - struct ov772x_priv *priv = to_ov772x(client); + 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 = v4l2_get_subdevdata(sd); - 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; @@ -955,7 +953,7 @@ static int ov772x_g_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) { struct i2c_client *client = v4l2_get_subdevdata(sd); - struct ov772x_priv *priv = to_ov772x(client); + struct ov772x_priv *priv = container_of(sd, struct ov772x_priv, subdev); if (!priv->win || !priv->cfmt) { u32 width = VGA_WIDTH, height = VGA_HEIGHT; @@ -978,7 +976,7 @@ static int ov772x_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) { struct i2c_client *client = v4l2_get_subdevdata(sd); - struct ov772x_priv *priv = to_ov772x(client); + 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 = v4l2_get_subdevdata(sd); - 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;