Commit 9d8dd372 authored by Marc Kleine-Budde's avatar Marc Kleine-Budde
Browse files

Merge patch series "can: export export slcan_ethtool_ops and remove setter functions"

Vincent Mailhol <mailhol.vincent@wanadoo.fr> says:

====================

The c_can, flexcan and slcan use a setter function to populate
net_device::ethtool_ops. Using a setter here add one additional
function call and add some small bloat in the object file. Exporting
the structure allow to remove this setter.

The mcp251xfd uses a similar pattern except that it does some
additional initialization. As such, this driver is left untouched.

* Statistics *

For the slcan driver, this patch reduces the object file by 14 bytes
(details in the first patch). Although we did not conduct a benchmark
for the other drivers but we expect the exact same figures.

====================

Link: https://lore.kernel.org/all/20220727104939.279022-1-mailhol.vincent@wanadoo.fr


Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parents a6e6231a b4b97079
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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)
{
+1 −6
Original line number Diff line number Diff line
@@ -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;
}
+1 −1
Original line number Diff line number Diff line
@@ -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);
}
+1 −1
Original line number Diff line number Diff line
@@ -2113,7 +2113,7 @@ static int flexcan_probe(struct platform_device *pdev)
	SET_NETDEV_DEV(dev, &pdev->dev);

	dev->netdev_ops = &flexcan_netdev_ops;
	flexcan_set_ethtool_ops(dev);
	dev->ethtool_ops = &flexcan_ethtool_ops;
	dev->irq = irq;
	dev->flags |= IFF_ECHO;

+1 −6
Original line number Diff line number Diff line
@@ -100,15 +100,10 @@ static int flexcan_get_sset_count(struct net_device *netdev, int sset)
	}
}

static const struct ethtool_ops flexcan_ethtool_ops = {
const struct ethtool_ops flexcan_ethtool_ops = {
	.get_ringparam = flexcan_get_ringparam,
	.get_strings = flexcan_get_strings,
	.get_priv_flags = flexcan_get_priv_flags,
	.set_priv_flags = flexcan_set_priv_flags,
	.get_sset_count = flexcan_get_sset_count,
};

void flexcan_set_ethtool_ops(struct net_device *netdev)
{
	netdev->ethtool_ops = &flexcan_ethtool_ops;
}
Loading