From patchwork Mon Apr 4 11:40:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?QXLEsW7DpyDDnE5BTA==?= X-Patchwork-Id: 12800123 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 13925C433EF for ; Mon, 4 Apr 2022 11:50:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229764AbiDDLwf (ORCPT ); Mon, 4 Apr 2022 07:52:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229462AbiDDLwe (ORCPT ); Mon, 4 Apr 2022 07:52:34 -0400 Received: from sender4-op-o14.zoho.com (sender4-op-o14.zoho.com [136.143.188.14]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDCB83CA73; Mon, 4 Apr 2022 04:50:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649072989; cv=none; d=zohomail.com; s=zohoarc; b=mo9jhXQZ7dDfCf1zx7Yyf+stoyzYLHDat6/ldYvgARU4DTqk8M/fLkTKnk6kk4m8K4dDx/tbE29b02iB/+7WXLZVRt7BlxIAwga5gqJUmEcl1lwZPbYgk21o8TIOcGFeoY3s0Mn3bsubyzEqVQw9r+vjftyvK0Td6cDS0tLLy6k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1649072989; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:MIME-Version:Message-ID:Subject:To; bh=wH4MR2QRn9EFb2QbwxNQgFaKaRIZbXHNTjFSYpDqoMw=; b=mvN16TYvpnQFqPff72eSPvIC0ozSHO71u54Mb9PCl6qVOfs55jVj68Nkm+weM4gCFg5kXX4T2LXE5+xbCP3qxkh9t/PeTwxTlKpBGcp4N+eK2KpPxvl0tjkMZyjmT97nrv+bq0/D604smZ9Nm/IYVVQB/EPkS7bim5lBRhRP5KI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=arinc9.com; spf=pass smtp.mailfrom=arinc.unal@arinc9.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1649072989; s=zmail; d=arinc9.com; i=arinc.unal@arinc9.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Message-Id:Message-Id:MIME-Version:Content-Type:Content-Transfer-Encoding:Reply-To; bh=wH4MR2QRn9EFb2QbwxNQgFaKaRIZbXHNTjFSYpDqoMw=; b=IkEd+cky5pBihx3tcwh3yFXJsL52aUpLmKI7SE1Veg6+CXdfer2QOO4OVurIN1cz kqH2BKaeeH708amasT03Nq1Lhc31tl7VooNJHHiuYATvSkEcCoDsm/Wsnxxl25FMKqS LHIoyRojQWUtUkheDaeSrCqNTo+eHvfAZKOwAWbg= Received: from arinc9-PC.localdomain (85.117.236.245 [85.117.236.245]) by mx.zohomail.com with SMTPS id 1649072986682935.7989606149916; Mon, 4 Apr 2022 04:49:46 -0700 (PDT) From: =?utf-8?b?QXLEsW7DpyDDnE5BTA==?= To: Sergio Paracuellos , Felix Fietkau , John Crispin , Sean Wang , Mark Lee , "David S . Miller" , Jakub Kicinski , Paolo Abeni , Matthias Brugger , Russell King Cc: netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, =?utf-8?q?Ren=C3=A9_van_Dorst?= , =?utf-8?b?QXLEsW4=?= =?utf-8?b?w6cgw5xOQUw=?= Subject: [PATCH] net: ethernet: mtk_eth_soc: add label support for GMACs Date: Mon, 4 Apr 2022 14:40:00 +0300 Message-Id: <20220404114000.3549-1-arinc.unal@arinc9.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-ZohoMailClient: External Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org From: René van Dorst 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 [arinc.unal@arinc9.com: change commit log and rebase to current net-next] Signed-off-by: Arınç ÜNAL --- 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: