From patchwork Wed Feb 5 12:42:21 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Biju Das X-Patchwork-Id: 13960936 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2FE92C02194 for ; Wed, 5 Feb 2025 12:44:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=4oZeW2TzGduBdntmqzLgzniOSZrvrZynfD5tPbUne3o=; b=uFRLA5dbEo+3qjrOY9BXYnyhrM wkPMnKqkHD50RnK/B6Y+7vb2mj5WIxc01SF48IHOLklbLNe40o46urXNQVjUM+P9iexN9eIJMiSmf RVZwKJ+ihdJKBbdqtmVyJ2ER3H9bs2UTZGyUTf4vubz3nBG83+xedAPYrxihoDXe9Nxd9CUHc6UJw 9mpHZC+3p4z+YKAXMnla/JHLyZU9tUeANHXBA3HrBiTME2/YBNEjxLWt2wURJZHYjkiJRNoBnZOB0 kr9LuFBMSlhEmZLNzLPzDc9XRHBUQK5pJ8ZV3Oo+23W5OX4drNA1ZE+FI4rLlR4yBZeDb7/+dDqT2 UxKtPDhQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tfelR-00000003G2u-0NzU; Wed, 05 Feb 2025 12:44:21 +0000 Received: from relmlor1.renesas.com ([210.160.252.171] helo=relmlie5.idc.renesas.com) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tfek2-00000003Fdm-1QLb for linux-arm-kernel@lists.infradead.org; Wed, 05 Feb 2025 12:42:55 +0000 X-CSE-ConnectionGUID: qJDgGzujQ7SrbqbP/MsImQ== X-CSE-MsgGUID: Pn+2gzssSaqklt7ImdEg4g== Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 05 Feb 2025 21:42:48 +0900 Received: from localhost.localdomain (unknown [10.226.92.225]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 9599F41F86AF; Wed, 5 Feb 2025 21:42:43 +0900 (JST) From: Biju Das To: Rob Herring , Saravana Kannan , Matthias Brugger , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Andrew Lunn , AngeloGioacchino Del Regno Cc: Biju Das , devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org, Geert Uytterhoeven , Prabhakar Mahadev Lad , Biju Das , linux-renesas-soc@vger.kernel.org Subject: [PATCH net-next v2 1/7] of: base: Add of_get_available_child_by_name() Date: Wed, 5 Feb 2025 12:42:21 +0000 Message-ID: <20250205124235.53285-2-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250205124235.53285-1-biju.das.jz@bp.renesas.com> References: <20250205124235.53285-1-biju.das.jz@bp.renesas.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250205_044254_547430_8A99E8F0 X-CRM114-Status: GOOD ( 11.22 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org There are lot of drivers using of_get_child_by_name() followed by of_device_is_available() to find the available child node by name for a given parent. Provide a helper for these users to simplify the code. Suggested-by: Geert Uytterhoeven Reviewed-by: Rob Herring Signed-off-by: Biju Das --- previous v2->v2 * Added Rb tag from Rob. v1->previous v2: * Updated commit description. * Updated kerneldoc comment block * Avoided code duplication by using of_get_child_by_name(). --- drivers/of/base.c | 27 +++++++++++++++++++++++++++ include/linux/of.h | 9 +++++++++ 2 files changed, 36 insertions(+) diff --git a/drivers/of/base.c b/drivers/of/base.c index af6c68bbb427..e37b088f1fad 100644 --- a/drivers/of/base.c +++ b/drivers/of/base.c @@ -824,6 +824,33 @@ struct device_node *of_get_child_by_name(const struct device_node *node, } EXPORT_SYMBOL(of_get_child_by_name); +/** + * of_get_available_child_by_name - Find the available child node by name for a given parent + * @node: parent node + * @name: child name to look for. + * + * This function looks for child node for given matching name and checks the + * device's availability for use. + * + * Return: A node pointer if found, with refcount incremented, use + * of_node_put() on it when done. + * Returns NULL if node is not found. + */ +struct device_node *of_get_available_child_by_name(const struct device_node *node, + const char *name) +{ + struct device_node *child; + + child = of_get_child_by_name(node, name); + if (child && !of_device_is_available(child)) { + of_node_put(child); + return NULL; + } + + return child; +} +EXPORT_SYMBOL(of_get_available_child_by_name); + struct device_node *__of_find_node_by_path(const struct device_node *parent, const char *path) { diff --git a/include/linux/of.h b/include/linux/of.h index eaf0e2a2b75c..9d6b8a61607f 100644 --- a/include/linux/of.h +++ b/include/linux/of.h @@ -301,6 +301,8 @@ extern struct device_node *of_get_compatible_child(const struct device_node *par const char *compatible); extern struct device_node *of_get_child_by_name(const struct device_node *node, const char *name); +extern struct device_node *of_get_available_child_by_name(const struct device_node *node, + const char *name); /* cache lookup */ extern struct device_node *of_find_next_cache_node(const struct device_node *); @@ -578,6 +580,13 @@ static inline struct device_node *of_get_child_by_name( return NULL; } +static inline struct device_node *of_get_available_child_by_name( + const struct device_node *node, + const char *name) +{ + return NULL; +} + static inline int of_device_is_compatible(const struct device_node *device, const char *name) { From patchwork Wed Feb 5 12:42:24 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Biju Das X-Patchwork-Id: 13960939 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 00679C02192 for ; Wed, 5 Feb 2025 12:47:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=TSKKiDf9lV2pLaZCxyIkP363VASdX2bT57ifNm/GbSY=; b=AR2tMOJuENT/iALorAypXz/P7X dXsRyK8egYhJtJn0dsoIFs4S/LMLTPuQY7ozFQrXjKFzx04kE205rSXV+smaV+xiyBDzeAdsOSSof wGIrRK9oIx4yeXN231aG4k6lrpWw3iZ5NGcPbVrGNv9Q5tcTp3OtPwydZ3YIJurHdACxJjpnwf6SB 2fV1OnltshjvhPfXFhvB9eLoqClzLc8LUaoK71BpW0bV73FDKXE9Ph/kOF6eXqti1AmwgngFAcb8y T5jnmUQ7PECwKj3yFJbzhmpa1Kr6WbG/EY7hKcB37Wi8IP3Nx0/AFwoMdcALptP6mpmhNp1XmEpkO EDb77Lsw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tfeo7-00000003Gt0-23Mv; Wed, 05 Feb 2025 12:47:07 +0000 Received: from relmlor1.renesas.com ([210.160.252.171] helo=relmlie5.idc.renesas.com) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tfekB-00000003Fgi-0LDp; Wed, 05 Feb 2025 12:43:04 +0000 X-CSE-ConnectionGUID: KTNcS2wNQMaUlothZ7KZaQ== X-CSE-MsgGUID: zctjB0xES0S1VXpVZgYMxQ== Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 05 Feb 2025 21:43:02 +0900 Received: from localhost.localdomain (unknown [10.226.92.225]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 45B7241F86AB; Wed, 5 Feb 2025 21:42:56 +0900 (JST) From: Biju Das To: Felix Fietkau , Sean Wang , Lorenzo Bianconi , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno Cc: Biju Das , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Geert Uytterhoeven , Biju Das Subject: [PATCH net-next v2 4/7] net: ethernet: mtk-star-emac: Use of_get_available_child_by_name() Date: Wed, 5 Feb 2025 12:42:24 +0000 Message-ID: <20250205124235.53285-5-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250205124235.53285-1-biju.das.jz@bp.renesas.com> References: <20250205124235.53285-1-biju.das.jz@bp.renesas.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250205_044303_232030_960402A4 X-CRM114-Status: UNSURE ( 8.52 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use the helper of_get_available_child_by_name() to simplify mtk_star_mdio_init(). Signed-off-by: Biju Das --- v1->v2: * Dropped using _free() --- drivers/net/ethernet/mediatek/mtk_star_emac.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/net/ethernet/mediatek/mtk_star_emac.c b/drivers/net/ethernet/mediatek/mtk_star_emac.c index 25989c79c92e..76f202d7f055 100644 --- a/drivers/net/ethernet/mediatek/mtk_star_emac.c +++ b/drivers/net/ethernet/mediatek/mtk_star_emac.c @@ -1427,15 +1427,10 @@ static int mtk_star_mdio_init(struct net_device *ndev) of_node = dev->of_node; - mdio_node = of_get_child_by_name(of_node, "mdio"); + mdio_node = of_get_available_child_by_name(of_node, "mdio"); if (!mdio_node) return -ENODEV; - if (!of_device_is_available(mdio_node)) { - ret = -ENODEV; - goto out_put_node; - } - priv->mii = devm_mdiobus_alloc(dev); if (!priv->mii) { ret = -ENOMEM; From patchwork Wed Feb 5 12:42:25 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Biju Das X-Patchwork-Id: 13960943 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 71CFDC02192 for ; Wed, 5 Feb 2025 12:50:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=lbSs2LOWzdNenXX0oELvI/bNNE458C+NZ9lgVj5hXDQ=; b=2V/9dJ4lNCRoN+iVy8Mm+CxBoJ bgr8AhBvnJPBG/+51Mm2uD12ffeJUzxW289yiC9E3H/rnCrkHI9tajJwBVTOfh1mWR7qjBuc70lKG OlXFdxTzGY22LSUCDEyVHJ/52s6iqGSUolUybyp0q6cNZeiZoT9IyPvns3S97cIuVH+ZyX81iTUoM Jd4EPTFe/2Ka28fJEzBTl3MkQHtFtJ4sgzaLFWoWXqoKnEu33hSKomqQ4IZDZiGveNcSzxH3qt7q0 27bWMWaebNB6LyNTLEFVAibiZV7dlhWeCOsJk/d4gVcK76BQwUGCWpPSjgwOCy0Fyn6idmY5VegGq lbAwHP9Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tfeqq-00000003HM2-0BjM; Wed, 05 Feb 2025 12:49:56 +0000 Received: from relmlor1.renesas.com ([210.160.252.171] helo=relmlie5.idc.renesas.com) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tfekM-00000003FjP-1KV5; Wed, 05 Feb 2025 12:43:15 +0000 X-CSE-ConnectionGUID: kZEjbmkXQmKuWVWpCE4ldQ== X-CSE-MsgGUID: heLXhqTjSwWnRtR0B4PM8w== Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 05 Feb 2025 21:43:13 +0900 Received: from localhost.localdomain (unknown [10.226.92.225]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id AC44F41F86B5; Wed, 5 Feb 2025 21:43:02 +0900 (JST) From: Biju Das To: Felix Fietkau , Sean Wang , Lorenzo Bianconi , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno Cc: Biju Das , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Geert Uytterhoeven , Biju Das Subject: [PATCH net-next v2 5/7] net: ethernet: mtk_eth_soc: Use of_get_available_child_by_name() Date: Wed, 5 Feb 2025 12:42:25 +0000 Message-ID: <20250205124235.53285-6-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250205124235.53285-1-biju.das.jz@bp.renesas.com> References: <20250205124235.53285-1-biju.das.jz@bp.renesas.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250205_044314_464330_98C9F0C7 X-CRM114-Status: UNSURE ( 8.73 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use the helper of_get_available_child_by_name() to simplify mtk_mdio_init(). Signed-off-by: Biju Das --- v1->v2: * Dropped using _free(). --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c index 53485142938c..0ad965ced5ef 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c @@ -830,17 +830,12 @@ static int mtk_mdio_init(struct mtk_eth *eth) int ret; u32 val; - mii_np = of_get_child_by_name(eth->dev->of_node, "mdio-bus"); + mii_np = of_get_available_child_by_name(eth->dev->of_node, "mdio-bus"); if (!mii_np) { dev_err(eth->dev, "no %s child node found", "mdio-bus"); return -ENODEV; } - if (!of_device_is_available(mii_np)) { - ret = -ENODEV; - goto err_put_node; - } - eth->mii_bus = devm_mdiobus_alloc(eth->dev); if (!eth->mii_bus) { ret = -ENOMEM; From patchwork Wed Feb 5 12:42:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Biju Das X-Patchwork-Id: 13960940 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C9E8CC02192 for ; Wed, 5 Feb 2025 12:48:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=T9supdkQCm8FYkhwurAhujvgrSF6y4N6SMnERr+tIZQ=; b=cXy4dFvzeUZHFaARTt1nrTkgkt bMpAo2bu28vU09smvU/RGlhA3nOD4GM2tCkRfPAAghDKHV2EBqaR3zGCoGNSyktfESJcuNGZN3NcP FFj4e8FPnf/1sAwpYeWsil2eTmjHpsABR84TC4mk1XTfgLWrzF4nBQ/k8Hmgf9Ag2rEPLY3eAJ6NR /+v/MbadYreDdhclTtZrLc1NJsMoilIR7EPIA/rOfH4M/X3aKSb9nlm3t45YQZ+Vko/CZc9dhws3G V3edDK5vwA8Z6cEcdbqzmfaGeXLsGIKC368HJ8hBm1rJ3HUOlsoJ6YcmkSH00KxG8CSh4UjEbzXl0 i3RVEjGg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tfepU-00000003HAb-420Q; Wed, 05 Feb 2025 12:48:32 +0000 Received: from relmlor1.renesas.com ([210.160.252.171] helo=relmlie5.idc.renesas.com) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1tfekK-00000003FjP-2ppG; Wed, 05 Feb 2025 12:43:13 +0000 X-CSE-ConnectionGUID: ceBcTh8kQCW+CZ/WKhC9Yg== X-CSE-MsgGUID: TpZdVZhQTc2TjjwYpYPbgw== Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 05 Feb 2025 21:43:11 +0900 Received: from localhost.localdomain (unknown [10.226.92.225]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id DF36D41F86AF; Wed, 5 Feb 2025 21:43:07 +0900 (JST) From: Biju Das To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , =?utf-8?q?Andreas_F=C3=A4rber?= , Manivannan Sadhasivam Cc: Biju Das , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-actions@lists.infradead.org, Geert Uytterhoeven , Biju Das Subject: [PATCH net-next v2 6/7] net: ethernet: actions: Use of_get_available_child_by_name() Date: Wed, 5 Feb 2025 12:42:26 +0000 Message-ID: <20250205124235.53285-7-biju.das.jz@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250205124235.53285-1-biju.das.jz@bp.renesas.com> References: <20250205124235.53285-1-biju.das.jz@bp.renesas.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250205_044312_851988_A27E017E X-CRM114-Status: UNSURE ( 8.00 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Use the helper of_get_available_child_by_name() to simplify owl_emac_mdio_init(). Signed-off-by: Biju Das --- previous v2->v2: * Dropped using _free(). v1-> previous v2: * Dropped duplicate mdio_node declaration. --- drivers/net/ethernet/actions/owl-emac.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/drivers/net/ethernet/actions/owl-emac.c b/drivers/net/ethernet/actions/owl-emac.c index 115f48b3342c..0a08da799255 100644 --- a/drivers/net/ethernet/actions/owl-emac.c +++ b/drivers/net/ethernet/actions/owl-emac.c @@ -1325,15 +1325,10 @@ static int owl_emac_mdio_init(struct net_device *netdev) struct device_node *mdio_node; int ret; - mdio_node = of_get_child_by_name(dev->of_node, "mdio"); + mdio_node = of_get_available_child_by_name(dev->of_node, "mdio"); if (!mdio_node) return -ENODEV; - if (!of_device_is_available(mdio_node)) { - ret = -ENODEV; - goto err_put_node; - } - priv->mii = devm_mdiobus_alloc(dev); if (!priv->mii) { ret = -ENOMEM;