From patchwork Sun Jan 1 10:43:37 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhumika Goyal X-Patchwork-Id: 9492879 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 7F29F60415 for ; Sun, 1 Jan 2017 10:44:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4EBEA20007 for ; Sun, 1 Jan 2017 10:44:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2FFF6266F3; Sun, 1 Jan 2017 10:44:08 +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 A7A6120007 for ; Sun, 1 Jan 2017 10:44:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754636AbdAAKoG (ORCPT ); Sun, 1 Jan 2017 05:44:06 -0500 Received: from mail-pg0-f66.google.com ([74.125.83.66]:34028 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750845AbdAAKoF (ORCPT ); Sun, 1 Jan 2017 05:44:05 -0500 Received: by mail-pg0-f66.google.com with SMTP id b1so27467671pgc.1; Sun, 01 Jan 2017 02:44:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=bFu3NGreDat2cUGoBsagc+Mf8NeWP+6/Sit18QDW2qE=; b=FlJSfB7Gj0YdZNk7Dww452WZgh3W6SWgHTIHE31bzv87iz8CThy8R/6N2Ni9dx6dtz +L5TUOAU2osyJlK1DYE8aWFOO/4aMJyZDbqNYlxaHSSgcP9wai5Ihe39CFCT9Iv46j2K SPYfl9q5B+btQcVGrwW08cQXXI/kaVmttg/ybsulRNDD+lch3C5dv8CkS5QK7Ossiafa xleNyd7Y4ALYex1GKzyw5MU27eXdbx4ZXE1YOgSIPjSrmZtKfowNv9PS1WnSG3GfteOY 4HggDMTKIPWjtu+PfRxMJO0u09ngoKLxGkZYfmIEFDSQOde/JEglbcVRVBaiA1hynR43 2kXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=bFu3NGreDat2cUGoBsagc+Mf8NeWP+6/Sit18QDW2qE=; b=MBRs+r5yxwm0qp8giP36cu/VcDEEfUodnYtC8XvxBUDJLjr7k7CqhBhElBG5heNZrn vCA0C6n87Tk0U1k781ivaUS2UDfpZIb+47MNHlAp/dnp3cUnO4wWb56E9KFS0TVTBQF7 lbhjwN3W3wcB4xkTtem+3aKuVO2FrvbZG7Z47meAS3AkD1t8VVRTBsNLIITdaY5x27Y6 aF+zFWrd5HIxtQN4nAZUQcanGxlfbY6uDs6TPI84TEh6XtbqfsYdpN8wVaO/jawkWmY7 ZrHdPoK2KNrW0zaWtcdffiq2o8je/1KvSOrc15pmojCwEzC9xGHwjH11zTWqVJ9E1SBe 3heg== X-Gm-Message-State: AIkVDXI0oU1jR4NrHCaHtDmTwP73mKIi+daLdEvEz31WZaUEO0QvE8g6/A9Bc8gyaizeiw== X-Received: by 10.99.226.3 with SMTP id q3mr100379020pgh.37.1483267444370; Sun, 01 Jan 2017 02:44:04 -0800 (PST) Received: from gmail.com ([2405:204:5205:5646:5fa:4721:650:924f]) by smtp.gmail.com with ESMTPSA id y15sm125222928pgc.43.2017.01.01.02.43.58 (version=TLS1 cipher=AES128-SHA bits=128/128); Sun, 01 Jan 2017 02:44:02 -0800 (PST) Received: by gmail.com (sSMTP sendmail emulation); Sun, 01 Jan 2017 16:13:54 +0530 From: Bhumika Goyal To: julia.lawall@lip6.fr, ohad@wizery.com, bjorn.andersson@linaro.org, patrice.chotard@st.com, linux-remoteproc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Bhumika Goyal Subject: [PATCH v2] drivers: remoteproc: constify rproc_ops structures Date: Sun, 1 Jan 2017 16:13:37 +0530 Message-Id: <1483267417-7850-1-git-send-email-bhumirks@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-remoteproc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Declare rproc_ops structures as const as they are only passed as an argument to the function rproc_alloc. This argument is of type const, so rproc_ops structures having this property can be declared const too. Done using Coccinelle: @r1 disable optional_qualifier @ identifier i; position p; @@ static struct rproc_ops i@p = {...}; @ok1@ identifier r1.i; position p; @@ rproc_alloc(...,&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 rproc_ops i; File size details: Size of the file remoteproc/da8xx_remoteproc.o remains the same before and after applying the changes. text data bss dec hex filename 1312 100 4 1416 588 remoteproc/da8xx_remoteproc.o 1312 100 4 1416 588 remoteproc/da8xx_remoteproc.o 970 240 0 1210 4ba remoteproc/omap_remoteproc.o 1002 192 0 1194 4aa remoteproc/omap_remoteproc.o 1901 240 0 2141 85d remoteproc/st_remoteproc.o 1933 192 0 2125 84d remoteproc/st_remoteproc.o 1288 96 0 1384 568 remoteproc/st_slim_rproc.o 1320 64 0 1384 568 remoteproc/st_slim_rproc.o 2121 240 0 2361 939 remoteproc/wkup_m3_rproc.o 2161 192 0 2353 931 remoteproc/wkup_m3_rproc.o Signed-off-by: Bhumika Goyal --- Changes in v2: * Apply the changes to the file da8xx_remoteproc.c as well. drivers/remoteproc/da8xx_remoteproc.c | 2 +- drivers/remoteproc/omap_remoteproc.c | 2 +- drivers/remoteproc/st_remoteproc.c | 2 +- drivers/remoteproc/st_slim_rproc.c | 2 +- drivers/remoteproc/wkup_m3_rproc.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/remoteproc/da8xx_remoteproc.c b/drivers/remoteproc/da8xx_remoteproc.c index 1afac8f..3814de2 100644 --- a/drivers/remoteproc/da8xx_remoteproc.c +++ b/drivers/remoteproc/da8xx_remoteproc.c @@ -151,7 +151,7 @@ static void da8xx_rproc_kick(struct rproc *rproc, int vqid) writel(SYSCFG_CHIPSIG2, drproc->chipsig); } -static struct rproc_ops da8xx_rproc_ops = { +static const struct rproc_ops da8xx_rproc_ops = { .start = da8xx_rproc_start, .stop = da8xx_rproc_stop, .kick = da8xx_rproc_kick, diff --git a/drivers/remoteproc/omap_remoteproc.c b/drivers/remoteproc/omap_remoteproc.c index fa63bf2..a96ce90 100644 --- a/drivers/remoteproc/omap_remoteproc.c +++ b/drivers/remoteproc/omap_remoteproc.c @@ -177,7 +177,7 @@ static int omap_rproc_stop(struct rproc *rproc) return 0; } -static struct rproc_ops omap_rproc_ops = { +static const struct rproc_ops omap_rproc_ops = { .start = omap_rproc_start, .stop = omap_rproc_stop, .kick = omap_rproc_kick, diff --git a/drivers/remoteproc/st_remoteproc.c b/drivers/remoteproc/st_remoteproc.c index da4e152..f21787b 100644 --- a/drivers/remoteproc/st_remoteproc.c +++ b/drivers/remoteproc/st_remoteproc.c @@ -107,7 +107,7 @@ static int st_rproc_stop(struct rproc *rproc) return sw_err ?: pwr_err; } -static struct rproc_ops st_rproc_ops = { +static const struct rproc_ops st_rproc_ops = { .start = st_rproc_start, .stop = st_rproc_stop, }; diff --git a/drivers/remoteproc/st_slim_rproc.c b/drivers/remoteproc/st_slim_rproc.c index 507716c..6cfd862 100644 --- a/drivers/remoteproc/st_slim_rproc.c +++ b/drivers/remoteproc/st_slim_rproc.c @@ -200,7 +200,7 @@ static void *slim_rproc_da_to_va(struct rproc *rproc, u64 da, int len) return va; } -static struct rproc_ops slim_rproc_ops = { +static const struct rproc_ops slim_rproc_ops = { .start = slim_rproc_start, .stop = slim_rproc_stop, .da_to_va = slim_rproc_da_to_va, diff --git a/drivers/remoteproc/wkup_m3_rproc.c b/drivers/remoteproc/wkup_m3_rproc.c index 18175d0..1ada0e5 100644 --- a/drivers/remoteproc/wkup_m3_rproc.c +++ b/drivers/remoteproc/wkup_m3_rproc.c @@ -111,7 +111,7 @@ static void *wkup_m3_rproc_da_to_va(struct rproc *rproc, u64 da, int len) return va; } -static struct rproc_ops wkup_m3_rproc_ops = { +static const struct rproc_ops wkup_m3_rproc_ops = { .start = wkup_m3_rproc_start, .stop = wkup_m3_rproc_stop, .da_to_va = wkup_m3_rproc_da_to_va,