From patchwork Tue Aug 29 10:40:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 13368844 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 EA61FC83F12 for ; Tue, 29 Aug 2023 10:53:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id: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=1gpr8W64Bpegit3/GqPixp1K3jEB46Y+6b6woEtzhug=; b=ebANjmyry1An3x XHZoAtFk75jJTXeK14C6K4Fp4jp5b7Mo3c3B+ZsgBlg+RjImuYZWuDi/oaEo5aXvMz3TuPsjknmnj O9uKYcceCHFWBvrLAm62P+XvvaQqhSeR10WWvOPvAnFqOBZY7Q05zXeL0KyMk+1+eyXetjwCVqxfA gvbQ4h4876utY+LgwZDkLkP8hZ8ZnOx7XoM9H7M3DcKpwtEoJRC15uuI3ig0Ymssi07/4N9ZZKKLp 31x9pAGTR1ncFK7YfPGrykADSAZlMtrDp3EosrgcAQLbjMcwytIxp5rJVNcoHCPx+NUmTw2Rtug99 Jcov21T77l+LxIbQLLbg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qawLV-00BKub-26; Tue, 29 Aug 2023 10:53:17 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qawLH-00BKoE-0k for linux-arm-kernel@lists.infradead.org; Tue, 29 Aug 2023 10:53:04 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 825CA6545D; Tue, 29 Aug 2023 10:53:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E4AC1C433CA; Tue, 29 Aug 2023 10:52:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1693306381; bh=NfmMNorB1i8iTRlNbscAGy8iJ8mMIBVk/gLt8TbXCus=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=R0Yd+txvCUqerxhQdKMHb0eC2/pdb1ARG/YXEdJxh7lPhf7WSIVfH/mp/FDnBT6H5 3vrpRt+lp8auapOTcS95cLi7kV8gW1zDrMoDnq7LKMtCblNlYgzC6JYhFrcL7M0Z1X FPNa5ip4SNX4pq8V+phSXRpOSQE0BQJcXC7tg67+bTDJ8sNVX7ORo8M0ceLgrcN6Jv Qmpr8sCk7f0/EIWqMpxfqcOlmveBkIA/NroYgYLIW0OLr1R/kPs/NP+wKpdngBHxoT /HzsbhEV+JciUgc/9tRr731hXBrarWO9LIyYV+QiRDIDue+629780wOpQqzpRlWvAM O1m+B6wPVY1og== From: Jisheng Zhang To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Vladimir Zapolskiy , Neil Armstrong , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Emil Renner Berthing , Samin Guo , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Thierry Reding , Jonathan Hunter , Nobuhiro Iwamatsu , Russell King , Matthias Brugger , AngeloGioacchino Del Regno , Bartosz Golaszewski Cc: netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next 05/22] net: stmmac: dwmac-imx: use devm_stmmac_probe_config_dt() Date: Tue, 29 Aug 2023 18:40:16 +0800 Message-Id: <20230829104033.955-6-jszhang@kernel.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230829104033.955-1-jszhang@kernel.org> References: <20230829104033.955-1-jszhang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230829_035303_368566_2B8FD97A X-CRM114-Status: GOOD ( 15.67 ) 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 Simplify the driver's probe() function by using the devres variant of stmmac_probe_config_dt(). The remove_new() callback now needs to be switched to stmmac_pltfr_remove_no_dt(). Signed-off-by: Jisheng Zhang --- drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c index 535856fffaea..f4c817e9fc13 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-imx.c @@ -331,15 +331,14 @@ static int imx_dwmac_probe(struct platform_device *pdev) if (!dwmac) return -ENOMEM; - plat_dat = stmmac_probe_config_dt(pdev, stmmac_res.mac); + plat_dat = devm_stmmac_probe_config_dt(pdev, stmmac_res.mac); if (IS_ERR(plat_dat)) return PTR_ERR(plat_dat); data = of_device_get_match_data(&pdev->dev); if (!data) { dev_err(&pdev->dev, "failed to get match data\n"); - ret = -EINVAL; - goto err_match_data; + return -EINVAL; } dwmac->ops = data; @@ -348,7 +347,7 @@ static int imx_dwmac_probe(struct platform_device *pdev) ret = imx_dwmac_parse_dt(dwmac, &pdev->dev); if (ret) { dev_err(&pdev->dev, "failed to parse OF data\n"); - goto err_parse_dt; + return ret; } if (data->flags & STMMAC_FLAG_HWTSTAMP_CORRECT_LATENCY) @@ -365,7 +364,7 @@ static int imx_dwmac_probe(struct platform_device *pdev) ret = imx_dwmac_clks_config(dwmac, true); if (ret) - goto err_clks_config; + return ret; ret = imx_dwmac_init(pdev, dwmac); if (ret) @@ -385,10 +384,6 @@ static int imx_dwmac_probe(struct platform_device *pdev) imx_dwmac_exit(pdev, plat_dat->bsp_priv); err_dwmac_init: imx_dwmac_clks_config(dwmac, false); -err_clks_config: -err_parse_dt: -err_match_data: - stmmac_remove_config_dt(pdev, plat_dat); return ret; } @@ -423,7 +418,7 @@ MODULE_DEVICE_TABLE(of, imx_dwmac_match); static struct platform_driver imx_dwmac_driver = { .probe = imx_dwmac_probe, - .remove_new = stmmac_pltfr_remove, + .remove_new = stmmac_pltfr_remove_no_dt, .driver = { .name = "imx-dwmac", .pm = &stmmac_pltfr_pm_ops,