From patchwork Sat May 25 17:39:36 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lad, Prabhakar" X-Patchwork-Id: 2613871 Return-Path: X-Original-To: patchwork-davinci@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from bear.ext.ti.com (bear.ext.ti.com [192.94.94.41]) by patchwork2.kernel.org (Postfix) with ESMTP id 84CF1DF2A2 for ; Sat, 25 May 2013 17:43:20 +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 r4PHfnWG032324; Sat, 25 May 2013 12:41:49 -0500 Received: from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id r4PHfn50004346; Sat, 25 May 2013 12:41:49 -0500 Received: from dlelxv23.itg.ti.com (172.17.1.198) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.2.342.3; Sat, 25 May 2013 12:41:48 -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 r4PHfm73024152; Sat, 25 May 2013 12:41:48 -0500 Received: from linux.omap.com (localhost [127.0.0.1]) by linux.omap.com (Postfix) with ESMTP id 5682C8062D; Sat, 25 May 2013 12:41:48 -0500 (CDT) X-Original-To: davinci-linux-open-source@linux.davincidsp.com Delivered-To: davinci-linux-open-source@linux.davincidsp.com Received: from dflp53.itg.ti.com (dflp53.itg.ti.com [128.247.5.6]) by linux.omap.com (Postfix) with ESMTP id EE05880628 for ; Sat, 25 May 2013 12:40:42 -0500 (CDT) Received: from medina.ext.ti.com (medina.ext.ti.com [192.91.81.31]) by dflp53.itg.ti.com (8.13.8/8.13.8) with ESMTP id r4PHegqK023926 for ; Sat, 25 May 2013 12:40:42 -0500 (CDT) Received: from mail6.bemta8.messagelabs.com (mail6.bemta8.messagelabs.com [216.82.243.55]) by medina.ext.ti.com (8.13.7/8.13.7) with ESMTP id r4PHefvl001813 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sat, 25 May 2013 12:40:42 -0500 Received: from [216.82.242.147:53937] by server-14.bemta-8.messagelabs.com id 83/03-19972-997F0A15; Sat, 25 May 2013 17:40:41 +0000 X-Env-Sender: prabhakar.csengg@gmail.com X-Msg-Ref: server-11.tower-95.messagelabs.com!1369503639!23408066!1 X-Originating-IP: [209.85.192.174] X-SpamReason: No, hits=0.0 required=7.0 tests=ML_RADAR_SPEW_LINKS_14, spamassassin: X-StarScan-Received: X-StarScan-Version: 6.8.6.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 15459 invoked from network); 25 May 2013 17:40:40 -0000 Received: from mail-pd0-f174.google.com (HELO mail-pd0-f174.google.com) (209.85.192.174) by server-11.tower-95.messagelabs.com with RC4-SHA encrypted SMTP; 25 May 2013 17:40:40 -0000 Received: by mail-pd0-f174.google.com with SMTP id 3so3406950pdj.5 for ; Sat, 25 May 2013 10:40:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=fiThBf/ss7h/An5/J6iyhWHbjTI0b5u6A3njEy/46qQ=; b=SIQXr56DcHKH6QJ/ZOPH/xt42wjSaOlZ9ImbAxCF+Rsi9DKB1vQ2iboRrFnV9ASzJz R0oLsybg0hMvQyg29mkDqjug6134rsN7GYeSEv7EvWYhUg+a7KB2biuPeRry1tyAUjBD vSVgf1KXc2ku9dEZPE/Mnf2CN0c0UuMB1FM4WJnuc5QMXHYOTGrLd96llmvfDJgmpKzP vjoa3EtShJynVXy6kuBiv4JWgoryyWFwuHkXM9dtjbZcrQubOqdwkBQ2QkojvA3D88VZ DNAQS5yfv6B41CgeGadzkNwG3IrEGW4mqmKUsMNTFUzZ7pfN8tv5rejO2nc+6X2hy+Ti iuKw== X-Received: by 10.66.164.195 with SMTP id ys3mr23115683pab.30.1369503639637; Sat, 25 May 2013 10:40:39 -0700 (PDT) Received: from localhost.localdomain ([112.79.40.180]) by mx.google.com with ESMTPSA id gi2sm21262517pbb.2.2013.05.25.10.40.27 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Sat, 25 May 2013 10:40:38 -0700 (PDT) From: Prabhakar Lad To: Hans Verkuil , Mauro Carvalho Chehab , LMML , Laurent Pinchart Subject: [PATCH v2 4/4] media: i2c: ths7303: make the pdata as a constant pointer Date: Sat, 25 May 2013 23:09:36 +0530 Message-ID: <1369503576-22271-5-git-send-email-prabhakar.csengg@gmail.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1369503576-22271-1-git-send-email-prabhakar.csengg@gmail.com> References: <1369503576-22271-1-git-send-email-prabhakar.csengg@gmail.com> CC: DLOS , Mauro Carvalho Chehab , LKML , Hans Verkuil , Laurent Pinchart 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@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: 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 af06187..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);