Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1548871
| Path | csiph.com!goblin2!goblin.stu.neva.ru!news.unit0.net!news.panservice.it!diesel.cu.mi.it!bofh.it!news.nic.it!robomod |
|---|---|
| From | Bhumika Goyal <bhumirks@gmail.com> |
| Newsgroups | linux.kernel |
| Subject | [PATCH v2] drivers: remoteproc: constify rproc_ops structures |
| Date | Sun, 01 Jan 2017 11:50:01 +0100 |
| Message-ID | <sULS9-7Ex-7@gated-at.bofh.it> (permalink) |
| 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) |
| X-Mailer | git-send-email 1.9.1 |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 129 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | Bhumika Goyal <bhumirks@gmail.com> |
| X-Original-Date | Sun, 1 Jan 2017 16:13:37 +0530 |
| X-Original-Message-ID | <1483267417-7850-1-git-send-email-bhumirks@gmail.com> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1548871 |
Show key headers only | View raw
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 <bhumirks@gmail.com>
---
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,
--
1.9.1
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH v2] drivers: remoteproc: constify rproc_ops structures Bhumika Goyal <bhumirks@gmail.com> - 2017-01-01 11:50 +0100 Re: [PATCH v2] drivers: remoteproc: constify rproc_ops structures Bjorn Andersson <bjorn.andersson@linaro.org> - 2017-01-02 19:00 +0100
csiph-web