> +void ncsi_ethtool_register_dev(struct net_device *dev) > +{ > + struct ethtool_ops *ops; > + > + ops = (struct ethtool_ops *)(dev->ethtool_ops);
Why do you need the cast here? Ah, is it because net_device has: const struct ethtool_ops *ethtool_ops; i.e. you are casting off the const. > + if (!ops) > + return; > + > + ops->get_ncsi_channels = ncsi_get_channels; and here you modify it. Which is going to blow up, because it will be in a read only segment and should throw an opps when you write to it? You need to export ncsi_get_channels, and let the underlying driver add it to its own ethtool_ops. Andrew