From nobody Fri Dec 19 16:00:47 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 56EDFC83F16 for ; Tue, 29 Aug 2023 10:54:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232221AbjH2Kx5 (ORCPT ); Tue, 29 Aug 2023 06:53:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232651AbjH2Kx0 (ORCPT ); Tue, 29 Aug 2023 06:53:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C19251A6 for ; Tue, 29 Aug 2023 03:53:23 -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 60ED565477 for ; Tue, 29 Aug 2023 10:53:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 042DCC433C9; Tue, 29 Aug 2023 10:53:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1693306402; bh=08rPVmjgSTC5liiFw2rBYcil6Ema5CtgYx2svnPVZ9s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s5HtVQg/NZDq8bzJbfWKwq8tryUNgQg8yaetqX9K5c4yo0GDp9ttEHol3rIDBiylv EqcnhPRKkLuSs+3TWvl68Co1GKm+imRd60uNXw6y9E6CtGeP0OV/T1K8+6vJQH/4dz YiVGAU+O+9z6xtVPi91F3t921Dg/OBD+WA1r/bUFIXmqpdVJ+8VvtTigIKtt4jx4tS ny50lX/LrFOLgbrkzAewDhK0pb2sdjKB9k4ixh4RGy9dtHKWFDf5I6kixKtGhhjQ6j Im9sFPuT0ffHm81u97su6N9yYn00q58lTt3kIOgpepJDbH39G51kLhziUnjyG3fW6N K36iDXIcTja7Q== 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 08/22] net: stmmac: dwmac-ipq806x: use devm_stmmac_probe_config_dt() Date: Tue, 29 Aug 2023 18:40:19 +0800 Message-Id: <20230829104033.955-9-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-ipq806x.c | 29 ++++++------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c b/drivers/= net/ethernet/stmicro/stmmac/dwmac-ipq806x.c index 9b0200749109..a9916fd07616 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c @@ -384,22 +384,20 @@ static int ipq806x_gmac_probe(struct platform_device = *pdev) if (val) return val; =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 gmac =3D devm_kzalloc(dev, sizeof(*gmac), GFP_KERNEL); - if (!gmac) { - err =3D -ENOMEM; - goto err_remove_config_dt; - } + if (!gmac) + return -ENOMEM; =20 gmac->pdev =3D pdev; =20 err =3D ipq806x_gmac_of_parse(gmac); if (err) { dev_err(dev, "device tree parsing error\n"); - goto err_remove_config_dt; + return err; } =20 regmap_write(gmac->qsgmii_csr, QSGMII_PCS_CAL_LCKDT_CTL, @@ -459,11 +457,11 @@ static int ipq806x_gmac_probe(struct platform_device = *pdev) if (gmac->phy_mode =3D=3D PHY_INTERFACE_MODE_SGMII) { err =3D ipq806x_gmac_configure_qsgmii_params(gmac); if (err) - goto err_remove_config_dt; + return err; =20 err =3D ipq806x_gmac_configure_qsgmii_pcs_speed(gmac); if (err) - goto err_remove_config_dt; + return err; } =20 plat_dat->has_gmac =3D true; @@ -473,21 +471,12 @@ static int ipq806x_gmac_probe(struct platform_device = *pdev) plat_dat->tx_fifo_size =3D 8192; plat_dat->rx_fifo_size =3D 8192; =20 - err =3D stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); - if (err) - goto err_remove_config_dt; - - return 0; + return stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); =20 err_unsupported_phy: dev_err(&pdev->dev, "Unsupported PHY mode: \"%s\"\n", phy_modes(gmac->phy_mode)); - err =3D -EINVAL; - -err_remove_config_dt: - stmmac_remove_config_dt(pdev, plat_dat); - - return err; + return -EINVAL; } =20 static const struct of_device_id ipq806x_gmac_dwmac_match[] =3D { @@ -498,7 +487,7 @@ MODULE_DEVICE_TABLE(of, ipq806x_gmac_dwmac_match); =20 static struct platform_driver ipq806x_gmac_dwmac_driver =3D { .probe =3D ipq806x_gmac_probe, - .remove_new =3D stmmac_pltfr_remove, + .remove_new =3D stmmac_pltfr_remove_no_dt, .driver =3D { .name =3D "ipq806x-gmac-dwmac", .pm =3D &stmmac_pltfr_pm_ops, --=20 2.40.1