mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] net: ethernet: mtk_eth_soc: add label support for GMACs
@ 2022-04-04 11:40 Arınç ÜNAL
  2022-04-04 12:22 ` Andrew Lunn
  0 siblings, 1 reply; 3+ messages in thread
From: Arınç ÜNAL @ 2022-04-04 11:40 UTC (permalink / raw)
  To: Sergio Paracuellos, Felix Fietkau, John Crispin, Sean Wang,
	Mark Lee, David S . Miller, Jakub Kicinski, Paolo Abeni,
	Matthias Brugger, Russell King
  Cc: netdev, linux-arm-kernel, linux-mediatek, linux-kernel,
	René van Dorst, Arınç ÜNAL

From: René van Dorst <opensource@vdorst.com>

Add label support for GMACs. The network interface of the GMAC will have
the string of the label property defined on the devicetree as its name.

Signed-off-by: René van Dorst <opensource@vdorst.com>
[arinc.unal@arinc9.com: change commit log and rebase to current net-next]
Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
---
 drivers/net/ethernet/mediatek/mtk_eth_soc.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index f02d07ec5ccb..af2f0693180a 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -2911,6 +2911,7 @@ static const struct net_device_ops mtk_netdev_ops = {
 
 static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np)
 {
+	const char *name = of_get_property(np, "label", NULL);
 	const __be32 *_id = of_get_property(np, "reg", NULL);
 	phy_interface_t phy_mode;
 	struct phylink *phylink;
@@ -3033,6 +3034,9 @@ static int mtk_add_mac(struct mtk_eth *eth, struct device_node *np)
 	else
 		eth->netdev[id]->max_mtu = MTK_MAX_RX_LENGTH_2K - MTK_RX_ETH_HLEN;
 
+	if (name)
+		strlcpy(eth->netdev[id]->name, name, IFNAMSIZ);
+
 	return 0;
 
 free_netdev:
-- 
2.25.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-04-05 20:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-04 11:40 [PATCH] net: ethernet: mtk_eth_soc: add label support for GMACs Arınç ÜNAL
2022-04-04 12:22 ` Andrew Lunn
2022-04-05 17:15   ` Arınç ÜNAL

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®