linux_dsm_epyc7002/drivers/net/ethernet/hisilicon
Julia Lawall 66f58ec486 hisilicon: 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
   7995	       848       8    8851        2293
   drivers/net/ethernet/hisilicon/hip04_eth.o

and after the change it is:

   text	     data        bss	    dec	    hex	filename
   8571	      256          8       8835    2283
   drivers/net/ethernet/hisilicon/hip04_eth.o

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Signed-off-by: David S. Miller <davem@davemloft.net>
2016-09-17 10:07:23 -04:00
..
hns net: hisilicon: constify ethtool_ops structures 2016-08-31 09:22:31 -07:00
hip04_eth.c hisilicon: constify net_device_ops structures 2016-09-17 10:07:23 -04:00
hisi_femac.c net: hisilicon: constify ethtool_ops structures 2016-08-31 09:22:31 -07:00
hix5hd2_gmac.c net: hisilicon: constify ethtool_ops structures 2016-08-31 09:22:31 -07:00
hns_mdio.c net: hns: get reset registers from DT 2016-07-01 16:56:52 -04:00
Kconfig net: hisilicon: Add Fast Ethernet MAC driver 2016-07-16 21:32:58 -07:00
Makefile net: hisilicon: Add Fast Ethernet MAC driver 2016-07-16 21:32:58 -07:00