Received: by 2002:a05:7412:1703:b0:e2:908c:2ebd with SMTP id dm3csp3141803rdb; Tue, 29 Aug 2023 06:41:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IED1IOEIHs2O/5a/utz1zrB43Ku+BrlYAEnS9Paa2zp5QdpouGDgSyV3ZHRdOulFsnLop0b X-Received: by 2002:a17:902:7c91:b0:1bc:1189:17f with SMTP id y17-20020a1709027c9100b001bc1189017fmr20980173pll.42.1693316465977; Tue, 29 Aug 2023 06:41:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693316465; cv=none; d=google.com; s=arc-20160816; b=TbgQkl6skEu39ForuK44xy9qZpwQYdA7+Xzw/+RmnQnmpSgG5edGcnohHlbhG9rkZs 8f3kwsSzLmAOK3RTtaRqPEFaYr5hOQolTKpNOg05E2QL/8m1FEgR6aSxpx/JlAQP2ySA bCqdEXY7MfVKYu52JvtgxiwFDIIn8Pc/d6aTPjIHMTryconuupj4dlmuD8qevEtMTfNQ FL+wQpUwIaNcnUA4+0cNLBJjmc/owzGvjY38Hlav+ITOAshB1lA+xyY3OmGKWzWp+lSx rhYRQFqaufc2KUYbuz7xShz2fWDV2WR61xJwhJOXSunx/xvpevgiRiQxgAje1qb0YNu0 5SNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=rbguINJGiaXafA+ZmjpyCm2EJxCxNh4PEBIJC4K0FFw=; fh=r/VVG12KmrF+nQv7lC2x2sQ0qQnFs7bJUsMqdUzXKDU=; b=09ojN1DvvId8Oa4bboxZZJkoZOCn1fuZHVnJHe3Gd0/2+OttPaSKMqZnZyAzMiBQ/g Ab2uBsK3UTDwsaLgmln5yJN6ZgYt3ko95Uez9fCj9TKzssqf3csF00Zh+p1QZktGpKIm DMZjmsd6AYjEcvELKawyr+FD3f+5jAICFibIXfaCRORLDVGWvW/h3/CPZmYOjKY9ATiu eT8C8znP0Rei/hC5DuGJlCf+8v9uJqzrLOBQ+m1T0AsSsCyFZljYPydPezxraEO06y1p s46Ych2vrE7gtzKNlM+v9ylXr4hLKDuZDB8Smr/xKnbMFvLojbyI/ZW5YNcIPVvcTkn9 yqYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=R0Yd+txv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l3-20020a170902f68300b001b88ff529cfsi92643plg.619.2023.08.29.06.40.48; Tue, 29 Aug 2023 06:41:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=R0Yd+txv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234546AbjH2Kx3 (ORCPT + 99 others); Tue, 29 Aug 2023 06:53:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56652 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232186AbjH2KxF (ORCPT ); Tue, 29 Aug 2023 06:53:05 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF2AA98 for ; Tue, 29 Aug 2023 03:53:02 -0700 (PDT) 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 7DFCF6545C for ; 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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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, -- 2.40.1