diff options
author | Julia Lawall <julia.lawall@lip6.fr> | 2016-09-15 22:23:26 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-09-17 10:07:23 -0400 |
commit | eb94737d711913a23e466b99c0d9ffdf15651290 (patch) | |
tree | d2a72a3e7d1db6887049b78a154bfa81f5f9c7dc /net/ipv4 | |
parent | 373075049c7be28bed875494488c185ef5eeb938 (diff) | |
download | linux-eb94737d711913a23e466b99c0d9ffdf15651290.tar.gz linux-eb94737d711913a23e466b99c0d9ffdf15651290.tar.bz2 linux-eb94737d711913a23e466b99c0d9ffdf15651290.zip |
l2tp: constify net_device_ops structures
Check for net_device_ops structures that are only stored in the netdev_ops
field of a net_device structure. This field is declared const, so
net_device_ops structures that have this property can be declared as const
also.
The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)
// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
@@
static struct net_device_ops i@p = { ... };
@ok@
identifier r.i;
struct net_device e;
position p;
@@
e.netdev_ops = &i@p;
@bad@
position p != {r.p,ok.p};
identifier r.i;
struct net_device_ops e;
@@
e@i@p
@depends on !bad disable optional_qualifier@
identifier r.i;
@@
static
+const
struct net_device_ops i = { ... };
// </smpl>
The result of size on this file before the change is:
text data bss dec hex filename
3401 931 44 4376 1118 net/l2tp/l2tp_eth.o
and after the change it is:
text data bss dec hex filename
3993 347 44 4384 1120 net/l2tp/l2tp_eth.o
Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
0 files changed, 0 insertions, 0 deletions