Skip to content

Commit ce0b15d

Browse files
shemmingerdavem330
authored andcommitted
xgbe: constify get_netdev_ops and get_ethtool_ops
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>
1 parent 07469f8 commit ce0b15d

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

drivers/net/ethernet/amd/xgbe/xgbe-drv.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1708,9 +1708,9 @@ static const struct net_device_ops xgbe_netdev_ops = {
17081708
.ndo_set_features = xgbe_set_features,
17091709
};
17101710

1711-
struct net_device_ops *xgbe_get_netdev_ops(void)
1711+
const struct net_device_ops *xgbe_get_netdev_ops(void)
17121712
{
1713-
return (struct net_device_ops *)&xgbe_netdev_ops;
1713+
return &xgbe_netdev_ops;
17141714
}
17151715

17161716
static void xgbe_rx_refresh(struct xgbe_channel *channel)

drivers/net/ethernet/amd/xgbe/xgbe-ethtool.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ static const struct ethtool_ops xgbe_ethtool_ops = {
623623
.get_ts_info = xgbe_get_ts_info,
624624
};
625625

626-
struct ethtool_ops *xgbe_get_ethtool_ops(void)
626+
const struct ethtool_ops *xgbe_get_ethtool_ops(void)
627627
{
628-
return (struct ethtool_ops *)&xgbe_ethtool_ops;
628+
return &xgbe_ethtool_ops;
629629
}

drivers/net/ethernet/amd/xgbe/xgbe.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -956,8 +956,9 @@ struct xgbe_prv_data {
956956
void xgbe_init_function_ptrs_dev(struct xgbe_hw_if *);
957957
void xgbe_init_function_ptrs_phy(struct xgbe_phy_if *);
958958
void xgbe_init_function_ptrs_desc(struct xgbe_desc_if *);
959-
struct net_device_ops *xgbe_get_netdev_ops(void);
960-
struct ethtool_ops *xgbe_get_ethtool_ops(void);
959+
const struct net_device_ops *xgbe_get_netdev_ops(void);
960+
const struct ethtool_ops *xgbe_get_ethtool_ops(void);
961+
961962
#ifdef CONFIG_AMD_XGBE_DCB
962963
const struct dcbnl_rtnl_ops *xgbe_get_dcbnl_ops(void);
963964
#endif

0 commit comments

Comments
 (0)