Skip to content

Commit

Permalink
can: c_can: export c_can_ethtool_ops and remove c_can_set_ethtool_ops()
Browse files Browse the repository at this point in the history
The function c_can_set_ethtool_ops() does one thing: populate
net_device::ethtool_ops. Instead, it is possible to directly assign
this field and remove one function call and slightly reduce the object
size. To do so, export c_can_ethtool_ops so it becomes visible to
c_can_main.c.

Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Link: https://lore.kernel.org/all/20220727104939.279022-3-mailhol.vincent@wanadoo.fr
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
  • Loading branch information
Vincent Mailhol authored and Marc Kleine-Budde committed Jul 27, 2022
1 parent 1851532 commit 0ccb3e0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 8 deletions.
2 changes: 1 addition & 1 deletion drivers/net/can/c_can/c_can.h
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ int c_can_power_up(struct net_device *dev);
int c_can_power_down(struct net_device *dev);
#endif

void c_can_set_ethtool_ops(struct net_device *dev);
extern const struct ethtool_ops c_can_ethtool_ops;

static inline u8 c_can_get_tx_head(const struct c_can_tx_ring *ring)
{
Expand Down
7 changes: 1 addition & 6 deletions drivers/net/can/c_can/c_can_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ static void c_can_get_ringparam(struct net_device *netdev,
ring->tx_pending = priv->msg_obj_tx_num;
}

static const struct ethtool_ops c_can_ethtool_ops = {
const struct ethtool_ops c_can_ethtool_ops = {
.get_ringparam = c_can_get_ringparam,
};

void c_can_set_ethtool_ops(struct net_device *netdev)
{
netdev->ethtool_ops = &c_can_ethtool_ops;
}
2 changes: 1 addition & 1 deletion drivers/net/can/c_can/c_can_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1364,7 +1364,7 @@ int register_c_can_dev(struct net_device *dev)

dev->flags |= IFF_ECHO; /* we support local echo */
dev->netdev_ops = &c_can_netdev_ops;
c_can_set_ethtool_ops(dev);
dev->ethtool_ops = &c_can_ethtool_ops;

return register_candev(dev);
}
Expand Down

0 comments on commit 0ccb3e0

Please sign in to comment.