From nobody Sun Feb 8 11:44:13 2026 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 36298EB64DD for ; Fri, 23 Jun 2023 10:05:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232117AbjFWKFo (ORCPT ); Fri, 23 Jun 2023 06:05:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231889AbjFWKEe (ORCPT ); Fri, 23 Jun 2023 06:04:34 -0400 Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58441211D for ; Fri, 23 Jun 2023 03:04:33 -0700 (PDT) Received: by mail-lf1-x132.google.com with SMTP id 2adb3069b0e04-4f004cc54f4so469843e87.3 for ; Fri, 23 Jun 2023 03:04:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20221208.gappssmtp.com; s=20221208; t=1687514671; x=1690106671; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=tzkZoWqIdrFL84uinSijWf7BmQOJpWDfpkjROxZd1c8=; b=4RrfktXNAJwAB4YKI7AhrOTkkSSFAJtDqMbawS4RLXRU5DinHjF7CTFSigQBHC7iun +YDIaduuKs4+CPc704rh4dOqG2+uib8T2ARzA+eYiQpVsSrDsoHs5MhJ92gGnEQWWCOU ws1GuZVq7hs+GHqFW8H2gdvjHti3LyRGY/fB9UNR8ukBvoeAFkKUQS18FrBNBD+svGeE FD+xzGUuAWQZ668fyg/Kh1z3zUkfkgGZ2GTc/DuKGntnrIMl/fhhxWGStGXzDoGTUyFP +DFDoVMcbMNEp7XnnEpjRW3tZSOkz9TNN7fEiGQi1Imc6TrAGY8bKuiDqI2DoGqUfSls zczw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687514671; x=1690106671; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=tzkZoWqIdrFL84uinSijWf7BmQOJpWDfpkjROxZd1c8=; b=Ma4OFkBct9dvpOiqzT9CeYVTPFIIY4UxayqhDraKFKTuD257fbifb8c7RL42/inv7i B7j8fy2UcBW1kolHZvHoKpWAhKWsZKo4k2Q8IzOfQ5Bvdsoy/XEm7MGomWoyHwoXm+L9 JlrM5/eURXR0V8N6zwkaKXN2N6392UhEEYzTHuPaHBQG5f8GrpfK+QVXz6k/uEbFlMRO eE0sWkA3DHWxcYBO3Srq6x8keCN0z25VCO4nKvhTUimFDflUczAqX4OmCRCgy+cVAEzA s3IGovAnqUCo3ozq24R0Sef9iHr1AIk8i1/4RNpEXYjntPrC6Y6p+epVsaMIZ7LNRn2N fguQ== X-Gm-Message-State: AC+VfDw/PXqkbMX1CxyJsYb+6djWLl382vE7h5xc82fviZel+s+q4v54 TcqPUxdKG/lnXuDy3i5nscrBSB4wDcNwC8m5kkc= X-Google-Smtp-Source: ACHHUZ4hc5yse0n/OkIOTa2lRRWP3QII9JIGZqIe33wxnA+Dle/2IPmFy08WfsqOBtiEmCK5yv4D2g== X-Received: by 2002:a05:6512:2213:b0:4f9:657e:3ea4 with SMTP id h19-20020a056512221300b004f9657e3ea4mr4547946lfu.43.1687514671192; Fri, 23 Jun 2023 03:04:31 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:ddc2:ce92:1ed6:27bd]) by smtp.gmail.com with ESMTPSA id x8-20020a5d54c8000000b0030fae360f14sm9079360wrv.68.2023.06.23.03.04.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Jun 2023 03:04:30 -0700 (PDT) From: Bartosz Golaszewski To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Junxiao Chang , Vinod Koul , Bhupesh Sharma Cc: netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH net-next v2 09/11] net: stmmac: dwmac-qco-ethqos: use devm_stmmac_probe_config_dt() Date: Fri, 23 Jun 2023 12:04:15 +0200 Message-Id: <20230623100417.93592-10-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230623100417.93592-1-brgl@bgdev.pl> References: <20230623100417.93592-1-brgl@bgdev.pl> 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" From: Bartosz Golaszewski Significantly simplify the driver's probe() function by using the devres variant of stmmac_probe_config_dt(). This allows to drop the goto jumps entirely. The remove_new() callback now needs to be switched to stmmac_pltfr_remove_no_dt(). Signed-off-by: Bartosz Golaszewski --- .../stmicro/stmmac/dwmac-qcom-ethqos.c | 49 ++++++------------- 1 file changed, 15 insertions(+), 34 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/driv= ers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c index fa0fc53c56a3..7b9fbcb8d84d 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c @@ -708,7 +708,7 @@ static int qcom_ethqos_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)) { dev_err(dev, "dt configuration failed\n"); return PTR_ERR(plat_dat); @@ -717,10 +717,8 @@ static int qcom_ethqos_probe(struct platform_device *p= dev) plat_dat->clks_config =3D ethqos_clks_config; =20 ethqos =3D devm_kzalloc(dev, sizeof(*ethqos), GFP_KERNEL); - if (!ethqos) { - ret =3D -ENOMEM; - goto out_config_dt; - } + if (!ethqos) + return -ENOMEM; =20 ethqos->phy_mode =3D device_get_phy_mode(dev); switch (ethqos->phy_mode) { @@ -734,19 +732,15 @@ static int qcom_ethqos_probe(struct platform_device *= pdev) ethqos->configure_func =3D ethqos_configure_sgmii; break; case -ENODEV: - ret =3D -ENODEV; - goto out_config_dt; + return -ENODEV; default: - ret =3D -EINVAL; - goto out_config_dt; + return -EINVAL; } =20 ethqos->pdev =3D pdev; ethqos->rgmii_base =3D devm_platform_ioremap_resource_byname(pdev, "rgmii= "); - if (IS_ERR(ethqos->rgmii_base)) { - ret =3D PTR_ERR(ethqos->rgmii_base); - goto out_config_dt; - } + if (IS_ERR(ethqos->rgmii_base)) + return PTR_ERR(ethqos->rgmii_base); =20 ethqos->mac_base =3D stmmac_res.addr; =20 @@ -757,24 +751,20 @@ static int qcom_ethqos_probe(struct platform_device *= pdev) ethqos->has_emac_ge_3 =3D data->has_emac_ge_3; =20 ethqos->link_clk =3D devm_clk_get(dev, data->link_clk_name ?: "rgmii"); - if (IS_ERR(ethqos->link_clk)) { - ret =3D PTR_ERR(ethqos->link_clk); - goto out_config_dt; - } + if (IS_ERR(ethqos->link_clk)) + return PTR_ERR(ethqos->link_clk); =20 ret =3D ethqos_clks_config(ethqos, true); if (ret) - goto out_config_dt; + return ret; =20 ret =3D devm_add_action_or_reset(dev, ethqos_clks_disable, ethqos); if (ret) - goto out_config_dt; + return ret; =20 ethqos->serdes_phy =3D devm_phy_optional_get(dev, "serdes"); - if (IS_ERR(ethqos->serdes_phy)) { - ret =3D PTR_ERR(ethqos->serdes_phy); - goto out_config_dt; - } + if (IS_ERR(ethqos->serdes_phy)) + return PTR_ERR(ethqos->serdes_phy); =20 ethqos->speed =3D SPEED_1000; ethqos_update_link_clk(ethqos, SPEED_1000); @@ -797,16 +787,7 @@ static int qcom_ethqos_probe(struct platform_device *p= dev) plat_dat->serdes_powerdown =3D qcom_ethqos_serdes_powerdown; } =20 - ret =3D stmmac_dvr_probe(dev, plat_dat, &stmmac_res); - if (ret) - goto out_config_dt; - - return ret; - -out_config_dt: - stmmac_remove_config_dt(pdev, plat_dat); - - return ret; + return stmmac_dvr_probe(dev, plat_dat, &stmmac_res); } =20 static const struct of_device_id qcom_ethqos_match[] =3D { @@ -820,7 +801,7 @@ MODULE_DEVICE_TABLE(of, qcom_ethqos_match); =20 static struct platform_driver qcom_ethqos_driver =3D { .probe =3D qcom_ethqos_probe, - .remove_new =3D stmmac_pltfr_remove, + .remove_new =3D stmmac_pltfr_remove_no_dt, .driver =3D { .name =3D "qcom-ethqos", .pm =3D &stmmac_pltfr_pm_ops, --=20 2.39.2