diff options
author | Bhumika Goyal <bhumirks@gmail.com> | 2017-01-05 02:30:43 -0500 |
---|---|---|
committer | Jassi Brar <jaswinder.singh@linaro.org> | 2017-03-28 13:57:32 -0400 |
commit | 8ce33c6ff375b59bfa0a347782c49da94e64bb85 (patch) | |
tree | cab380fb148cd80e94e0207416af82b9cd45b408 /drivers/mailbox | |
parent | ad0376eb1483bd9880770b346f6592aece669e4c (diff) |
mailbox: constify mbox_chan_ops structures
Check for mbox_chan_ops structures that are only stored in the ops field
of a mbox_controller structure. This field is of type const struct
mbox_chan_ops *, so mbox_chan_ops structures having this property can be
declared as const.
Done using Coccinelle:
@r1 disable optional_qualifier @
identifier i;
position p;
@@
struct mbox_chan_ops i@p = {...};
@ok1@
identifier r1.i;
struct hi6220_mbox mbox;
struct slimpro_mbox ctx;
position p;
@@
(
mbox.controller.ops=&i@p
|
ctx.mb_ctrl.ops=&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 mbox_chan_ops i;
File size details:
text data bss dec hex filename
2310 248 0 2558 9fe drivers/mailbox/hi6220-mailbox.o
2366 192 0 2558 9fe drivers/mailbox/hi6220-mailbox.o
1500 248 0 1748 6d4 mailbox/mailbox-xgene-slimpro.o
1556 192 0 1748 6d4 mailbox/mailbox-xgene-slimpro.o
Signed-off-by: Bhumika Goyal <bhumirks@gmail.com>
Signed-off-by: Jassi Brar <jaswinder.singh@linaro.org>
Diffstat (limited to 'drivers/mailbox')
-rw-r--r-- | drivers/mailbox/hi6220-mailbox.c | 2 | ||||
-rw-r--r-- | drivers/mailbox/mailbox-xgene-slimpro.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/drivers/mailbox/hi6220-mailbox.c b/drivers/mailbox/hi6220-mailbox.c index 613722db5daf..519376d3534c 100644 --- a/drivers/mailbox/hi6220-mailbox.c +++ b/drivers/mailbox/hi6220-mailbox.c | |||
@@ -221,7 +221,7 @@ static void hi6220_mbox_shutdown(struct mbox_chan *chan) | |||
221 | mbox->irq_map_chan[mchan->ack_irq] = NULL; | 221 | mbox->irq_map_chan[mchan->ack_irq] = NULL; |
222 | } | 222 | } |
223 | 223 | ||
224 | static struct mbox_chan_ops hi6220_mbox_ops = { | 224 | static const struct mbox_chan_ops hi6220_mbox_ops = { |
225 | .send_data = hi6220_mbox_send_data, | 225 | .send_data = hi6220_mbox_send_data, |
226 | .startup = hi6220_mbox_startup, | 226 | .startup = hi6220_mbox_startup, |
227 | .shutdown = hi6220_mbox_shutdown, | 227 | .shutdown = hi6220_mbox_shutdown, |
diff --git a/drivers/mailbox/mailbox-xgene-slimpro.c b/drivers/mailbox/mailbox-xgene-slimpro.c index dd2afbca51c9..a7040163dd43 100644 --- a/drivers/mailbox/mailbox-xgene-slimpro.c +++ b/drivers/mailbox/mailbox-xgene-slimpro.c | |||
@@ -174,7 +174,7 @@ static void slimpro_mbox_shutdown(struct mbox_chan *chan) | |||
174 | devm_free_irq(mb_chan->dev, mb_chan->irq, mb_chan); | 174 | devm_free_irq(mb_chan->dev, mb_chan->irq, mb_chan); |
175 | } | 175 | } |
176 | 176 | ||
177 | static struct mbox_chan_ops slimpro_mbox_ops = { | 177 | static const struct mbox_chan_ops slimpro_mbox_ops = { |
178 | .send_data = slimpro_mbox_send_data, | 178 | .send_data = slimpro_mbox_send_data, |
179 | .startup = slimpro_mbox_startup, | 179 | .startup = slimpro_mbox_startup, |
180 | .shutdown = slimpro_mbox_shutdown, | 180 | .shutdown = slimpro_mbox_shutdown, |