From patchwork Tue Jul 12 15:39:04 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Grzeschik X-Patchwork-Id: 968702 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p6CFdH60016215 for ; Tue, 12 Jul 2011 15:39:17 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753828Ab1GLPjJ (ORCPT ); Tue, 12 Jul 2011 11:39:09 -0400 Received: from metis.ext.pengutronix.de ([92.198.50.35]:39116 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753823Ab1GLPjI (ORCPT ); Tue, 12 Jul 2011 11:39:08 -0400 Received: from octopus.hi.pengutronix.de ([2001:6f8:1178:2:215:17ff:fe12:23b0]) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1Qgf3C-0006W4-M3; Tue, 12 Jul 2011 17:39:06 +0200 Received: from mgr by octopus.hi.pengutronix.de with local (Exim 4.76) (envelope-from ) id 1Qgf3C-0005PI-Ho; Tue, 12 Jul 2011 17:39:06 +0200 From: Michael Grzeschik To: linux-media@vger.kernel.org Cc: g.liakhovetski@gmx.de, Michael Grzeschik Subject: [PATCH 3/5] mt9m111: move lastpage to struct mt9m111 for multi instances Date: Tue, 12 Jul 2011 17:39:04 +0200 Message-Id: <1310485146-27759-3-git-send-email-m.grzeschik@pengutronix.de> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1310485146-27759-1-git-send-email-m.grzeschik@pengutronix.de> References: <1310485146-27759-1-git-send-email-m.grzeschik@pengutronix.de> X-SA-Exim-Connect-IP: 2001:6f8:1178:2:215:17ff:fe12:23b0 X-SA-Exim-Mail-From: mgr@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-media@vger.kernel.org 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.6 (demeter2.kernel.org [140.211.167.43]); Tue, 12 Jul 2011 15:39:17 +0000 (UTC) Signed-off-by: Michael Grzeschik --- drivers/media/video/mt9m111.c | 7 ++++--- 1 files changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/media/video/mt9m111.c b/drivers/media/video/mt9m111.c index e08b46c..8ad99a9 100644 --- a/drivers/media/video/mt9m111.c +++ b/drivers/media/video/mt9m111.c @@ -170,6 +170,7 @@ struct mt9m111 { enum mt9m111_context context; struct v4l2_rect rect; const struct mt9m111_datafmt *fmt; + int lastpage; unsigned int gain; unsigned char autoexposure; unsigned char datawidth; @@ -192,17 +193,17 @@ static int reg_page_map_set(struct i2c_client *client, const u16 reg) { int ret = 0; u16 page; - static int lastpage = -1; /* PageMap cache value */ + struct mt9m111 *mt9m111 = to_mt9m111(client); page = (reg >> 8); - if (page == lastpage) + if (page == mt9m111->lastpage) return 0; if (page > 2) return -EINVAL; ret = i2c_smbus_write_word_data(client, MT9M111_PAGE_MAP, swab16(page)); if (!ret) - lastpage = page; + mt9m111->lastpage = page; return ret; }