diff options
author | Julia Lawall <julia.lawall@lip6.fr> | 2016-10-15 17:40:30 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-10-15 17:49:57 -0400 |
commit | ab530f63e7fbac2b0a233da9d31e21a86d1863f5 (patch) | |
tree | 6404a17f2887db2ac5020f8b28be7f79e049ced3 /drivers/net/ipvlan | |
parent | f9dbd5a343eeb3e8bf8853256d05188dd27c1ecf (diff) | |
download | blackbird-op-linux-ab530f63e7fbac2b0a233da9d31e21a86d1863f5.tar.gz blackbird-op-linux-ab530f63e7fbac2b0a233da9d31e21a86d1863f5.zip |
ipvlan: constify l3mdev_ops structure
This l3mdev_ops structure is only stored in the l3mdev_ops field of a
net_device structure. This field is declared const, so the l3mdev_ops
structure can be declared as const also. Additionally drop the
__read_mostly annotation.
The semantic patch that adds const is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct l3mdev_ops i@p = { ... };
@ok@
identifier r.i;
struct net_device *e;
position p;
@@
e->l3mdev_ops = &i@p;
@bad@
position p != {r.p,ok.p};
identifier r.i;
struct l3mdev_ops e;
@@
e@i@p
@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
struct l3mdev_ops i = { ... };
// </smpl>
The effect on the layout of the .o file is shown by the following output
of the size command, first before then after the transformation:
text data bss dec hex filename
7364 466 52 7882 1eca drivers/net/ipvlan/ipvlan_main.o
7412 434 52 7898 1eda drivers/net/ipvlan/ipvlan_main.o
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ipvlan')
-rw-r--r-- | drivers/net/ipvlan/ipvlan_main.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c index f442eb366863..ab90b22e778c 100644 --- a/drivers/net/ipvlan/ipvlan_main.c +++ b/drivers/net/ipvlan/ipvlan_main.c @@ -26,7 +26,7 @@ static struct nf_hook_ops ipvl_nfops[] __read_mostly = { }, }; -static struct l3mdev_ops ipvl_l3mdev_ops __read_mostly = { +static const struct l3mdev_ops ipvl_l3mdev_ops = { .l3mdev_l3_rcv = ipvlan_l3_rcv, }; |