]> git.baikalelectronics.ru Git - kernel.git/commitdiff
can: flexcan: export flexcan_ethtool_ops and remove flexcan_set_ethtool_ops()
authorVincent Mailhol <mailhol.vincent@wanadoo.fr>
Wed, 27 Jul 2022 10:49:39 +0000 (19:49 +0900)
committerMarc Kleine-Budde <mkl@pengutronix.de>
Wed, 27 Jul 2022 11:09:01 +0000 (13:09 +0200)
The function flexcan_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 flexcan_ethtool_ops so it becomes visible to
flexcan-core.c.

Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Link: https://lore.kernel.org/all/20220727104939.279022-4-mailhol.vincent@wanadoo.fr
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
drivers/net/can/flexcan/flexcan-core.c
drivers/net/can/flexcan/flexcan-ethtool.c
drivers/net/can/flexcan/flexcan.h

index d060088047f166b5d4b6f39052f4c6f348d0b247..f857968efed7d3179d192f48ba3430723d480fb5 100644 (file)
@@ -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;
 
index 3ae53557770071c3ad9a0861bd85447dcb98c845..f0873f3a2f34d3d3cf1143fbb18cb7b91f1327ef 100644 (file)
@@ -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;
-}
index 23fc09a7e10f330ecabd1412b6c96033ae23f274..8621a8ea1deaf322c54a7cf20fc411e45ba45694 100644 (file)
@@ -114,7 +114,7 @@ struct flexcan_priv {
        void (*write)(u32 val, void __iomem *addr);
 };
 
-void flexcan_set_ethtool_ops(struct net_device *dev);
+extern const struct ethtool_ops flexcan_ethtool_ops;
 
 static inline bool
 flexcan_supports_rx_mailbox(const struct flexcan_priv *priv)