From patchwork Wed May 15 11:57:20 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Prabhakar X-Patchwork-Id: 2572051 Return-Path: X-Original-To: patchwork-davinci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from bear.ext.ti.com (bear.ext.ti.com [192.94.94.41]) by patchwork1.kernel.org (Postfix) with ESMTP id 632703FE80 for ; Wed, 15 May 2013 12:02:12 +0000 (UTC) Received: from dflxv15.itg.ti.com ([128.247.5.124]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id r4FC2B9X012732 for ; Wed, 15 May 2013 07:02:11 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id r4FC2BAx006671 for ; Wed, 15 May 2013 07:02:11 -0500 Received: from dlelxv23.itg.ti.com (172.17.1.198) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.2.342.3; Wed, 15 May 2013 07:02:11 -0500 Received: from linux.omap.com (dlelxs01.itg.ti.com [157.170.227.31]) by dlelxv23.itg.ti.com (8.13.8/8.13.8) with ESMTP id r4FC2B72019448 for ; Wed, 15 May 2013 07:02:11 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id EEFDC8062A for ; Wed, 15 May 2013 07:02:10 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp52.itg.ti.com (dflp52.itg.ti.com [128.247.22.96]) by linux.omap.com (Postfix) with ESMTP id 3291E80626 for ; Wed, 15 May 2013 07:01:57 -0500 (CDT) Received: from medina.ext.ti.com (medina.ext.ti.com [192.91.81.31]) by dflp52.itg.ti.com (8.13.7/8.13.8) with ESMTP id r4FC1vva010284 for ; Wed, 15 May 2013 07:01:57 -0500 (CDT) Received: from mail6.bemta12.messagelabs.com (mail6.bemta12.messagelabs.com [216.82.250.247]) by medina.ext.ti.com (8.13.7/8.13.7) with ESMTP id r4FC1uTr012841 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 15 May 2013 07:01:56 -0500 Received: from [216.82.250.51:10829] by server-12.bemta-12.messagelabs.com id EC/8E-24760-43973915; Wed, 15 May 2013 12:01:56 +0000 X-Env-Sender: prabhakar.csengg@gmail.com X-Msg-Ref: server-5.tower-108.messagelabs.com!1368619314!3263194!1 X-Originating-IP: [209.85.220.41] X-SpamReason: No, hits=0.0 required=7.0 tests=ML_RADAR_SPEW_LINKS_14, spamassassin: X-StarScan-Received: X-StarScan-Version: 6.9.6; banners=-,-,- X-VirusChecked: Checked Received: (qmail 22826 invoked from network); 15 May 2013 12:01:55 -0000 Received: from mail-pa0-f41.google.com (HELO mail-pa0-f41.google.com) (209.85.220.41) by server-5.tower-108.messagelabs.com with RC4-SHA encrypted SMTP; 15 May 2013 12:01:55 -0000 Received: by mail-pa0-f41.google.com with SMTP id rl6so1455846pac.28 for ; Wed, 15 May 2013 05:01:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=jvAKLSxNBjc523JWhb4WajVVOrpWG6lR9itTDIT0Lzo=; b=mrOzuXcDN0TDcG7T3Wncj+Bju2ItVo2bTfSs+prTGm0aGP47gMR9Zd0bsXx09wlB5s SLYRWbU4p18w3hxqIjWYcoVbPp/DbKnrMP+uY4d4/iPM3BzBQ4zGH+ZnYqK9SraZw7zh bQ7U5PPYvyN7E18AajZDKpwNwvzBBr6vyomDRYtftzCu330b90WFudM+5T7/xZQwpr+J LAiy0D68XDP99eZArWh/a9+O884XXZ7WpxNkg/+gOmcKRHIDkMj1ABFtqRTQWVnrUBHE bidTGENdvp1kR7SXzAhRhCjCactQpuDR6a4o88jh5UaQt02SIRB2GaaEEGvb85YO4UhE 8Qbg== X-Received: by 10.66.9.99 with SMTP id y3mr39115748paa.189.1368619314481; Wed, 15 May 2013 05:01:54 -0700 (PDT) Received: from localhost.localdomain ([59.98.240.128]) by mx.google.com with ESMTPSA id az5sm2610731pbc.18.2013.05.15.05.01.48 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 15 May 2013 05:01:53 -0700 (PDT) From: Lad Prabhakar To: LMML Subject: [PATCH 4/6] media: i2c: ths7303: make the pdata as a constant pointer Date: Wed, 15 May 2013 17:27:20 +0530 Message-ID: <1368619042-28252-5-git-send-email-prabhakar.csengg@gmail.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1368619042-28252-1-git-send-email-prabhakar.csengg@gmail.com> References: <1368619042-28252-1-git-send-email-prabhakar.csengg@gmail.com> CC: DLOS , Mauro Carvalho Chehab , LKML , Hans Verkuil , Laurent Pinchart , Sylwester Nawrocki , Sakari Ailus , Guennadi Liakhovetski X-BeenThere: davinci-linux-open-source@linux.davincidsp.com X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: Errors-To: davinci-linux-open-source-bounces+patchwork-davinci=patchwork.kernel.org@linux.davincidsp.com From: Lad, Prabhakar generally the pdata needs to be a constant pointer in the device state structure. This patch makes the pdata as a constant pointer and alongside returns -EINVAL when pdata is NULL. Signed-off-by: Lad, Prabhakar Cc: Hans Verkuil Cc: Laurent Pinchart Cc: Mauro Carvalho Chehab Cc: Guennadi Liakhovetski Cc: Sylwester Nawrocki Cc: Sakari Ailus Cc: linux-kernel@vger.kernel.org Cc: davinci-linux-open-source@linux.davincidsp.com --- drivers/media/i2c/ths7303.c | 15 ++++++++------- 1 files changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/media/i2c/ths7303.c b/drivers/media/i2c/ths7303.c index af06187c..b954195 100644 --- a/drivers/media/i2c/ths7303.c +++ b/drivers/media/i2c/ths7303.c @@ -35,7 +35,7 @@ struct ths7303_state { struct v4l2_subdev sd; - struct ths7303_platform_data pdata; + const struct ths7303_platform_data *pdata; struct v4l2_bt_timings bt; int std_id; int stream_on; @@ -89,7 +89,7 @@ int ths7303_setval(struct v4l2_subdev *sd, enum ths7303_filter_mode mode) { struct i2c_client *client = v4l2_get_subdevdata(sd); struct ths7303_state *state = to_state(sd); - struct ths7303_platform_data *pdata = &state->pdata; + const struct ths7303_platform_data *pdata = state->pdata; u8 val, sel = 0; int err, disable = 0; @@ -356,6 +356,11 @@ static int ths7303_probe(struct i2c_client *client, struct ths7303_state *state; struct v4l2_subdev *sd; + if (pdata == NULL) { + dev_err(&client->dev, "No platform data\n"); + return -EINVAL; + } + if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return -ENODEV; @@ -367,11 +372,7 @@ static int ths7303_probe(struct i2c_client *client, if (!state) return -ENOMEM; - if (!pdata) - v4l_warn(client, "No platform data, using default data!\n"); - else - state->pdata = *pdata; - + state->pdata = pdata; sd = &state->sd; v4l2_i2c_subdev_init(sd, client, &ths7303_ops);