From patchwork Tue Dec 13 17:26:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhumika Goyal X-Patchwork-Id: 9472807 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 E7FF46021C for ; Tue, 13 Dec 2016 17:26:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D685D28639 for ; Tue, 13 Dec 2016 17:26:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CA82A2863B; Tue, 13 Dec 2016 17:26:47 +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 702D92860F for ; Tue, 13 Dec 2016 17:26:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936239AbcLMR0e (ORCPT ); Tue, 13 Dec 2016 12:26:34 -0500 Received: from mail-pg0-f67.google.com ([74.125.83.67]:36103 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935046AbcLMR0b (ORCPT ); Tue, 13 Dec 2016 12:26:31 -0500 Received: by mail-pg0-f67.google.com with SMTP id x23so5096355pgx.3; Tue, 13 Dec 2016 09:26:30 -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=GyNLN0tn4qwnFPJhrPrtZVm3GMlXMcYM3DWQBRfw5Oc=; b=ixCMHUpJbGf+URB9kQp1ts1x2rFDniYymsuQZVtYgdJEY/jLjHKYociHcQXX/MYgmL wgPGpmMHq66uztZE+/l32BrzkS8GTgPvQXy9LbwA5WKss18aNka98/8iCbJ1BgHDlQW2 U3T4Lv6YHTOjBE+J5/5gMP8ySnGG8/8fYfRmOjpv3i8QEYcbD9shOwVwJZdlDJWEtihP TZGJpr7z7zjq8jj9Xs0UbDDE9rSE3bJwxwRmVgKU1PnxUFlQBwIqCbLGC+JYKy7LgYec fm4Oj29E0vRK6cuUqkhQAiK3maBA24UOtTqGDLmjqq6FmZq/Di50f/2f1FtXhDlGWmS1 SAng== 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=GyNLN0tn4qwnFPJhrPrtZVm3GMlXMcYM3DWQBRfw5Oc=; b=Uffyhs9qLMDByHRGULD/TWuTt6PH3QgAKONvqb7Xjo4qhSSnaAOPoz48eK+k+v/00s 6s+Cx+B7LQbgwIhHgQD/ROFPwHGziDtnXcYjh86LNl+9PmUNpPB1axFIAfLKmuV7afuS mt7bdsRm94uinaqUtNltIaXj2aQk0ANO7WnNEBcCzEXnQzMAfzqG0hCmpPkadZNP4Hpi mWREPK/IdpRgDkN+Co7fbKKjIb64PTN1Id+YEEz7ui+D+eCSzRD+wx8sXujQ/rqA5YrC q4oD9JwDn89EqH1huurt9EWxSw5RUwSslbbueVKJbGtBE698IghKRnc1F+mZcizEEA/L wa5A== X-Gm-Message-State: AKaTC02NT7rfl1DElcUC5RDeV+zDS1T4Zc9t/TSGzHcsLIZAbWi6TmkRAfUlNNqWC3GN+A== X-Received: by 10.84.169.169 with SMTP id h38mr199277853plb.48.1481649989992; Tue, 13 Dec 2016 09:26:29 -0800 (PST) Received: from gmail.com ([106.215.131.233]) by smtp.gmail.com with ESMTPSA id 71sm81491573pft.25.2016.12.13.09.26.23 (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 13 Dec 2016 09:26:29 -0800 (PST) Received: by gmail.com (sSMTP sendmail emulation); Tue, 13 Dec 2016 22:56:15 +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: ak881x: constify v4l2_subdev_* structures Date: Tue, 13 Dec 2016 22:56:13 +0530 Message-Id: <1481649973-12062-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_video_ops i@p = {...}; @ok1@ identifier r1.i; position p; struct v4l2_subdev_ops obj; @@ obj.video=&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_video_ops i; File size before: text data bss dec hex filename 1809 872 0 2681 a79 drivers/media/i2c/ak881x.o File size after: text data bss dec hex filename 2185 496 0 2681 a79 drivers/media/i2c/ak881x.o Signed-off-by: Bhumika Goyal --- drivers/media/i2c/ak881x.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/i2c/ak881x.c b/drivers/media/i2c/ak881x.c index 3a795dc..16682c84 100644 --- a/drivers/media/i2c/ak881x.c +++ b/drivers/media/i2c/ak881x.c @@ -205,14 +205,14 @@ static int ak881x_s_stream(struct v4l2_subdev *sd, int enable) return 0; } -static struct v4l2_subdev_core_ops ak881x_subdev_core_ops = { +static const struct v4l2_subdev_core_ops ak881x_subdev_core_ops = { #ifdef CONFIG_VIDEO_ADV_DEBUG .g_register = ak881x_g_register, .s_register = ak881x_s_register, #endif }; -static struct v4l2_subdev_video_ops ak881x_subdev_video_ops = { +static const struct v4l2_subdev_video_ops ak881x_subdev_video_ops = { .s_std_output = ak881x_s_std_output, .s_stream = ak881x_s_stream, }; @@ -224,7 +224,7 @@ static int ak881x_s_stream(struct v4l2_subdev *sd, int enable) .get_fmt = ak881x_fill_fmt, }; -static struct v4l2_subdev_ops ak881x_subdev_ops = { +static const struct v4l2_subdev_ops ak881x_subdev_ops = { .core = &ak881x_subdev_core_ops, .video = &ak881x_subdev_video_ops, .pad = &ak881x_subdev_pad_ops,