diff options
author | Marc Kleine-Budde <mkl@pengutronix.de> | 2022-07-27 13:09:39 +0200 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2022-07-27 13:09:39 +0200 |
commit | 9d8dd3725f4032f94d9cf65304559e0780e04ad7 (patch) | |
tree | 8a7a335fbc871810cbcb322599f7d448eeee9330 /drivers/net/can/slcan | |
parent | a6e6231ac10a0e94ed298de8297574b8944f7bfa (diff) | |
parent | b4b97079a49ec81fa2236fb2ebbba867fff5d4ba (diff) | |
download | linux-9d8dd3725f4032f94d9cf65304559e0780e04ad7.tar.gz linux-9d8dd3725f4032f94d9cf65304559e0780e04ad7.tar.bz2 linux-9d8dd3725f4032f94d9cf65304559e0780e04ad7.zip |
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: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can/slcan')
-rw-r--r-- | drivers/net/can/slcan/slcan-core.c | 2 | ||||
-rw-r--r-- | drivers/net/can/slcan/slcan-ethtool.c | 7 | ||||
-rw-r--r-- | drivers/net/can/slcan/slcan.h | 3 |
3 files changed, 4 insertions, 8 deletions
diff --git a/drivers/net/can/slcan/slcan-core.c b/drivers/net/can/slcan/slcan-core.c index dc28e715bbe1..6162e6132ea4 100644 --- a/drivers/net/can/slcan/slcan-core.c +++ b/drivers/net/can/slcan/slcan-core.c @@ -866,8 +866,8 @@ static struct slcan *slc_alloc(void) snprintf(dev->name, sizeof(dev->name), "slcan%d", i); dev->netdev_ops = &slc_netdev_ops; + dev->ethtool_ops = &slcan_ethtool_ops; dev->base_addr = i; - slcan_set_ethtool_ops(dev); sl = netdev_priv(dev); /* Initialize channel control data */ diff --git a/drivers/net/can/slcan/slcan-ethtool.c b/drivers/net/can/slcan/slcan-ethtool.c index bf0afdc4e49d..328ae1fb065b 100644 --- a/drivers/net/can/slcan/slcan-ethtool.c +++ b/drivers/net/can/slcan/slcan-ethtool.c @@ -52,14 +52,9 @@ static int slcan_get_sset_count(struct net_device *netdev, int sset) } } -static const struct ethtool_ops slcan_ethtool_ops = { +const struct ethtool_ops slcan_ethtool_ops = { .get_strings = slcan_get_strings, .get_priv_flags = slcan_get_priv_flags, .set_priv_flags = slcan_set_priv_flags, .get_sset_count = slcan_get_sset_count, }; - -void slcan_set_ethtool_ops(struct net_device *netdev) -{ - netdev->ethtool_ops = &slcan_ethtool_ops; -} diff --git a/drivers/net/can/slcan/slcan.h b/drivers/net/can/slcan/slcan.h index d463c8d99e22..85cedf856db3 100644 --- a/drivers/net/can/slcan/slcan.h +++ b/drivers/net/can/slcan/slcan.h @@ -13,6 +13,7 @@ bool slcan_err_rst_on_open(struct net_device *ndev); int slcan_enable_err_rst_on_open(struct net_device *ndev, bool on); -void slcan_set_ethtool_ops(struct net_device *ndev); + +extern const struct ethtool_ops slcan_ethtool_ops; #endif /* _SLCAN_H */ |