From patchwork Wed Dec 8 12:13:58 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Cohen X-Patchwork-Id: 390572 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 oB8CEH9H019185 for ; Wed, 8 Dec 2010 12:14:17 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754815Ab0LHMOP (ORCPT ); Wed, 8 Dec 2010 07:14:15 -0500 Received: from mail-ew0-f45.google.com ([209.85.215.45]:41072 "EHLO mail-ew0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754812Ab0LHMOP (ORCPT ); Wed, 8 Dec 2010 07:14:15 -0500 Received: by ewy10 with SMTP id 10so755477ewy.4 for ; Wed, 08 Dec 2010 04:14:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references; bh=/5ytLb5F396n90mq7za5axQCOSQR76o4sjxWMlvIw30=; b=FyZlOvsGsX18rd7okfYQGUaEHccOFyk05ZDGRZol2jIg4JiLQuXxNBUvnKJPZnDvxe ZF2oDJPSOy3hf0KI8HwqsywsPdcJ240+3Ry1EKxwZNyJnRY+bs9Y6vdqO8oxBnqkJ1Yx Pr1aApwJ/sIkFrmkMtZo4kpx9kXePmqwyGRQI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=IQr9vQaQ7tnXWu2tp3eEk8uQr30WovGHVkGzPJy4a74XDGyrX4p3aRiVzMYHgknOPy MXUdvdtmEntBfBO13RilxLQN8NRXU/Yx4IOnm8QXGNf3IBJVCuOFQ7zWfAA9nsVNHTIb wLMqFhxABU+z89cGN+5hbutLL17mJ7nbRuPZE= Received: by 10.213.19.200 with SMTP id c8mr1091087ebb.39.1291810453534; Wed, 08 Dec 2010 04:14:13 -0800 (PST) Received: from localhost.localdomain (a91-152-85-108.elisa-laajakaista.fi [91.152.85.108]) by mx.google.com with ESMTPS id b52sm376776eei.13.2010.12.08.04.14.11 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 08 Dec 2010 04:14:11 -0800 (PST) From: David Cohen To: mchehab@redhat.com Cc: linux-media@vger.kernel.org, marek.vasut@gmail.com, g.liakhovetski@gmx.de, David Cohen Subject: [PATCH v3 1/2] ov9640: use macro to request OmniVision OV9640 sensor private data Date: Wed, 8 Dec 2010 14:13:58 +0200 Message-Id: <1291810439-7026-2-git-send-email-dacohen@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1291810439-7026-1-git-send-email-dacohen@gmail.com> References: <1291810439-7026-1-git-send-email-dacohen@gmail.com> 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]); Wed, 08 Dec 2010 12:14:17 +0000 (UTC) diff --git a/drivers/media/video/ov9640.c b/drivers/media/video/ov9640.c index 99e9e1d..c6d8e8a 100644 --- a/drivers/media/video/ov9640.c +++ b/drivers/media/video/ov9640.c @@ -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;