From patchwork Mon Apr 22 14:03:41 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sylwester Nawrocki/Kernel \\(PLT\\) /SRPOL/Staff Engineer/Samsung Electronics" X-Patchwork-Id: 2472031 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 82E1D3FCA5 for ; Mon, 22 Apr 2013 14:06:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754155Ab3DVOGO (ORCPT ); Mon, 22 Apr 2013 10:06:14 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:63059 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753660Ab3DVOGN (ORCPT ); Mon, 22 Apr 2013 10:06:13 -0400 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MLN00CYJTUCUVI0@mailout2.samsung.com> for linux-media@vger.kernel.org; Mon, 22 Apr 2013 23:06:12 +0900 (KST) X-AuditID: cbfee61a-b7f156d000002a55-13-517543d4000b Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id A4.87.10837.4D345715; Mon, 22 Apr 2013 23:06:12 +0900 (KST) Received: from amdc1344.digital.local ([106.116.147.32]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MLN004L3TQD2V50@mmp1.samsung.com>; Mon, 22 Apr 2013 23:06:11 +0900 (KST) From: Sylwester Nawrocki To: linux-media@vger.kernel.org Cc: kyungmin.park@samsung.com, sw0312.kim@samsung.com, a.hajda@samsung.com, Sylwester Nawrocki Subject: [PATCH 06/12] exynos4-is: Don't overwrite subdevdata in the fimc-is sensor driver Date: Mon, 22 Apr 2013 16:03:41 +0200 Message-id: <1366639427-14253-7-git-send-email-s.nawrocki@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1366639427-14253-1-git-send-email-s.nawrocki@samsung.com> References: <1366639427-14253-1-git-send-email-s.nawrocki@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrJJMWRmVeSWpSXmKPExsVy+t9jAd0rzqWBBq2n2S1urTvHanG26Q27 Rc+GrawWh9+0s1rMmPySzYHVo2/LKkaPz5vkApiiuGxSUnMyy1KL9O0SuDIWLJ/HXnBdrOLN +dgGxh3CXYycHBICJhKzlmxjh7DFJC7cW8/WxcjFISSwiFFi1uvdTBBOB5PEnr5ONpAqNgFD id6jfYwgtoiAvMST3htgcWaBSokNa58yg9jCAjES9x7/ZgWxWQRUJd5MgqjhFXCT2HCgAWgb B9A2BYk5k2xAwpwC7hJfltwAKxcCKtm08gb7BEbeBYwMqxhFUwuSC4qT0nMN9YoTc4tL89L1 kvNzNzGCA+SZ1A7GlQ0WhxgFOBiVeHhXmpUGCrEmlhVX5h5ilOBgVhLhvfu6JFCINyWxsiq1 KD++qDQntfgQozQHi5I474FW60AhgfTEktTs1NSC1CKYLBMHp1QD46bKZ5p3ZH9szDp1wLt/ 0vWDT0s2X/s8w2nnpKRjf99Mm+6Rrxd2Tyly7iu/Z/rMDZbs5Qmr+SP2rOU81Sc+lSHWYo3Y 6euSFq7SB6tXbitq4/pWEnZSythifrH8/5PrbgfFByy/kerN0uubqxyy6OY0/2kpOmsCbFZn 6Ekdm3RTV83v3RZPdiWW4oxEQy3mouJEAC6PozEMAgAA Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org It's an I2C client driver and it must not overwrite the struct v4l2_subdev dev_priv field, which is used by the v4l2 core to store a pointer to struct i2c_client. Signed-off-by: Sylwester Nawrocki Signed-off-by: Kyungmin Park --- drivers/media/platform/exynos4-is/fimc-is-sensor.c | 8 +------- drivers/media/platform/exynos4-is/fimc-is-sensor.h | 6 ++++++ drivers/media/platform/exynos4-is/fimc-is.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/media/platform/exynos4-is/fimc-is-sensor.c b/drivers/media/platform/exynos4-is/fimc-is-sensor.c index 035fa14..6647421 100644 --- a/drivers/media/platform/exynos4-is/fimc-is-sensor.c +++ b/drivers/media/platform/exynos4-is/fimc-is-sensor.c @@ -40,11 +40,6 @@ static const struct v4l2_mbus_framefmt fimc_is_sensor_formats[] = { } }; -static struct fimc_is_sensor *sd_to_fimc_is_sensor(struct v4l2_subdev *sd) -{ - return container_of(sd, struct fimc_is_sensor, subdev); -} - static const struct v4l2_mbus_framefmt *find_sensor_format( struct v4l2_mbus_framefmt *mf) { @@ -147,7 +142,7 @@ static const struct v4l2_subdev_internal_ops fimc_is_sensor_sd_internal_ops = { static int fimc_is_sensor_s_power(struct v4l2_subdev *sd, int on) { - struct fimc_is_sensor *sensor = v4l2_get_subdevdata(sd); + struct fimc_is_sensor *sensor = sd_to_fimc_is_sensor(sd); int gpio = sensor->gpio_reset; int ret; @@ -252,7 +247,6 @@ static int fimc_is_sensor_probe(struct i2c_client *client, if (ret < 0) return ret; - v4l2_set_subdevdata(sd, sensor); pm_runtime_no_callbacks(dev); pm_runtime_enable(dev); diff --git a/drivers/media/platform/exynos4-is/fimc-is-sensor.h b/drivers/media/platform/exynos4-is/fimc-is-sensor.h index 50b8e4d..6036d49 100644 --- a/drivers/media/platform/exynos4-is/fimc-is-sensor.h +++ b/drivers/media/platform/exynos4-is/fimc-is-sensor.h @@ -77,6 +77,12 @@ struct fimc_is_sensor { struct v4l2_mbus_framefmt format; }; +static inline +struct fimc_is_sensor *sd_to_fimc_is_sensor(struct v4l2_subdev *sd) +{ + return container_of(sd, struct fimc_is_sensor, subdev); +} + int fimc_is_register_sensor_driver(void); void fimc_is_unregister_sensor_driver(void); diff --git a/drivers/media/platform/exynos4-is/fimc-is.c b/drivers/media/platform/exynos4-is/fimc-is.c index 3c81c88..c4049d4 100644 --- a/drivers/media/platform/exynos4-is/fimc-is.c +++ b/drivers/media/platform/exynos4-is/fimc-is.c @@ -220,7 +220,7 @@ static int fimc_is_register_subdevs(struct fimc_is *is) if (WARN_ON(is->sensor)) continue; - is->sensor = v4l2_get_subdevdata(sd); + is->sensor = sd_to_fimc_is_sensor(sd); if (fimc_is_parse_sensor_config(is->sensor, child)) { dev_warn(&is->pdev->dev, "DT parse error: %s\n",