]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
xgbe: constify get_netdev_ops and get_ethtool_ops
authorstephen hemminger <stephen@networkplumber.org>
Wed, 31 Aug 2016 15:57:36 +0000 (08:57 -0700)
committerDavid S. Miller <davem@davemloft.net>
Wed, 31 Aug 2016 21:17:30 +0000 (14:17 -0700)
Casting away const is bad practice. Since this is ARM specific driver
don't have hardware actually test this.

Having getter functions for ops is really unnecessary code bloat, but
not going to touch that.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/amd/xgbe/xgbe-drv.c
drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c
drivers/net/ethernet/amd/xgbe/xgbe.h

index a9b2709567ec34c91a3416cefcd43335330e20eb..7f9216db026fa2ee8abe1cf695415ad0be237dc8 100644 (file)
@@ -1708,9 +1708,9 @@ static const struct net_device_ops xgbe_netdev_ops = {
        .ndo_set_features       = xgbe_set_features,
 };
 
-struct net_device_ops *xgbe_get_netdev_ops(void)
+const struct net_device_ops *xgbe_get_netdev_ops(void)
 {
-       return (struct net_device_ops *)&xgbe_netdev_ops;
+       return &xgbe_netdev_ops;
 }
 
 static void xgbe_rx_refresh(struct xgbe_channel *channel)
index 11d9f0c5b78bf819e59a1d71b385fbfaf7ed97bc..4007b429c80c4a962c628199623028f32ac59792 100644 (file)
@@ -623,7 +623,7 @@ static const struct ethtool_ops xgbe_ethtool_ops = {
        .get_ts_info = xgbe_get_ts_info,
 };
 
-struct ethtool_ops *xgbe_get_ethtool_ops(void)
+const struct ethtool_ops *xgbe_get_ethtool_ops(void)
 {
-       return (struct ethtool_ops *)&xgbe_ethtool_ops;
+       return &xgbe_ethtool_ops;
 }
index 98d9d63c4353370c464e06a210b9af3b37e83133..5dd17dcea2f847a83e03cbc220c975e351fcea21 100644 (file)
@@ -956,8 +956,9 @@ struct xgbe_prv_data {
 void xgbe_init_function_ptrs_dev(struct xgbe_hw_if *);
 void xgbe_init_function_ptrs_phy(struct xgbe_phy_if *);
 void xgbe_init_function_ptrs_desc(struct xgbe_desc_if *);
-struct net_device_ops *xgbe_get_netdev_ops(void);
-struct ethtool_ops *xgbe_get_ethtool_ops(void);
+const struct net_device_ops *xgbe_get_netdev_ops(void);
+const struct ethtool_ops *xgbe_get_ethtool_ops(void);
+
 #ifdef CONFIG_AMD_XGBE_DCB
 const struct dcbnl_rtnl_ops *xgbe_get_dcbnl_ops(void);
 #endif