From patchwork Fri Dec 3 21:48:17 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Cohen X-Patchwork-Id: 379161 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 oB3LmWVk012232 for ; Fri, 3 Dec 2010 21:48:33 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752178Ab0LCVsc (ORCPT ); Fri, 3 Dec 2010 16:48:32 -0500 Received: from mail-bw0-f46.google.com ([209.85.214.46]:41507 "EHLO mail-bw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751876Ab0LCVsb (ORCPT ); Fri, 3 Dec 2010 16:48:31 -0500 Received: by mail-bw0-f46.google.com with SMTP id 15so8780568bwz.19 for ; Fri, 03 Dec 2010 13:48:30 -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=VRJPn5DxjVm9h3vMq16ofHn900xOt2rzSFPuBh/shzW0ApmP7LUNhr34xNXaOhcfyD 37eUZmy985x7j2o3zlg666Ii72+o8MP79TOz7RSJHtZdNpXuXPLrbq2yHUFts2lKria/ DlpA+DG4LO74GmmXDNmDgFdcZalwdK27Yv5yc= 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=VXZNxOZc03Mf7hegSz+F7YaCz9gELcLtf4JvQIwqYRN78b4Yc8NVLnUWKNGVQLixU/ bJR4k0Je4NB5VZkL9RRTmXeEXaKxAO6EM7TZZW8Unatney/4G4qCfjCqLSNBisUId4v1 Fuf9fRwJRYD3AVTST3YMITKnPMz2VJpFcqyxM= Received: by 10.204.79.131 with SMTP id p3mr3124489bkk.178.1291412910724; Fri, 03 Dec 2010 13:48:30 -0800 (PST) Received: from localhost.localdomain (a91-152-85-108.elisa-laajakaista.fi [91.152.85.108]) by mx.google.com with ESMTPS id d11sm445345bkd.22.2010.12.03.13.48.29 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 03 Dec 2010 13:48:29 -0800 (PST) From: David Cohen To: mchehab@redhat.com Cc: linux-media@vger.kernel.org, marek.vasut@gmail.com, David Cohen Subject: [PATCH 1/2] ov9640: use macro to request OmniVision OV9640 sensor private data Date: Fri, 3 Dec 2010 23:48:17 +0200 Message-Id: <1291412898-9939-2-git-send-email-dacohen@gmail.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1291412898-9939-1-git-send-email-dacohen@gmail.com> References: <1291412898-9939-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]); Fri, 03 Dec 2010 21:48:33 +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;