From patchwork Tue Dec 13 17:31:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhumika Goyal X-Patchwork-Id: 9472821 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 533516021C for ; Tue, 13 Dec 2016 17:32:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2DFEB28495 for ; Tue, 13 Dec 2016 17:32:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2199F2860F; Tue, 13 Dec 2016 17:32:24 +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 1106B28495 for ; Tue, 13 Dec 2016 17:32:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933567AbcLMRcS (ORCPT ); Tue, 13 Dec 2016 12:32:18 -0500 Received: from mail-pf0-f194.google.com ([209.85.192.194]:33996 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933460AbcLMRcC (ORCPT ); Tue, 13 Dec 2016 12:32:02 -0500 Received: by mail-pf0-f194.google.com with SMTP id y68so6324424pfb.1; Tue, 13 Dec 2016 09:32:01 -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=PPliraZpRoAk20NkaqU5qf4GJ3CwcLpohCJmV6OOm88=; b=m3kf1JDeZMWjWSs4MLEvoLAwo2IkDR2Mwa1sM6WfYGCjyrkX6rdrc9NH28Eqsie2sS eBP1bwjp627HJh9xVMVh10XUTEx/oIRIOEcytFclCj1rVHOEuTAMB9n/pqc/sCEpS+mV cO6GuetK6H85YzlS22JUXydHwlFUi3Zik74JvfWOjkb/STZMh+Y723NeYOSYHKq/xKBF h/qf89oiBQ2emVtBXFpKMmVH/KTuy+DY3wmOdfsGPOYPqUWXP4XUr1Pc6WzxFEEMW67O XIFqEln1DWAdQKaci9pDdCEri0aMPRPEH7W8NmXojQ1Y2TdoI82LjNKM5U7gyFa4uDwx YkNw== 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=PPliraZpRoAk20NkaqU5qf4GJ3CwcLpohCJmV6OOm88=; b=VyY0tDGTD6BWx/LGNDda+4ZJmMw6E2wRTe6tz1yQGCcn2E5nerROyliHgw++LKxn9L r90R+rQ8XVGaiSryhdm+ofW87XGQBxpgDS4wtVO81kxugk7LR4sL7gWL5sYP8yUJSCX5 nVV3yfvdfYVcSphdQ+cB5n1gaBYe7IMN4HDhCjE9/XbwLjHsRukI5Njy/Y2YX2DWIbVq 136cYg2InyQyPnn8sm0OFPWjbDZNQ5j2X4G04hB0G6uedl52pODOpOoZ32DQ3DpWr54e maMErjMh+FW1/SLgvwlVaioTnQ9g6fOix32uB57p2AVIF2eG8Xl8pBe4R3qkQlywEkAH hofw== X-Gm-Message-State: AKaTC02uI4AOdjDtcKTzQVQUVKsJFrUyyQWiEKwYQF5Y846tniCe7eaB0Tb04GG92tAK1Q== X-Received: by 10.98.7.151 with SMTP id 23mr102742844pfh.5.1481650321182; Tue, 13 Dec 2016 09:32:01 -0800 (PST) Received: from gmail.com ([106.215.131.233]) by smtp.gmail.com with ESMTPSA id z28sm81894237pgc.40.2016.12.13.09.31.52 (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 13 Dec 2016 09:32:00 -0800 (PST) Received: by gmail.com (sSMTP sendmail emulation); Tue, 13 Dec 2016 23:01:46 +0530 From: Bhumika Goyal To: julia.lawall@lip6.fr, mchehab@kernel.org, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Bhumika Goyal Subject: [PATCH] drivers: media: i2c: ml86v7667: constify v4l2_subdev_* structures Date: Tue, 13 Dec 2016 23:01:45 +0530 Message-Id: <1481650305-12428-1-git-send-email-bhumirks@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP v4l2_subdev_{core/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; @@ v4l2_i2c_subdev_init(...,&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 2732 608 8 3348 d14 drivers/media/i2c/ml86v7667.o File size after: text data bss dec hex filename 3100 232 8 3340 d0c drivers/media/i2c/ml86v7667.o Signed-off-by: Bhumika Goyal --- drivers/media/i2c/ml86v7667.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/i2c/ml86v7667.c b/drivers/media/i2c/ml86v7667.c index 38a20fe..57ef901 100644 --- a/drivers/media/i2c/ml86v7667.c +++ b/drivers/media/i2c/ml86v7667.c @@ -290,7 +290,7 @@ static int ml86v7667_s_register(struct v4l2_subdev *sd, .s_ctrl = ml86v7667_s_ctrl, }; -static struct v4l2_subdev_video_ops ml86v7667_subdev_video_ops = { +static const struct v4l2_subdev_video_ops ml86v7667_subdev_video_ops = { .g_std = ml86v7667_g_std, .s_std = ml86v7667_s_std, .querystd = ml86v7667_querystd, @@ -304,14 +304,14 @@ static int ml86v7667_s_register(struct v4l2_subdev *sd, .set_fmt = ml86v7667_fill_fmt, }; -static struct v4l2_subdev_core_ops ml86v7667_subdev_core_ops = { +static const struct v4l2_subdev_core_ops ml86v7667_subdev_core_ops = { #ifdef CONFIG_VIDEO_ADV_DEBUG .g_register = ml86v7667_g_register, .s_register = ml86v7667_s_register, #endif }; -static struct v4l2_subdev_ops ml86v7667_subdev_ops = { +static const struct v4l2_subdev_ops ml86v7667_subdev_ops = { .core = &ml86v7667_subdev_core_ops, .video = &ml86v7667_subdev_video_ops, .pad = &ml86v7667_subdev_pad_ops,