From patchwork Thu Aug 29 06:31:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinjie Ruan X-Patchwork-Id: 13782614 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 34B18C77B7A for ; Thu, 29 Aug 2024 06:26:58 +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-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=n1BiLRo57Cugyqdp8Dthg6Bt4AzlYY5qQunV9xgqSxg=; b=eqs7tGmIX8JErJ6HhDihCkFeK5 qlv0kiCO5V1vE3NgSIhChrX86U4DWFiicTf71AyBqv/clehpFYyO0DxUlHyEWMdSIj8njQU8idv3n /Z2KfhZzWLad5A1k3Bls3FNid1QKwQUtyOqLnhEMNtulOikl+or60+6nlWMN/BM8GVQv6H3zN72Gm 5MIz3G7AyMx1c4P6KMOJWZnUXsVg0WnOkDyF64Bu5WlUFGejzi4zmSx3PPt5yZuFqY7M063O8/3IR 2qEWaB6XvQplsF5EwNtgEqQBm6qTUZI1y1je0Z2dsmR/YFaaT15rEf/xhqTDuzB24HHMSeZLVJ1OS pk5ZJ8hw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjYcL-00000000lEq-1Aih; Thu, 29 Aug 2024 06:26:49 +0000 Received: from szxga01-in.huawei.com ([45.249.212.187]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjYZ4-00000000kIh-2KOj for linux-arm-kernel@lists.infradead.org; Thu, 29 Aug 2024 06:23:28 +0000 Received: from mail.maildlp.com (unknown [172.19.163.48]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4WvWR94vfszyQTH; Thu, 29 Aug 2024 14:22:29 +0800 (CST) Received: from kwepemh500013.china.huawei.com (unknown [7.202.181.146]) by mail.maildlp.com (Postfix) with ESMTPS id 35D2618007C; Thu, 29 Aug 2024 14:23:19 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemh500013.china.huawei.com (7.202.181.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 29 Aug 2024 14:23:18 +0800 From: Jinjie Ruan To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , CC: Subject: [PATCH net-next v3 01/13] net: stmmac: dwmac-sun8i: Use for_each_child_of_node_scoped() Date: Thu, 29 Aug 2024 14:31:06 +0800 Message-ID: <20240829063118.67453-2-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240829063118.67453-1-ruanjinjie@huawei.com> References: <20240829063118.67453-1-ruanjinjie@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemh500013.china.huawei.com (7.202.181.146) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240828_232326_873138_B95DF782 X-CRM114-Status: GOOD ( 11.23 ) 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 Avoid need to manually handle of_node_put() by using for_each_child_of_node_scoped(), which can simplfy code. Signed-off-by: Jinjie Ruan Reviewed-by: Jonathan Cameron Reviewed-by: Andrew Lunn --- v3: - Sort the variables, longest first, shortest last - Add Reviewed-by. --- drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c index cc93f73a380e..4a0ae92b3055 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c @@ -774,8 +774,8 @@ static int sun8i_dwmac_reset(struct stmmac_priv *priv) static int get_ephy_nodes(struct stmmac_priv *priv) { struct sunxi_priv_data *gmac = priv->plat->bsp_priv; - struct device_node *mdio_mux, *iphynode; struct device_node *mdio_internal; + struct device_node *mdio_mux; int ret; mdio_mux = of_get_child_by_name(priv->device->of_node, "mdio-mux"); @@ -793,7 +793,7 @@ static int get_ephy_nodes(struct stmmac_priv *priv) } /* Seek for internal PHY */ - for_each_child_of_node(mdio_internal, iphynode) { + for_each_child_of_node_scoped(mdio_internal, iphynode) { gmac->ephy_clk = of_clk_get(iphynode, 0); if (IS_ERR(gmac->ephy_clk)) continue; @@ -801,14 +801,12 @@ static int get_ephy_nodes(struct stmmac_priv *priv) if (IS_ERR(gmac->rst_ephy)) { ret = PTR_ERR(gmac->rst_ephy); if (ret == -EPROBE_DEFER) { - of_node_put(iphynode); of_node_put(mdio_internal); return ret; } continue; } dev_info(priv->device, "Found internal PHY node\n"); - of_node_put(iphynode); of_node_put(mdio_internal); return 0; } From patchwork Thu Aug 29 06:31:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinjie Ruan X-Patchwork-Id: 13782611 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 7F7AEC761AE for ; Thu, 29 Aug 2024 06:24:31 +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-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=4BXp3ZNVqwHqOi1AB8iwZFvdTYGhR7qcbAW+YvQG0dI=; b=Cdmkb8KWRQM6TAykpbcKEXJR8u DCkdxtpBvfcguRFqgzpgETrVpfd76HeXhEwDOPJnKVOoqRWJ/yh8xxyTsk1xRuIQ4/OqqZrx4Z6TU 3Onqk+BPw7sYKRLYWcuD/OEzV2BKbapwXsJku2JZ8tXAnl0ewW42ZM8zDRVvsdmGVA2qjJVn9gW6M IEVm495BMVuK69LKIGIxeG8NECurCJBj34zJw/tJfe6AZmgLSVlWorxiq7Oz32x0xtExq3kJkp5hm UUWC1IZn7qmvfNhsXe9OS7OYCjPQB5cTbSry6okj6yTfaStgh0Wt8fT+uoGIefpIxQm82z8bKNrKX uOj6CpdA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjYZv-00000000kYf-03z1; Thu, 29 Aug 2024 06:24:19 +0000 Received: from szxga03-in.huawei.com ([45.249.212.189]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjYZ2-00000000kIH-2Z4S for linux-arm-kernel@lists.infradead.org; Thu, 29 Aug 2024 06:23:27 +0000 Received: from mail.maildlp.com (unknown [172.19.88.194]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4WvWLY31HTzQr3x; Thu, 29 Aug 2024 14:18:29 +0800 (CST) Received: from kwepemh500013.china.huawei.com (unknown [7.202.181.146]) by mail.maildlp.com (Postfix) with ESMTPS id 182D514035F; Thu, 29 Aug 2024 14:23:20 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemh500013.china.huawei.com (7.202.181.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 29 Aug 2024 14:23:19 +0800 From: Jinjie Ruan To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , CC: Subject: [PATCH net-next v3 02/13] net: stmmac: dwmac-sun8i: Use __free() to simplify code Date: Thu, 29 Aug 2024 14:31:07 +0800 Message-ID: <20240829063118.67453-3-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240829063118.67453-1-ruanjinjie@huawei.com> References: <20240829063118.67453-1-ruanjinjie@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemh500013.china.huawei.com (7.202.181.146) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240828_232325_213452_2259969F X-CRM114-Status: GOOD ( 10.80 ) 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 Avoid need to manually handle of_node_put() by using __free(), which can simplfy code. Signed-off-by: Jinjie Ruan Reviewed-by: Jonathan Cameron --- v3: - Add Reviewed-by. --- .../net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c index 4a0ae92b3055..415a0d23b3a5 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c @@ -774,19 +774,17 @@ static int sun8i_dwmac_reset(struct stmmac_priv *priv) static int get_ephy_nodes(struct stmmac_priv *priv) { struct sunxi_priv_data *gmac = priv->plat->bsp_priv; - struct device_node *mdio_internal; - struct device_node *mdio_mux; int ret; - mdio_mux = of_get_child_by_name(priv->device->of_node, "mdio-mux"); + struct device_node *mdio_mux __free(device_node) = + of_get_child_by_name(priv->device->of_node, "mdio-mux"); if (!mdio_mux) { dev_err(priv->device, "Cannot get mdio-mux node\n"); return -ENODEV; } - mdio_internal = of_get_compatible_child(mdio_mux, - "allwinner,sun8i-h3-mdio-internal"); - of_node_put(mdio_mux); + struct device_node *mdio_internal __free(device_node) = + of_get_compatible_child(mdio_mux, "allwinner,sun8i-h3-mdio-internal"); if (!mdio_internal) { dev_err(priv->device, "Cannot get internal_mdio node\n"); return -ENODEV; @@ -800,18 +798,14 @@ static int get_ephy_nodes(struct stmmac_priv *priv) gmac->rst_ephy = of_reset_control_get_exclusive(iphynode, NULL); if (IS_ERR(gmac->rst_ephy)) { ret = PTR_ERR(gmac->rst_ephy); - if (ret == -EPROBE_DEFER) { - of_node_put(mdio_internal); + if (ret == -EPROBE_DEFER) return ret; - } continue; } dev_info(priv->device, "Found internal PHY node\n"); - of_node_put(mdio_internal); return 0; } - of_node_put(mdio_internal); return -ENODEV; } From patchwork Thu Aug 29 06:31:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinjie Ruan X-Patchwork-Id: 13782617 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 596C4C77B7A for ; Thu, 29 Aug 2024 06:28:38 +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-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=vxrjcGmbMLHzK+0Fpnh46Dy9ol8ahQWP+p9EkxcEOEw=; b=nr1LfguAYUxjDPNAB1jpjbKPWA 22+fFSfLd1vJ4/JZpY0Oc5KrzGDAuoTIif89eZnLv5woEaSXD1fEWthgSvOXymmCcpHjY5P7Ul5d5 6AoVL/eJOPlEZBwj+iBJHpXGDL4wSJcwgxUgyCyeyqFXCcEMJVVtnNkJZ/T9xDeNLpTkdCtmU4dTD nclalaziS57e87Bc0/xI69kme5p54vryOYG6yvUQ2Ziv2/l3Cv9aNjgtlcTUgAECZIEGOqeOmVnDD QeK9ibr71hh7hvmmH+lwn4uT9fHPcwqgKY42P7Q1n1JvUYrwPoKtDDhuRrg6K0wRKh0SCo3R51v6B sI8KDkQw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjYdx-00000000m6g-2xwO; Thu, 29 Aug 2024 06:28:29 +0000 Received: from szxga01-in.huawei.com ([45.249.212.187]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjYZ6-00000000kIZ-4BZd for linux-arm-kernel@lists.infradead.org; Thu, 29 Aug 2024 06:23:31 +0000 Received: from mail.maildlp.com (unknown [172.19.88.194]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4WvWRY5FRCzyR3l; Thu, 29 Aug 2024 14:22:49 +0800 (CST) Received: from kwepemh500013.china.huawei.com (unknown [7.202.181.146]) by mail.maildlp.com (Postfix) with ESMTPS id EEE6214035F; Thu, 29 Aug 2024 14:23:20 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemh500013.china.huawei.com (7.202.181.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 29 Aug 2024 14:23:19 +0800 From: Jinjie Ruan To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , CC: Subject: [PATCH net-next v3 03/13] net: dsa: realtek: Use for_each_child_of_node_scoped() Date: Thu, 29 Aug 2024 14:31:08 +0800 Message-ID: <20240829063118.67453-4-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240829063118.67453-1-ruanjinjie@huawei.com> References: <20240829063118.67453-1-ruanjinjie@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemh500013.china.huawei.com (7.202.181.146) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240828_232329_311722_94463EE3 X-CRM114-Status: GOOD ( 11.05 ) 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 Avoid need to manually handle of_node_put() by using for_each_child_of_node_scoped(), which can simplfy code. Signed-off-by: Jinjie Ruan Reviewed-by: Jonathan Cameron Reviewed-by: Andrew Lunn --- v3: - Sort the variables, longest first, shortest last - Add Reviewed-by. v2: - Split into 2 patches. --- drivers/net/dsa/realtek/rtl8366rb.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/net/dsa/realtek/rtl8366rb.c b/drivers/net/dsa/realtek/rtl8366rb.c index 9e821b42e5f3..11243f89c98a 100644 --- a/drivers/net/dsa/realtek/rtl8366rb.c +++ b/drivers/net/dsa/realtek/rtl8366rb.c @@ -1009,8 +1009,8 @@ static int rtl8366rb_setup_all_leds_off(struct realtek_priv *priv) static int rtl8366rb_setup_leds(struct realtek_priv *priv) { - struct device_node *leds_np, *led_np; struct dsa_switch *ds = &priv->ds; + struct device_node *leds_np; struct dsa_port *dp; int ret = 0; @@ -1025,13 +1025,11 @@ static int rtl8366rb_setup_leds(struct realtek_priv *priv) continue; } - for_each_child_of_node(leds_np, led_np) { + for_each_child_of_node_scoped(leds_np, led_np) { ret = rtl8366rb_setup_led(priv, dp, of_fwnode_handle(led_np)); - if (ret) { - of_node_put(led_np); + if (ret) break; - } } of_node_put(leds_np); From patchwork Thu Aug 29 06:31:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinjie Ruan X-Patchwork-Id: 13782615 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 9E53EC761AE for ; Thu, 29 Aug 2024 06:27:49 +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-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=o4oFNmxjylsJkAm/pCCtHwi0eyqVG5a526DG5WslaSs=; b=ec8JuAKB7XoDujQ+Zs9W/188mo Aw5PcDM6mLlH9kHy0AXrDc+DOnHGZiGG5xToXgDmaWGleL8Y4qeMrnlCcWDrnbC9P/J88EXj03208 Kjljg3ePGNOUAzV9iRW24IvCqhQXr4CJtio+jFWhsPuxbusBSEVjmVkYo3R7msznx4jaTO5vK8aZ6 OLch8EpoUP4RMoxF3Xo37sI8Dd2DbXVmJIJ0AoawFC19azeBYL+WU8E1NQJQK1JlR2gjlEvtwpoUj 8RCPbFqvsMpf8G8r4sMOhrtgBgHexPZ1A9TeBu7GTWDTHCKpGFGK2HzutMvINu74GPT20lCyRjcwG dGgVCAlw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjYd9-00000000lXf-1KfO; Thu, 29 Aug 2024 06:27:39 +0000 Received: from szxga07-in.huawei.com ([45.249.212.35]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjYZ6-00000000kIP-3x5B for linux-arm-kernel@lists.infradead.org; Thu, 29 Aug 2024 06:23:30 +0000 Received: from mail.maildlp.com (unknown [172.19.88.214]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4WvWRw6WYNz1S91W; Thu, 29 Aug 2024 14:23:08 +0800 (CST) Received: from kwepemh500013.china.huawei.com (unknown [7.202.181.146]) by mail.maildlp.com (Postfix) with ESMTPS id D4E591A016C; Thu, 29 Aug 2024 14:23:21 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemh500013.china.huawei.com (7.202.181.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 29 Aug 2024 14:23:20 +0800 From: Jinjie Ruan To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , CC: Subject: [PATCH net-next v3 04/13] net: dsa: realtek: Use __free() to simplify code Date: Thu, 29 Aug 2024 14:31:09 +0800 Message-ID: <20240829063118.67453-5-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240829063118.67453-1-ruanjinjie@huawei.com> References: <20240829063118.67453-1-ruanjinjie@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemh500013.china.huawei.com (7.202.181.146) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240828_232329_255739_F6F20947 X-CRM114-Status: GOOD ( 10.74 ) 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 Avoid need to manually handle of_node_put() by using __free(), which can simplfy code. Signed-off-by: Jinjie Ruan Suggested-by: Jonathan Cameron --- v3: - Move "return ret" up to the only place it can come from. - Use ret only in the loop. v2 - Split into 2 patches. --- drivers/net/dsa/realtek/rtl8366rb.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/net/dsa/realtek/rtl8366rb.c b/drivers/net/dsa/realtek/rtl8366rb.c index 11243f89c98a..31d2d5356c1e 100644 --- a/drivers/net/dsa/realtek/rtl8366rb.c +++ b/drivers/net/dsa/realtek/rtl8366rb.c @@ -1010,15 +1010,14 @@ static int rtl8366rb_setup_all_leds_off(struct realtek_priv *priv) static int rtl8366rb_setup_leds(struct realtek_priv *priv) { struct dsa_switch *ds = &priv->ds; - struct device_node *leds_np; struct dsa_port *dp; - int ret = 0; dsa_switch_for_each_port(dp, ds) { if (!dp->dn) continue; - leds_np = of_get_child_by_name(dp->dn, "leds"); + struct device_node *leds_np __free(device_node) = + of_get_child_by_name(dp->dn, "leds"); if (!leds_np) { dev_dbg(priv->dev, "No leds defined for port %d", dp->index); @@ -1026,15 +1025,11 @@ static int rtl8366rb_setup_leds(struct realtek_priv *priv) } for_each_child_of_node_scoped(leds_np, led_np) { - ret = rtl8366rb_setup_led(priv, dp, - of_fwnode_handle(led_np)); + int ret = rtl8366rb_setup_led(priv, dp, + of_fwnode_handle(led_np)); if (ret) - break; + return ret; } - - of_node_put(leds_np); - if (ret) - return ret; } return 0; } From patchwork Thu Aug 29 06:31:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinjie Ruan X-Patchwork-Id: 13782613 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 B13C2C77B7A for ; Thu, 29 Aug 2024 06:26:12 +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-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=KVD3x1HH1i7aogLsqUHQwaO1jqWWNrZ3INBjmoGvnWk=; b=Mpt5gmACkB8L/su4aTaWPxyRKh MEUxDKqNbPhPfQGWXcfeFpK+8ZCkAzBoXkzemHI0HKaUa8pVonFv0O5j6lf819SYVymsZ3KKAwdt0 tGZc0JFKnsHVsSQaXPm8EKaeGmtPoXpf9Jw+qX1FmiHTgSawom5gVQArKAZ41kvgL89S2I0K20zu8 9T18QFaVlouFCYQmK2AfGWd50h76P+m/1AzjA+8sfAqdsfXCT/isLErw/3H0oJVK/hm8F4K5Ov2PM 0NjljDaScozlE9uNs0RltnOoDOg7t1zI6k9w0xyTMI46mRfToNFwNtsizpAWezfJQRIQZHDujuZmb 1vge8kbw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjYbW-00000000l2m-3rLN; Thu, 29 Aug 2024 06:25:59 +0000 Received: from szxga07-in.huawei.com ([45.249.212.35]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjYZ4-00000000kIY-2Kby for linux-arm-kernel@lists.infradead.org; Thu, 29 Aug 2024 06:23:28 +0000 Received: from mail.maildlp.com (unknown [172.19.162.112]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4WvWRx5nchz1S9MX; Thu, 29 Aug 2024 14:23:09 +0800 (CST) Received: from kwepemh500013.china.huawei.com (unknown [7.202.181.146]) by mail.maildlp.com (Postfix) with ESMTPS id BAF64140153; Thu, 29 Aug 2024 14:23:22 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemh500013.china.huawei.com (7.202.181.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 29 Aug 2024 14:23:21 +0800 From: Jinjie Ruan To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , CC: Subject: [PATCH net-next v3 05/13] net: phy: Fix missing of_node_put() for leds Date: Thu, 29 Aug 2024 14:31:10 +0800 Message-ID: <20240829063118.67453-6-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240829063118.67453-1-ruanjinjie@huawei.com> References: <20240829063118.67453-1-ruanjinjie@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemh500013.china.huawei.com (7.202.181.146) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240828_232326_867097_2E1B5091 X-CRM114-Status: UNSURE ( 9.99 ) 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 The call of of_get_child_by_name() will cause refcount incremented for leds, if it succeeds, it should call of_node_put() to decrease it, fix it. Fixes: 01e5b728e9e4 ("net: phy: Add a binding for PHY LEDs") Signed-off-by: Jinjie Ruan Reviewed-by: Jonathan Cameron --- v3: - Add Reviewed-by. v2: - Split into 2 patches. - Use of_node_put() rather than __free() to fix it. --- drivers/net/phy/phy_device.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 8f5314c1fecc..243dae686992 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -3424,11 +3424,13 @@ static int of_phy_leds(struct phy_device *phydev) err = of_phy_led(phydev, led); if (err) { of_node_put(led); + of_node_put(leds); phy_leds_unregister(phydev); return err; } } + of_node_put(leds); return 0; } From patchwork Thu Aug 29 06:31:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinjie Ruan X-Patchwork-Id: 13782621 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 C53B8C761AE for ; Thu, 29 Aug 2024 06:33:16 +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-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=p8ZFcSH7iszJTAb+ZBllPoi9F7ZG+r2CeAohsK/WaoQ=; b=RuzQXlsVDSQISew6fhGgHbZ4vT wr9a0myQ4E+M+YF1tHPz/A+u/35u22yhKIGze4bhLMbRMStnJRUZLuV/DMrU/ZC23I+rp6VTC7QE/ CBN3aLqMlKZ1meeMcP18s43+zHU4kFdjWi3xEsDuLwrrxUqOtFfFvpb4zgic+40wFOKvaUl0e/9MM rZJCkonTn8HCbQeFVh1/s6syvRT5pPX1eM11auScw3giKnxnsuxI/ii6JeafwHkN5SQRXO7HcW4BA jEPZDn9KcyZ3Shn5RgAtdwjKZjBjn0jPqefJGjvP1q3AsMlflRu689QitE0zmWci8esj+HIzrp8XR 2FvEX1YQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjYiS-00000000nHr-1l3V; Thu, 29 Aug 2024 06:33:08 +0000 Received: from szxga02-in.huawei.com ([45.249.212.188]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjYZ7-00000000kIg-1jCj for linux-arm-kernel@lists.infradead.org; Thu, 29 Aug 2024 06:23:32 +0000 Received: from mail.maildlp.com (unknown [172.19.163.252]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4WvWPq2spszfbCX; Thu, 29 Aug 2024 14:21:19 +0800 (CST) Received: from kwepemh500013.china.huawei.com (unknown [7.202.181.146]) by mail.maildlp.com (Postfix) with ESMTPS id A76AA180AE6; Thu, 29 Aug 2024 14:23:23 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemh500013.china.huawei.com (7.202.181.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 29 Aug 2024 14:23:22 +0800 From: Jinjie Ruan To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , CC: Subject: [PATCH net-next v3 06/13] net: phy: Use for_each_available_child_of_node_scoped() Date: Thu, 29 Aug 2024 14:31:11 +0800 Message-ID: <20240829063118.67453-7-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240829063118.67453-1-ruanjinjie@huawei.com> References: <20240829063118.67453-1-ruanjinjie@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemh500013.china.huawei.com (7.202.181.146) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240828_232329_742164_63DC57BA X-CRM114-Status: UNSURE ( 9.88 ) 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 Avoid need to manually handle of_node_put() by using for_each_available_child_of_node_scoped(), which can simplfy code. Signed-off-by: Jinjie Ruan Reviewed-by: Jonathan Cameron Reviewed-by: Andrew Lunn --- v3: - Add Reviewed-by v2 - Split into 2 patches. --- drivers/net/phy/phy_device.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c index 243dae686992..560e338b307a 100644 --- a/drivers/net/phy/phy_device.c +++ b/drivers/net/phy/phy_device.c @@ -3407,7 +3407,7 @@ static int of_phy_led(struct phy_device *phydev, static int of_phy_leds(struct phy_device *phydev) { struct device_node *node = phydev->mdio.dev.of_node; - struct device_node *leds, *led; + struct device_node *leds; int err; if (!IS_ENABLED(CONFIG_OF_MDIO)) @@ -3420,10 +3420,9 @@ static int of_phy_leds(struct phy_device *phydev) if (!leds) return 0; - for_each_available_child_of_node(leds, led) { + for_each_available_child_of_node_scoped(leds, led) { err = of_phy_led(phydev, led); if (err) { - of_node_put(led); of_node_put(leds); phy_leds_unregister(phydev); return err; From patchwork Thu Aug 29 06:31:12 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinjie Ruan X-Patchwork-Id: 13782632 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 B4D9DC77B7C for ; Thu, 29 Aug 2024 06:34:56 +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-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=aH2ULuB7Upo4HWdSPt5DMqItIGo5SJ69x+KPggSRAuY=; b=o9HMWoErh2DykzVIK6iXLhF6DK q9tgk1ThJgjCwtvWvvnnAyIFtQkmyqSk+pwD1nYxhp9KEzrix4pPgiPb1ev/EjummHbWvq+aqA8sZ BbywMbSVzmDHddJ9xUNklArZ8+E35KTUvp+LhMnQmOugL+0HwGdUd/RONIlkTdaN0StgfO6lTSci7 dz1wtZPjt9cgZE6jLST6NYZUdKjBMGn18RRsWbR5/0/T8GfXPkHCqvfZf87LXg+PGwePb0osWnHwN ydc2VcjO8IX2wAlrhdfonTaU0PDnTv6lhQk6+GTM6kNTOOMKu5mHfs9TQa8U28Grga+fX/LYwBeuZ wSkXB2QA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjYk3-00000000naT-3WxY; Thu, 29 Aug 2024 06:34:47 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjYZU-00000000kQe-1Q35 for linux-arm-kernel@bombadil.infradead.org; Thu, 29 Aug 2024 06:23:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:Content-Transfer-Encoding :MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From: Sender:Reply-To:Content-ID:Content-Description; bh=aH2ULuB7Upo4HWdSPt5DMqItIGo5SJ69x+KPggSRAuY=; b=VLCHX2X1X8mpXTBO8CUyk2xJ1L +ZhJgOfd8N4poVnTaB5r0jvTtUtQ/1RGfYf80Va53yBVpFpy3OHIv6z3P2vR552Tb87YLDD5WFgnv s3aei8xvJkyBQDUU4Bq5IDGRD4PpiuafALTUMMHRehZLalMbAJggcQGGz1B4sqQABCoWJnbLXxcrm bWfFhkQNhpYYbpB2+pjdKRQyATfJ34fKubZVsx8xaMwMNwXs+iNY1QrWau1gBhOyGo1G8UlSq/A+6 3j5wFytx2YohTv07Zl1YacJa5Pn0nOoyhpr1rTOTECMwKEDO+qkMWyXTMkPwFt1brZDnxU+IhuMkf tDl5HUMg==; Received: from szxga07-in.huawei.com ([45.249.212.35]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjYZP-0000000BMwf-2Um2 for linux-arm-kernel@lists.infradead.org; Thu, 29 Aug 2024 06:23:51 +0000 Received: from mail.maildlp.com (unknown [172.19.88.163]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4WvWS00lfHz1S9CT; Thu, 29 Aug 2024 14:23:12 +0800 (CST) Received: from kwepemh500013.china.huawei.com (unknown [7.202.181.146]) by mail.maildlp.com (Postfix) with ESMTPS id 0DEBF180019; Thu, 29 Aug 2024 14:23:25 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemh500013.china.huawei.com (7.202.181.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 29 Aug 2024 14:23:23 +0800 From: Jinjie Ruan To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , CC: Subject: [PATCH net-next v3 07/13] net: mdio: mux-mmioreg: Simplified with scoped function Date: Thu, 29 Aug 2024 14:31:12 +0800 Message-ID: <20240829063118.67453-8-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240829063118.67453-1-ruanjinjie@huawei.com> References: <20240829063118.67453-1-ruanjinjie@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemh500013.china.huawei.com (7.202.181.146) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240829_072348_328373_200A20A9 X-CRM114-Status: GOOD ( 11.00 ) 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 Avoids the need for manual cleanup of_node_put() in early exits from the loop by using for_each_available_child_of_node_scoped(). Signed-off-by: Jinjie Ruan Reviewed-by: Jonathan Cameron Reviewed-by: Andrew Lunn --- v3: - Add Reviewed-by. v2: - Split into 2 patches. --- drivers/net/mdio/mdio-mux-mmioreg.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/mdio/mdio-mux-mmioreg.c b/drivers/net/mdio/mdio-mux-mmioreg.c index de08419d0c98..4d87e61fec7b 100644 --- a/drivers/net/mdio/mdio-mux-mmioreg.c +++ b/drivers/net/mdio/mdio-mux-mmioreg.c @@ -96,7 +96,7 @@ static int mdio_mux_mmioreg_switch_fn(int current_child, int desired_child, static int mdio_mux_mmioreg_probe(struct platform_device *pdev) { - struct device_node *np2, *np = pdev->dev.of_node; + struct device_node *np = pdev->dev.of_node; struct mdio_mux_mmioreg_state *s; struct resource res; const __be32 *iprop; @@ -139,20 +139,18 @@ static int mdio_mux_mmioreg_probe(struct platform_device *pdev) * Verify that the 'reg' property of each child MDIO bus does not * set any bits outside of the 'mask'. */ - for_each_available_child_of_node(np, np2) { + for_each_available_child_of_node_scoped(np, np2) { u64 reg; if (of_property_read_reg(np2, 0, ®, NULL)) { dev_err(&pdev->dev, "mdio-mux child node %pOF is " "missing a 'reg' property\n", np2); - of_node_put(np2); return -ENODEV; } if ((u32)reg & ~s->mask) { dev_err(&pdev->dev, "mdio-mux child node %pOF has " "a 'reg' value with unmasked bits\n", np2); - of_node_put(np2); return -ENODEV; } } From patchwork Thu Aug 29 06:31:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinjie Ruan X-Patchwork-Id: 13782618 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 A1E0CC77B7A for ; Thu, 29 Aug 2024 06:30:28 +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-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=jiFVOHoAGwW86KO1x+iva4knoBbfNvnXpnwuo/nqRO0=; b=Db+pn8ajtPnxbpM+0vujZOyUYQ WwJLLQmI2vAWZUW/6/Y+8EcOzLW5mN63B3XRgpDyjVUFYFAc5mdUbxeyjzQ5BzUR8gUuI2dr18X8p CkCpPrCQvwC9mKX8zoOPv9Qj8mjA7YEGd/yuijkJhzU6AED+2kYQSm8U1XkkPw+WoPWWi496VT6sw JvjSmxMAJlXOtV3C3ofJsajIGo6x0XUsLIbSDJcgP9vHOlLJLI+gQ3ZWhfn9JdUqbvSrA1riROA1z Ww7YN5m+Bgsv3obJW+vuMrjjf5BRqfAbKAmCrMBAPFTiXREkkEyUrCt1mtiJ4ygOPjZ4T6RCPn0+7 zSPfkW4Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjYfh-00000000maU-1D9d; Thu, 29 Aug 2024 06:30:17 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjYZU-00000000kQf-1TCy for linux-arm-kernel@bombadil.infradead.org; Thu, 29 Aug 2024 06:23:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:Content-Transfer-Encoding :MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From: Sender:Reply-To:Content-ID:Content-Description; bh=jiFVOHoAGwW86KO1x+iva4knoBbfNvnXpnwuo/nqRO0=; b=fxprbgWjn3bbauwxm+QW7N++Yx jQD3+d43hb+/XU3sfMh01+8b8MY0bXUOs9HV0SZ5fJTT++v3+mk4rsZGCTOu1cvKKNxRcqLPvgyw0 +4e6xSo2bQl2oCV78mP6GZgJAjrpDa82j+JV+XbgsopBqWlyM+mPULXXjCIyYVhu8c9CeDvVr43qd OEe40q/PNKSA756onAYzKuQvrvH4Bjvx0fUI6mE4KQ8ZvgM0oYufjI/GKACf+llOhQtRdTYnwiw02 X83Xp+t3dxTeJyg4G3g3L5ZaSzbUTZ36kB2yd16Adm+xZ7eebFmNyLcz39GNJJjLzYc2Yu17HIN7Y B5n9mBsg==; Received: from szxga02-in.huawei.com ([45.249.212.188]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjYZQ-0000000BMwe-0m4o for linux-arm-kernel@lists.infradead.org; Thu, 29 Aug 2024 06:23:51 +0000 Received: from mail.maildlp.com (unknown [172.19.163.48]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4WvWPs1Db0zfZTJ; Thu, 29 Aug 2024 14:21:21 +0800 (CST) Received: from kwepemh500013.china.huawei.com (unknown [7.202.181.146]) by mail.maildlp.com (Postfix) with ESMTPS id 6FF5918007C; Thu, 29 Aug 2024 14:23:25 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemh500013.china.huawei.com (7.202.181.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 29 Aug 2024 14:23:24 +0800 From: Jinjie Ruan To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , CC: Subject: [PATCH net-next v3 08/13] net: mdio: mux-mmioreg: Simplified with dev_err_probe() Date: Thu, 29 Aug 2024 14:31:13 +0800 Message-ID: <20240829063118.67453-9-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240829063118.67453-1-ruanjinjie@huawei.com> References: <20240829063118.67453-1-ruanjinjie@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemh500013.china.huawei.com (7.202.181.146) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240829_072349_364973_3EA7D67B X-CRM114-Status: GOOD ( 11.45 ) 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 dev_err_probe() helper to simplify code. Signed-off-by: Jinjie Ruan Reviewed-by: Jonathan Cameron --- v3: - Add Reviewed-by. v2: - Split into 2 patches. --- drivers/net/mdio/mdio-mux-mmioreg.c | 45 ++++++++++++----------------- 1 file changed, 19 insertions(+), 26 deletions(-) diff --git a/drivers/net/mdio/mdio-mux-mmioreg.c b/drivers/net/mdio/mdio-mux-mmioreg.c index 4d87e61fec7b..08c484ccdcbe 100644 --- a/drivers/net/mdio/mdio-mux-mmioreg.c +++ b/drivers/net/mdio/mdio-mux-mmioreg.c @@ -109,30 +109,26 @@ static int mdio_mux_mmioreg_probe(struct platform_device *pdev) return -ENOMEM; ret = of_address_to_resource(np, 0, &res); - if (ret) { - dev_err(&pdev->dev, "could not obtain memory map for node %pOF\n", - np); - return ret; - } + if (ret) + return dev_err_probe(&pdev->dev, ret, + "could not obtain memory map for node %pOF\n", np); s->phys = res.start; s->iosize = resource_size(&res); if (s->iosize != sizeof(uint8_t) && s->iosize != sizeof(uint16_t) && s->iosize != sizeof(uint32_t)) { - dev_err(&pdev->dev, "only 8/16/32-bit registers are supported\n"); - return -EINVAL; + return dev_err_probe(&pdev->dev, -EINVAL, + "only 8/16/32-bit registers are supported\n"); } iprop = of_get_property(np, "mux-mask", &len); - if (!iprop || len != sizeof(uint32_t)) { - dev_err(&pdev->dev, "missing or invalid mux-mask property\n"); - return -ENODEV; - } - if (be32_to_cpup(iprop) >= BIT(s->iosize * 8)) { - dev_err(&pdev->dev, "only 8/16/32-bit registers are supported\n"); - return -EINVAL; - } + if (!iprop || len != sizeof(uint32_t)) + return dev_err_probe(&pdev->dev, -ENODEV, + "missing or invalid mux-mask property\n"); + if (be32_to_cpup(iprop) >= BIT(s->iosize * 8)) + return dev_err_probe(&pdev->dev, -EINVAL, + "only 8/16/32-bit registers are supported\n"); s->mask = be32_to_cpup(iprop); /* @@ -142,17 +138,14 @@ static int mdio_mux_mmioreg_probe(struct platform_device *pdev) for_each_available_child_of_node_scoped(np, np2) { u64 reg; - if (of_property_read_reg(np2, 0, ®, NULL)) { - dev_err(&pdev->dev, "mdio-mux child node %pOF is " - "missing a 'reg' property\n", np2); - return -ENODEV; - } - if ((u32)reg & ~s->mask) { - dev_err(&pdev->dev, "mdio-mux child node %pOF has " - "a 'reg' value with unmasked bits\n", - np2); - return -ENODEV; - } + if (of_property_read_reg(np2, 0, ®, NULL)) + return dev_err_probe(&pdev->dev, -ENODEV, + "mdio-mux child node %pOF is missing a 'reg' property\n", + np2); + if ((u32)reg & ~s->mask) + return dev_err_probe(&pdev->dev, -ENODEV, + "mdio-mux child node %pOF has a 'reg' value with unmasked bits\n", + np2); } ret = mdio_mux_init(&pdev->dev, pdev->dev.of_node, From patchwork Thu Aug 29 06:31:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinjie Ruan X-Patchwork-Id: 13782633 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 2E4BBC761AE for ; Thu, 29 Aug 2024 06:35:46 +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-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=F7Lkp6jUlV9+5AFukLj66i9uRgf/gEi1o225o9vt+vI=; b=AH6KGlbrKOdPsx1Rsoqe9ml8IB AUE+m5TA8b2+V6Ki6FXE8P4SiW5ism3YBDKV/Km6oSZPVk87FIROsovraHwVfLwgXOi2MlInEmj+T ehIZhw34GBfQQAf48jXDkJMeraOu/cmK/Bshljwr1AOa6O65gWOBE5qnjW/Ym5bs8+ykbgSM2N2kt pNWW9xDlvFOlSnjW4bIjkA9uNHrdXU1WsburjKYh7/l9C5SZe58g55G72aHW13xVx/tzy5zyRf46r mOOIoQITh95/Fx52p/0r7SMGHrXYWMqkGn5erI2QR5OXEMIWrV2Akl6e2dekJvFYxILQdD3h713S7 Utsp412g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjYkq-00000000ngD-40hW; Thu, 29 Aug 2024 06:35:37 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjYbQ-00000000l1e-2OM6 for linux-arm-kernel@bombadil.infradead.org; Thu, 29 Aug 2024 06:25:52 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:Content-Transfer-Encoding :MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From: Sender:Reply-To:Content-ID:Content-Description; bh=F7Lkp6jUlV9+5AFukLj66i9uRgf/gEi1o225o9vt+vI=; b=nglZ5aVQMNnSZCzJWYxQXhprxR Wb4+yoVXCtBqR6rFgFxhLZ93/c4wkrsaO7XoPXOd0/bgOpSL4woptXtnLltosfz0C7VHxcJZdCTcM f4+dLb4uF3d27O1xvdiUxiP8mxLgK2JM39eyAVkFjCnZAQ1cbi2yz/n2dD/mnt8vV/3oZpfWx06WX L5EdPQaUIerG9vdcM7KSGJ/Chrlyd/rNxVEKs04PU4Ftw1XyDA1MADu40KVTojMKJ9t5rsd+rwR/P MA6im5QhjODTBb4yoACYT9VlHECufJqW0zAelwBHTg0Uwr10fD/i5e9aQH1s2QR68WTGm+hjowGUH tt84pMYA==; Received: from szxga01-in.huawei.com ([45.249.212.187]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjYbM-0000000BMwv-0o9B for linux-arm-kernel@lists.infradead.org; Thu, 29 Aug 2024 06:25:51 +0000 Received: from mail.maildlp.com (unknown [172.19.163.48]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4WvWRg0yt1zyQy9; Thu, 29 Aug 2024 14:22:55 +0800 (CST) Received: from kwepemh500013.china.huawei.com (unknown [7.202.181.146]) by mail.maildlp.com (Postfix) with ESMTPS id 5A34218007C; Thu, 29 Aug 2024 14:23:26 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemh500013.china.huawei.com (7.202.181.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 29 Aug 2024 14:23:25 +0800 From: Jinjie Ruan To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , CC: Subject: [PATCH net-next v3 09/13] net: mv643xx_eth: Simplify with scoped for each OF child loop Date: Thu, 29 Aug 2024 14:31:14 +0800 Message-ID: <20240829063118.67453-10-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240829063118.67453-1-ruanjinjie@huawei.com> References: <20240829063118.67453-1-ruanjinjie@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemh500013.china.huawei.com (7.202.181.146) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240829_072549_577129_387A67D4 X-CRM114-Status: GOOD ( 10.82 ) 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 scoped for_each_available_child_of_node_scoped() when iterating over device nodes to make code a bit simpler. Signed-off-by: Jinjie Ruan Reviewed-by: Jonathan Cameron Reviewed-by: Andrew Lunn --- v3: - Add Reviewed-by. --- drivers/net/ethernet/marvell/mv643xx_eth.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c index f35ae2c88091..9e80899546d9 100644 --- a/drivers/net/ethernet/marvell/mv643xx_eth.c +++ b/drivers/net/ethernet/marvell/mv643xx_eth.c @@ -2802,7 +2802,7 @@ static int mv643xx_eth_shared_of_add_port(struct platform_device *pdev, static int mv643xx_eth_shared_of_probe(struct platform_device *pdev) { struct mv643xx_eth_shared_platform_data *pd; - struct device_node *pnp, *np = pdev->dev.of_node; + struct device_node *np = pdev->dev.of_node; int ret; /* bail out if not registered from DT */ @@ -2816,10 +2816,9 @@ static int mv643xx_eth_shared_of_probe(struct platform_device *pdev) mv643xx_eth_property(np, "tx-checksum-limit", pd->tx_csum_limit); - for_each_available_child_of_node(np, pnp) { + for_each_available_child_of_node_scoped(np, pnp) { ret = mv643xx_eth_shared_of_add_port(pdev, pnp); if (ret) { - of_node_put(pnp); mv643xx_eth_shared_of_remove(); return ret; } From patchwork Thu Aug 29 06:31:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinjie Ruan X-Patchwork-Id: 13782620 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 3AA0FC77B7C for ; Thu, 29 Aug 2024 06:32:33 +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-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=kIYJiwmjZghg0oVhIjHK8/JVjqA3pYffUZrUkzu3lmw=; b=OJDyqew8jP+SFN4Y+kgiHKy9vp itYNIZm5zXzrbjDqdNQwRiEYpi+2fVn8TnzUuC5rb2WG8lG0XFbrXPTaTQNjIHf2FxqL5G2iSc1Um G4Lg046H3luUwKCxuoZN6J6fcHC2y56jYpe0oX2SoAVxzxVkoVou0NnOjEbrcKGZg6ryvEpmhTkaD 1bPiD4GMPUsat3O5lq+UqqBiHg2HYd3Bv+o/htZC65bZNLtExiFIezW2rZXVzi8B0Jr8/3KCzhEzl uRLM8q9VGNax2M8eumuUM9AoLP9mh5jEJmLPO+KxvPTw79TtoXlWo/VPswEynVy/rSCgDT0ncS7aU 9tCwn7QA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjYhc-00000000n6D-3RF9; Thu, 29 Aug 2024 06:32:16 +0000 Received: from szxga03-in.huawei.com ([45.249.212.189]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjYZ7-00000000kK6-1slm for linux-arm-kernel@lists.infradead.org; Thu, 29 Aug 2024 06:23:31 +0000 Received: from mail.maildlp.com (unknown [172.19.162.254]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4WvWLh3qchzQr41; Thu, 29 Aug 2024 14:18:36 +0800 (CST) Received: from kwepemh500013.china.huawei.com (unknown [7.202.181.146]) by mail.maildlp.com (Postfix) with ESMTPS id 36289180105; Thu, 29 Aug 2024 14:23:27 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemh500013.china.huawei.com (7.202.181.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 29 Aug 2024 14:23:26 +0800 From: Jinjie Ruan To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , CC: Subject: [PATCH net-next v3 10/13] net: dsa: microchip: Use scoped function to simplfy code Date: Thu, 29 Aug 2024 14:31:15 +0800 Message-ID: <20240829063118.67453-11-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240829063118.67453-1-ruanjinjie@huawei.com> References: <20240829063118.67453-1-ruanjinjie@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemh500013.china.huawei.com (7.202.181.146) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240828_232329_812218_37EB6865 X-CRM114-Status: GOOD ( 10.52 ) 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 Avoids the need for manual cleanup of_node_put() in early exits from the loop by using for_each_available_child_of_node_scoped(). Signed-off-by: Jinjie Ruan Reviewed-by: Jonathan Cameron Reviewed-by: Andrew Lunn --- v3: - Add Reviewed-by. v2: - Split into 2 patches. --- drivers/net/dsa/microchip/ksz_common.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c index cd3991792b69..86ed563938f6 100644 --- a/drivers/net/dsa/microchip/ksz_common.c +++ b/drivers/net/dsa/microchip/ksz_common.c @@ -4595,7 +4595,7 @@ static int ksz_parse_drive_strength(struct ksz_device *dev) int ksz_switch_register(struct ksz_device *dev) { const struct ksz_chip_data *info; - struct device_node *port, *ports; + struct device_node *ports; phy_interface_t interface; unsigned int port_num; int ret; @@ -4681,12 +4681,11 @@ int ksz_switch_register(struct ksz_device *dev) if (!ports) ports = of_get_child_by_name(dev->dev->of_node, "ports"); if (ports) { - for_each_available_child_of_node(ports, port) { + for_each_available_child_of_node_scoped(ports, port) { if (of_property_read_u32(port, "reg", &port_num)) continue; if (!(dev->port_mask & BIT(port_num))) { - of_node_put(port); of_node_put(ports); return -EINVAL; } From patchwork Thu Aug 29 06:31:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinjie Ruan X-Patchwork-Id: 13782631 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 9CC6DC761AE for ; Thu, 29 Aug 2024 06:34:08 +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-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=7V6Fo0PM7TRoFpCCFYnWAGayW+r0ODjZV6PCMZsssKc=; b=FLrfSZkY8yvKshPTH6+W6fUGLQ k9rDi0jDP3svmAkp8rMd9Agq8yT0So+8/6/kTlWVAbXI8wXTLjrsJ/5clLL/jOkE8QVQU7oDlMfWT ZGxuWPoE7Qjs4sOM8QJxOBVigFLtL1/0G+QxUXNbbNvNWdnDJdY4326kmlDoy4LTLu3GzcwZz2gWc c0VmvYEeIm+xgc6xp21ukP5xbCKppsWTbMN42c65A9LMtJ6OH8WU3tWarsmS0D62XsRvkKJNZuEJG 7hPUwfeMR2jle0Z+h0JC90O9bxtS1BbL8jegZwPlz526YlY/QWIaVpNTsiVb/lrbsYpbvBIUwEt/T bhUZnOmw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjYjF-00000000nUA-3LFK; Thu, 29 Aug 2024 06:33:57 +0000 Received: from szxga02-in.huawei.com ([45.249.212.188]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjYZ9-00000000kKD-2LR2 for linux-arm-kernel@lists.infradead.org; Thu, 29 Aug 2024 06:23:33 +0000 Received: from mail.maildlp.com (unknown [172.19.88.194]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4WvWQJ5wXlzpTVL; Thu, 29 Aug 2024 14:21:44 +0800 (CST) Received: from kwepemh500013.china.huawei.com (unknown [7.202.181.146]) by mail.maildlp.com (Postfix) with ESMTPS id 15A6E14035F; Thu, 29 Aug 2024 14:23:28 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemh500013.china.huawei.com (7.202.181.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 29 Aug 2024 14:23:27 +0800 From: Jinjie Ruan To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , CC: Subject: [PATCH net-next v3 11/13] net: dsa: microchip: Use __free() to simplfy code Date: Thu, 29 Aug 2024 14:31:16 +0800 Message-ID: <20240829063118.67453-12-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240829063118.67453-1-ruanjinjie@huawei.com> References: <20240829063118.67453-1-ruanjinjie@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemh500013.china.huawei.com (7.202.181.146) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240828_232331_949251_61562D70 X-CRM114-Status: GOOD ( 10.83 ) 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 Avoids the need for manual cleanup of_node_put() by using __free(). Signed-off-by: Jinjie Ruan Reviewed-by: Jonathan Cameron --- v3: - Add Reviewed-by. v2: - Split into 2 patches. --- drivers/net/dsa/microchip/ksz_common.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c index 86ed563938f6..8058a0b7c161 100644 --- a/drivers/net/dsa/microchip/ksz_common.c +++ b/drivers/net/dsa/microchip/ksz_common.c @@ -4595,7 +4595,6 @@ static int ksz_parse_drive_strength(struct ksz_device *dev) int ksz_switch_register(struct ksz_device *dev) { const struct ksz_chip_data *info; - struct device_node *ports; phy_interface_t interface; unsigned int port_num; int ret; @@ -4677,7 +4676,8 @@ int ksz_switch_register(struct ksz_device *dev) ret = of_get_phy_mode(dev->dev->of_node, &interface); if (ret == 0) dev->compat_interface = interface; - ports = of_get_child_by_name(dev->dev->of_node, "ethernet-ports"); + struct device_node *ports __free(device_node) = + of_get_child_by_name(dev->dev->of_node, "ethernet-ports"); if (!ports) ports = of_get_child_by_name(dev->dev->of_node, "ports"); if (ports) { @@ -4685,16 +4685,13 @@ int ksz_switch_register(struct ksz_device *dev) if (of_property_read_u32(port, "reg", &port_num)) continue; - if (!(dev->port_mask & BIT(port_num))) { - of_node_put(ports); + if (!(dev->port_mask & BIT(port_num))) return -EINVAL; - } of_get_phy_mode(port, &dev->ports[port_num].interface); ksz_parse_rgmii_delay(dev, port_num, port); } - of_node_put(ports); } dev->synclko_125 = of_property_read_bool(dev->dev->of_node, "microchip,synclko-125"); From patchwork Thu Aug 29 06:31:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinjie Ruan X-Patchwork-Id: 13782619 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 05191C761AE for ; Thu, 29 Aug 2024 06:31: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-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=OoKrVSNreqAYFuHliYoTD48s/lJcIvRqPPKqditciag=; b=MvpMALB74moRw2VVG98fPU5ZEv dg6n1d2OOnEmD+tZyHp8W/GhttJlnkvvN6+/5tx0S6NQWT+BJW9t2oSaDE8eEzJwLAaA1jGioSfKg NY+M7CzMyLWukIRD2sjA4dEqOCWjAGZHmV3A/5tA2JiNxM/a0pr6RD/iPdvsYWFh9npi1EYHY3zQQ MFVu8ke7U1v0SY8hfSQUoc7y+wOTZsJtHhjkIaJoIBAKH02TtidIiJ0lvj4CIXIfvto7BkazvTZGG Cho5f4iX1qDvAZyVqpihl9AFrKU02xi0cHoWDEUpTcH3bLkFLASEpFBpT0oNLFZwNkpwP2hob1Xe4 595ySdFg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjYgV-00000000mnn-0me5; Thu, 29 Aug 2024 06:31:07 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjYZW-00000000kRl-0lcK for linux-arm-kernel@bombadil.infradead.org; Thu, 29 Aug 2024 06:23:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:Content-Transfer-Encoding :MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From: Sender:Reply-To:Content-ID:Content-Description; bh=OoKrVSNreqAYFuHliYoTD48s/lJcIvRqPPKqditciag=; b=d+Rbe7kXEMxFwW6RBSkJzmz4iK Q30Gj0ytKLMAJQlZKvpTyZaDZkfvqXi1qfr1YT5BZ7j6f0dDGgi9jT6NXphGXeeKlOsusfP7zJbZK XSV5hcmY2aXoiH9G1Jr+jfd2/mfy08GcKMg+0fuDzAmHOnOiqbHRW1DXY2Pu2dpE8esQWSfRgin8j V8maYjfhB1eUazfxfxnR4rFAfSPbVJ6aqLqDEGzsJvjuVYZkHCxnZtoIoJieXLK8MtlceZu9d0lNM v0VFK4O2lTOxe6qngRpfu5bRMvujl9ASbjzWKUOlrWxka/PyeeGlx4NVEw9sBFvlKzKlrLcZ7/swI 2VC6UTvw==; Received: from szxga03-in.huawei.com ([45.249.212.189]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjYZS-0000000BMx0-03aC for linux-arm-kernel@lists.infradead.org; Thu, 29 Aug 2024 06:23:52 +0000 Received: from mail.maildlp.com (unknown [172.19.163.252]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4WvWLk1qpJzQqxb; Thu, 29 Aug 2024 14:18:38 +0800 (CST) Received: from kwepemh500013.china.huawei.com (unknown [7.202.181.146]) by mail.maildlp.com (Postfix) with ESMTPS id E69FD180AE6; Thu, 29 Aug 2024 14:23:28 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemh500013.china.huawei.com (7.202.181.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 29 Aug 2024 14:23:27 +0800 From: Jinjie Ruan To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , CC: Subject: [PATCH net-next v3 12/13] net: bcmasp: Simplify with scoped for each OF child loop Date: Thu, 29 Aug 2024 14:31:17 +0800 Message-ID: <20240829063118.67453-13-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240829063118.67453-1-ruanjinjie@huawei.com> References: <20240829063118.67453-1-ruanjinjie@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemh500013.china.huawei.com (7.202.181.146) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240829_072350_682894_36A03A28 X-CRM114-Status: GOOD ( 11.72 ) 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 scoped for_each_available_child_of_node_scoped() when iterating over device nodes to make code a bit simpler. Signed-off-by: Jinjie Ruan Reviewed-by: Jonathan Cameron Reviewed-by: Andrew Lunn Reviewed-by: Justin Chen Reviewed-by: Florian Fainelli --- v3: - Sort the variables, longest first, shortest last. - Add Reviewed-by. v2: - Split into 2 patches. --- drivers/net/ethernet/broadcom/asp2/bcmasp.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/broadcom/asp2/bcmasp.c b/drivers/net/ethernet/broadcom/asp2/bcmasp.c index 20c6529ec135..297c2682a9cf 100644 --- a/drivers/net/ethernet/broadcom/asp2/bcmasp.c +++ b/drivers/net/ethernet/broadcom/asp2/bcmasp.c @@ -1300,9 +1300,9 @@ static void bcmasp_remove_intfs(struct bcmasp_priv *priv) static int bcmasp_probe(struct platform_device *pdev) { - struct device_node *ports_node, *intf_node; const struct bcmasp_plat_data *pdata; struct device *dev = &pdev->dev; + struct device_node *ports_node; struct bcmasp_priv *priv; struct bcmasp_intf *intf; int ret = 0, count = 0; @@ -1374,12 +1374,11 @@ static int bcmasp_probe(struct platform_device *pdev) } i = 0; - for_each_available_child_of_node(ports_node, intf_node) { + for_each_available_child_of_node_scoped(ports_node, intf_node) { intf = bcmasp_interface_create(priv, intf_node, i); if (!intf) { dev_err(dev, "Cannot create eth interface %d\n", i); bcmasp_remove_intfs(priv); - of_node_put(intf_node); ret = -ENOMEM; goto of_put_exit; } From patchwork Thu Aug 29 06:31:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinjie Ruan X-Patchwork-Id: 13782634 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 CAC3FC761AE for ; Thu, 29 Aug 2024 06:36:38 +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-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=7cb+m6EsXY/1N/L+XJR85dBy2JcKs0UjWJULwvcgP4I=; b=MNpZojj9F1+AQGMG+UWAODtUzW qIj0Yx/bosomAHqk6HYur2ftT4ClzbhyrlNWE5j/evTAR3Pj+ZMgxtKGiI7qk+ozbsOrQmNrQRf6P FOhFJdNTA1Wn6qJ8ePToLFmMUwasbK2noD8pkzCpVRMPSpld9lFDY9fOu5oA0I/z5uu4SQuJuvuuj adjZ5fUFabHc0DPXiWoloII+aiowwBqNA08fmwOJvKcbEwsLLPhIPYLL8z+w4fqMMjVYc+7xv2oe5 oBs0Vjj9LlRXO156fU5ebHlAUsb+9faCyzY2rrK8ajnjqyf+mt7QxZTOnPuqi/Icu67AabWL5+Iex JIXSZlgA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjYlg-00000000nvy-1sEq; Thu, 29 Aug 2024 06:36:28 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjYbS-00000000l27-1v5Z for linux-arm-kernel@bombadil.infradead.org; Thu, 29 Aug 2024 06:25:54 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:Content-Transfer-Encoding :MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From: Sender:Reply-To:Content-ID:Content-Description; bh=7cb+m6EsXY/1N/L+XJR85dBy2JcKs0UjWJULwvcgP4I=; b=M5MlGF4JUOAWd/fNWuJLEr5Ehs KfumJ5T7TZspK7xP1w8NhUM8Hj9k34zpX523eMFir4227kgq8tU82SSFpQacAfTc6hW3ybl/xSxF3 9ru6xNJxNAciPRtOET7fbLKmVBaDkNyJV7fbgR3aOdtj+RTCpUGLsiA//3aSLgxMAhslK+N+96Dxm CoI6IO5g7B6+MbtMLIPXBg29TpJz4Vuf62PNDkiQgPa/126dJTG/nhQkuyxVxvLvXoIzj9tSt3/Fi K/6ovGr6hc+1KUiCLTbsK5QUnta8ZTB6SN3cFYLjz+tk3flYnXLoSeAOx2VhNYlmM6dCUEd/huF5c TjQNjHYg==; Received: from szxga04-in.huawei.com ([45.249.212.190]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sjYbO-0000000BMx1-1NnT for linux-arm-kernel@lists.infradead.org; Thu, 29 Aug 2024 06:25:53 +0000 Received: from mail.maildlp.com (unknown [172.19.163.44]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4WvWS53SY1z2Dbc5; Thu, 29 Aug 2024 14:23:17 +0800 (CST) Received: from kwepemh500013.china.huawei.com (unknown [7.202.181.146]) by mail.maildlp.com (Postfix) with ESMTPS id D1EE01400E8; Thu, 29 Aug 2024 14:23:29 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemh500013.china.huawei.com (7.202.181.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 29 Aug 2024 14:23:28 +0800 From: Jinjie Ruan To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , CC: Subject: [PATCH net-next v3 13/13] net: bcmasp: Simplify with __free() Date: Thu, 29 Aug 2024 14:31:18 +0800 Message-ID: <20240829063118.67453-14-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240829063118.67453-1-ruanjinjie@huawei.com> References: <20240829063118.67453-1-ruanjinjie@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemh500013.china.huawei.com (7.202.181.146) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240829_072551_568042_57EFF92C X-CRM114-Status: GOOD ( 11.07 ) 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 Avoid need to manually handle of_node_put() by using __free(), which can simplfy code. Signed-off-by: Jinjie Ruan Reviewed-by: Jonathan Cameron --- v3: - Add Reviewed-by. v2: - Split into 2 patches. --- drivers/net/ethernet/broadcom/asp2/bcmasp.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/broadcom/asp2/bcmasp.c b/drivers/net/ethernet/broadcom/asp2/bcmasp.c index 297c2682a9cf..73e767aada2f 100644 --- a/drivers/net/ethernet/broadcom/asp2/bcmasp.c +++ b/drivers/net/ethernet/broadcom/asp2/bcmasp.c @@ -1302,7 +1302,6 @@ static int bcmasp_probe(struct platform_device *pdev) { const struct bcmasp_plat_data *pdata; struct device *dev = &pdev->dev; - struct device_node *ports_node; struct bcmasp_priv *priv; struct bcmasp_intf *intf; int ret = 0, count = 0; @@ -1367,7 +1366,8 @@ static int bcmasp_probe(struct platform_device *pdev) bcmasp_core_init(priv); bcmasp_core_init_filters(priv); - ports_node = of_find_node_by_name(dev->of_node, "ethernet-ports"); + struct device_node *ports_node __free(device_node) = + of_find_node_by_name(dev->of_node, "ethernet-ports"); if (!ports_node) { dev_warn(dev, "No ports found\n"); return -EINVAL; @@ -1377,10 +1377,9 @@ static int bcmasp_probe(struct platform_device *pdev) for_each_available_child_of_node_scoped(ports_node, intf_node) { intf = bcmasp_interface_create(priv, intf_node, i); if (!intf) { - dev_err(dev, "Cannot create eth interface %d\n", i); bcmasp_remove_intfs(priv); - ret = -ENOMEM; - goto of_put_exit; + return dev_err_probe(dev, -ENOMEM, + "Cannot create eth interface %d\n", i); } list_add_tail(&intf->list, &priv->intfs); i++; @@ -1406,16 +1405,14 @@ static int bcmasp_probe(struct platform_device *pdev) "failed to register net_device: %d\n", ret); priv->destroy_wol(priv); bcmasp_remove_intfs(priv); - goto of_put_exit; + return ret; } count++; } dev_info(dev, "Initialized %d port(s)\n", count); -of_put_exit: - of_node_put(ports_node); - return ret; + return 0; } static void bcmasp_remove(struct platform_device *pdev)