From patchwork Mon Dec 12 18:03:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhumika Goyal X-Patchwork-Id: 9470989 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C1A8B60573 for ; Mon, 12 Dec 2016 18:04:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9A1DD28504 for ; Mon, 12 Dec 2016 18:04:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8C93C28507; Mon, 12 Dec 2016 18:04:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 706EB28504 for ; Mon, 12 Dec 2016 18:04:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752228AbcLLSEo (ORCPT ); Mon, 12 Dec 2016 13:04:44 -0500 Received: from mail-pg0-f66.google.com ([74.125.83.66]:36462 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751499AbcLLSEn (ORCPT ); Mon, 12 Dec 2016 13:04:43 -0500 Received: by mail-pg0-f66.google.com with SMTP id x23so1672546pgx.3; Mon, 12 Dec 2016 10:04:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=FijPiAVBwmNcQLSQQqAdpGwN3EAg2RX2FaoBoqoPN7Q=; b=IhVuhSnm3Lzwuwv+A1QGq7fDSW0jRGtNf5O/nztiHy8iaduplqNrS2NL2WKbi46qJx HCcYavXIbEID855xXf5w5pHi5pZboDn8aSYEPFCZ4tGpnNDozWn0M3AsM/EMKWo6Kp9h Fi77HVdIYEzrGQ2TdG1HDL1HLtHRO4Q3n7ibnJu4HX2b2JEI5weVn/bXU0JhgkHPOw2S y1CdRugabVtJYwpw03hjYB2dYT3XKw3DWtPhHO0sawvzItDuhrsCWWB/tdYTwzqGGsqt Zxp/MK4lUWk7iUfy/2Pi6OCfF4Gqzfu8/Llky2KidfyDx45uodK/xTJja+fdV87SX9z3 wjYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=FijPiAVBwmNcQLSQQqAdpGwN3EAg2RX2FaoBoqoPN7Q=; b=eTMBjOSa2w8JRIvYcjGDjxK1Ta1xRjk66iGx8Oe3hXmZ6eXKc1Z/WomLtUCYKZ2BHq UnP34eTzmTALEaJn1zYh6StLs7cqDU1HXibSPp1zcj+83DDWgeQAA2Y2noj7f9J94K6a w9TC1TsEfhnmkO9/1sopMphRKc0xoCRIO1SUH0Lp3lSVRG/G7wpUTfHzVMEsdhM4A3/n Lw05zBMm8W2nltUUffwrrTdsZFbKZ2qEo94ZVLiUZsgkoxm67aMgP/1U9674Bog9c2/W rHnOWV9Cn+WtT2Q3dpgM3ZPN2EWL4/RKtL2NxGMTq2kpyAVxfYgQK3u+vxqQNmdPe0OJ eU6A== X-Gm-Message-State: AKaTC00yS/KDZD7z2Es9NP0IRHwpgZUi0oopzbl8OwD2Fq0DA25BMxw0IGsOHfIhOPjySA== X-Received: by 10.84.216.28 with SMTP id m28mr33443156pli.107.1481565882495; Mon, 12 Dec 2016 10:04:42 -0800 (PST) Received: from gmail.com ([223.176.172.236]) by smtp.gmail.com with ESMTPSA id r21sm77100109pfd.44.2016.12.12.10.04.16 (version=TLS1 cipher=AES128-SHA bits=128/128); Mon, 12 Dec 2016 10:04:41 -0800 (PST) Received: by gmail.com (sSMTP sendmail emulation); Mon, 12 Dec 2016 23:33:59 +0530 From: Bhumika Goyal To: julia.lawall@lip6.fr, kyungmin.park@samsung.com, s.nawrocki@samsung.com, mchehab@kernel.org, kgene@kernel.org, krzk@kernel.org, javier@osg.samsung.com, linux-media@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Bhumika Goyal Subject: [PATCH] media: platform: exynos4-is: constify v4l2_subdev_* structures Date: Mon, 12 Dec 2016 23:33:57 +0530 Message-Id: <1481565837-20467-1-git-send-email-bhumirks@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP v4l2_subdev_{core/pad/video}_ops structures are stored in the fields of the v4l2_subdev_ops structure which are of type const. Also, v4l2_subdev_ops structure is passed to a function having its argument of type const. As these structures are never modified, so declare them as const. Done using Coccinelle:(one of the scripts used) @r1 disable optional_qualifier @ identifier i; position p; @@ static struct v4l2_subdev_ops i@p = {...}; @ok1@ identifier r1.i; position p; expression e1; @@ v4l2_subdev_init(e1,&i@p) @bad@ position p!={r1.p,ok1.p}; identifier r1.i; @@ i@p @depends on !bad disable optional_qualifier@ identifier r1.i; @@ +const struct v4l2_subdev_ops i; File size before: text data bss dec hex filename 16830 1064 0 17894 45e6 platform/exynos4-is/fimc-capture.o 7787 704 20 8511 213f platform/exynos4-is/mipi-csis.o File size after: text data bss dec hex filename 17022 880 0 17902 45ee platform/exynos4-is/fimc-capture.o 8299 192 20 8511 213f platform/exynos4-is/mipi-csis.o Signed-off-by: Bhumika Goyal --- drivers/media/platform/exynos4-is/fimc-capture.c | 4 ++-- drivers/media/platform/exynos4-is/mipi-csis.c | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/media/platform/exynos4-is/fimc-capture.c b/drivers/media/platform/exynos4-is/fimc-capture.c index 964f4a6..a5e729c 100644 --- a/drivers/media/platform/exynos4-is/fimc-capture.c +++ b/drivers/media/platform/exynos4-is/fimc-capture.c @@ -1695,7 +1695,7 @@ static int fimc_subdev_set_selection(struct v4l2_subdev *sd, return 0; } -static struct v4l2_subdev_pad_ops fimc_subdev_pad_ops = { +static const struct v4l2_subdev_pad_ops fimc_subdev_pad_ops = { .enum_mbus_code = fimc_subdev_enum_mbus_code, .get_selection = fimc_subdev_get_selection, .set_selection = fimc_subdev_set_selection, @@ -1703,7 +1703,7 @@ static int fimc_subdev_set_selection(struct v4l2_subdev *sd, .set_fmt = fimc_subdev_set_fmt, }; -static struct v4l2_subdev_ops fimc_subdev_ops = { +static const struct v4l2_subdev_ops fimc_subdev_ops = { .pad = &fimc_subdev_pad_ops, }; diff --git a/drivers/media/platform/exynos4-is/mipi-csis.c b/drivers/media/platform/exynos4-is/mipi-csis.c index befd9fc..f819b29 100644 --- a/drivers/media/platform/exynos4-is/mipi-csis.c +++ b/drivers/media/platform/exynos4-is/mipi-csis.c @@ -649,23 +649,23 @@ static int s5pcsis_log_status(struct v4l2_subdev *sd) return 0; } -static struct v4l2_subdev_core_ops s5pcsis_core_ops = { +static const struct v4l2_subdev_core_ops s5pcsis_core_ops = { .s_power = s5pcsis_s_power, .log_status = s5pcsis_log_status, }; -static struct v4l2_subdev_pad_ops s5pcsis_pad_ops = { +static const struct v4l2_subdev_pad_ops s5pcsis_pad_ops = { .enum_mbus_code = s5pcsis_enum_mbus_code, .get_fmt = s5pcsis_get_fmt, .set_fmt = s5pcsis_set_fmt, }; -static struct v4l2_subdev_video_ops s5pcsis_video_ops = { +static const struct v4l2_subdev_video_ops s5pcsis_video_ops = { .s_rx_buffer = s5pcsis_s_rx_buffer, .s_stream = s5pcsis_s_stream, }; -static struct v4l2_subdev_ops s5pcsis_subdev_ops = { +static const struct v4l2_subdev_ops s5pcsis_subdev_ops = { .core = &s5pcsis_core_ops, .pad = &s5pcsis_pad_ops, .video = &s5pcsis_video_ops,