From nobody Fri Dec 19 16:00:48 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 759AFC83F18 for ; Tue, 29 Aug 2023 10:54:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235167AbjH2KyD (ORCPT ); Tue, 29 Aug 2023 06:54:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37666 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235217AbjH2Kxf (ORCPT ); Tue, 29 Aug 2023 06:53:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96F70CCD for ; Tue, 29 Aug 2023 03:53:30 -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 E992F65476 for ; Tue, 29 Aug 2023 10:53:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46AE7C43391; Tue, 29 Aug 2023 10:53:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1693306409; bh=4G9a4mrPnqX1xIr+Ys2g0Bqa6pgj8luMxBWuM3WyNt4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XNTMFXHSTWcBnjogVakmr53uQSkbyTupJUmAtIOYLSroK3hrvrd/qYSMShHZPy8qg nansELJH3pokb/f+jvHYRp5NBFB7zw/XSuC6OeIkpcgv/ems8RJIW6LuVEUUsL3d7b 8mBCuLAOgWZv6xbc86lWjNOqsQ1g9aUV8ytcv2hbZRxh475WHesqJbwRPE/PkhR1+7 8jNDdo6QU9MsGS3jEEeu59jg7WEBDpwmxjCMoAKjTHSS90wq1etIHxhHLnO6oEIDFw xz5eGoFNtmHZ//Ku19lSTPeCsM7/0tK2DDcCt7nvYDSePQrf9S9Y8hbd9whji25DQT UZH9Cyjj0xh7w== 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 09/22] net: stmmac: dwmac-lpc18xx: use devm_stmmac_probe_config_dt() Date: Tue, 29 Aug 2023 18:40:20 +0800 Message-Id: <20230829104033.955-10-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: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 --- .../ethernet/stmicro/stmmac/dwmac-lpc18xx.c | 21 +++++-------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c b/drivers/= net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c index 18e84ba693a6..5d4936642de5 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-lpc18xx.c @@ -37,7 +37,7 @@ static int lpc18xx_dwmac_probe(struct platform_device *pd= ev) if (ret) return ret; =20 - plat_dat =3D stmmac_probe_config_dt(pdev, stmmac_res.mac); + plat_dat =3D devm_stmmac_probe_config_dt(pdev, stmmac_res.mac); if (IS_ERR(plat_dat)) return PTR_ERR(plat_dat); =20 @@ -46,8 +46,7 @@ static int lpc18xx_dwmac_probe(struct platform_device *pd= ev) reg =3D syscon_regmap_lookup_by_compatible("nxp,lpc1850-creg"); if (IS_ERR(reg)) { dev_err(&pdev->dev, "syscon lookup failed\n"); - ret =3D PTR_ERR(reg); - goto err_remove_config_dt; + return PTR_ERR(reg); } =20 if (plat_dat->interface =3D=3D PHY_INTERFACE_MODE_MII) { @@ -56,23 +55,13 @@ static int lpc18xx_dwmac_probe(struct platform_device *= pdev) ethmode =3D LPC18XX_CREG_CREG6_ETHMODE_RMII; } else { dev_err(&pdev->dev, "Only MII and RMII mode supported\n"); - ret =3D -EINVAL; - goto err_remove_config_dt; + return -EINVAL; } =20 regmap_update_bits(reg, LPC18XX_CREG_CREG6, LPC18XX_CREG_CREG6_ETHMODE_MASK, ethmode); =20 - ret =3D stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); - if (ret) - goto err_remove_config_dt; - - return 0; - -err_remove_config_dt: - stmmac_remove_config_dt(pdev, plat_dat); - - return ret; + return stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); } =20 static const struct of_device_id lpc18xx_dwmac_match[] =3D { @@ -83,7 +72,7 @@ MODULE_DEVICE_TABLE(of, lpc18xx_dwmac_match); =20 static struct platform_driver lpc18xx_dwmac_driver =3D { .probe =3D lpc18xx_dwmac_probe, - .remove_new =3D stmmac_pltfr_remove, + .remove_new =3D stmmac_pltfr_remove_no_dt, .driver =3D { .name =3D "lpc18xx-dwmac", .pm =3D &stmmac_pltfr_pm_ops, --=20 2.40.1