From patchwork Sat Dec 17 11:29:36 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhumika Goyal X-Patchwork-Id: 9479003 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 1A2B160827 for ; Sat, 17 Dec 2016 11:30:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0914428553 for ; Sat, 17 Dec 2016 11:30:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EFF0A28583; Sat, 17 Dec 2016 11:30: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=unavailable 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 90BB228553 for ; Sat, 17 Dec 2016 11:30:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756239AbcLQLaH (ORCPT ); Sat, 17 Dec 2016 06:30:07 -0500 Received: from mail-pg0-f66.google.com ([74.125.83.66]:34330 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756196AbcLQLaF (ORCPT ); Sat, 17 Dec 2016 06:30:05 -0500 Received: by mail-pg0-f66.google.com with SMTP id b1so2595148pgc.1; Sat, 17 Dec 2016 03:30:05 -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=+NbvlA84RXbsHqxeo1+qBgMIe8yaR6dWls5Lv45XuIU=; b=rrcL9mAWtuKybuTfCglS/uhhZTaagnfA5P46ewnhOl+sNs7hdAo6jfvoHR8AkpMgRH B/PVDT4jLuujGE5kysj2QuFoP1Acy8GjmUH3D8NJdKTrMkH7/IXbNQpLdlp9O75+pgyx IV02TNF729EMq6HrqbqHfHq8pVHnulolsByVr6AAc69EBxSCBHA8302N01/79O3M1AAG a6bT7O5i1Iy0Tmn8GhYcUmUqTsQQRv9g4MtKVrSOwpASbhSEPbtvJhWYT2QRmjkkUdqf 15oHKA1hp2dHNZWBXG/QyZxrf2n4QpwPA4kU0qzDZU10PJKuwzPWYu8bAm6Xw62TT0RH K4qg== 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=+NbvlA84RXbsHqxeo1+qBgMIe8yaR6dWls5Lv45XuIU=; b=fNXMXQKY17f4CLSxed64KmW+1WvejN9xBTwhUGbmNv72zBtfDRydzs0LFz144lO/8a XwLZCmcdC7c3JvP9S/sLrlwEUTxNG6VsoF6uURg4b8GMezOAVUe6gWaHc7LBrF9iJk1x Llb+vXBjn5tQlkfHMGz4g9B6AyouFL1ucjeImWYr5W2Eo+/OYRs/1QczPT5jq1vEK3v3 Ri0Lulm6tcu5VNfaq97aV/1Jl6d34/M39+AwbYLQh9p8bs0a0tadB7sE36quBiqVyXBB EBVGnKYpFDl+xZKGAaY+aYz8GXXW382BUlZEUtExYXQrDmEEitfDc1qrLqyHqZ0qx5/r U2Cw== X-Gm-Message-State: AKaTC036qFd1Y3IhLYjHOcq1TO7W0p1ovZNB7w4o5YwF52VgQ5e5bkPENzaxPovf0Q5C7g== X-Received: by 10.84.217.199 with SMTP id d7mr16638897plj.165.1481974204925; Sat, 17 Dec 2016 03:30:04 -0800 (PST) Received: from gmail.com ([223.176.158.25]) by smtp.gmail.com with ESMTPSA id z9sm18450419pge.44.2016.12.17.03.29.48 (version=TLS1 cipher=AES128-SHA bits=128/128); Sat, 17 Dec 2016 03:30:03 -0800 (PST) Received: by gmail.com (sSMTP sendmail emulation); Sat, 17 Dec 2016 16:59:38 +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, kernel@stlinux.com Cc: Bhumika Goyal Subject: [PATCH] drivers: remoteproc: constify rproc_ops structures Date: Sat, 17 Dec 2016 16:59:36 +0530 Message-Id: <1481974176-19912-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 sizes before: text data bss dec hex filename 1258 416 0 1674 68a remoteproc/omap_remoteproc.o 2402 240 0 2642 a52 remoteproc/st_remoteproc.o 2064 272 0 2336 920 remoteproc/st_slim_rproc.o 2160 240 0 2400 960 remoteproc/wkup_m3_rproc.o File sizes after: text data bss dec hex filename 1297 368 0 1665 681 remoteproc/omap_remoteproc.o 2434 192 0 2626 a42 remoteproc/st_remoteproc.o 2112 240 0 2352 930 remoteproc/st_slim_rproc.o 2200 192 0 2392 958 remoteproc/wkup_m3_rproc.o Signed-off-by: Bhumika Goyal --- 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 +- 4 files changed, 4 insertions(+), 4 deletions(-) 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,