Commit 66f58ec4 authored by Julia Lawall's avatar Julia Lawall Committed by David S. Miller
Browse files

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

The semantic patch that makes this change is as follows:


// <smpl>
@r disable optional_qualifier@
identifier i;
position p;
static struct net_device_ops i@p = { ... };

identifier r.i;
struct net_device e;
position p;
e.netdev_ops = &i@p;

position p != {r.p,ok.p};
identifier r.i;
struct net_device_ops e;

@depends on !bad disable optional_qualifier@
identifier r.i;
 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

and after the change it is:

   text	     data        bss	    dec	    hex	filename
   8571	      256          8       8835    2283
Signed-off-by: default avatarJulia Lawall <>
Signed-off-by: default avatarDavid S. Miller <>
parent 5ff904d5
......@@ -761,7 +761,7 @@ static const struct ethtool_ops hip04_ethtool_ops = {
.get_drvinfo = hip04_get_drvinfo,
static struct net_device_ops hip04_netdev_ops = {
static const struct net_device_ops hip04_netdev_ops = {
.ndo_open = hip04_mac_open,
.ndo_stop = hip04_mac_stop,
.ndo_get_stats = hip04_get_stats,
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment