]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
dwc_eth_qos: constify net_device_ops structures
authorJulia Lawall <julia.lawall@lip6.fr>
Thu, 15 Sep 2016 20:23:25 +0000 (22:23 +0200)
committerDavid S. Miller <davem@davemloft.net>
Sat, 17 Sep 2016 14:07:23 +0000 (10:07 -0400)
commit373075049c7be28bed875494488c185ef5eeb938
tree3426d2eeeeabf7944ce5d5f6e238cc05c2c670fc
parent66f58ec486389e8d3f7ebe8cfc3883a72e808eb9
dwc_eth_qos: 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
  21623       1316      40   22979        59c3
   drivers/net/ethernet/synopsys/dwc_eth_qos.o

and after the change it is:
   text      data        bss     dec     hex filename
  22199       724         40      22963    59b3
   drivers/net/ethernet/synopsys/dwc_eth_qos.o

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/synopsys/dwc_eth_qos.c