From patchwork Fri Jun 23 10:04:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 13290254 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 8B8A3C001DC for ; Fri, 23 Jun 2023 10:05:11 +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=41rdYGVjz2rdutobAg0Vvrj93/0Xn7Dl2iTBWxHz7oc=; b=QiCHECZA4uDORt sf3b4pn9J3hpDwPa7k1BWGNx4eQhPt/AWVEp6byjUFRn8aIPayvE2MVfsoyG43Vme0ucskZJ7p7tg n8fO0WBIZC3t8+jc6NxzgSNrfpCqTFFTiDdKosddJsShMjo9YFmmes1oy5B6DwGQojkyDlzhHOmtq NDG0GDbDCkf9H3sC4woqee6DsswOAwc+8EBNLqmUJH/jzxcGrzbOVKOzCLyM7ENAU7IVMXrKpoQJJ Llw+SwcAj5rHDg3FQme6ma7Y+ZCv2Y3TdP5LpsxE8+UDSICYQz6mIkI8Q2fz/2CBmfc8OqmPJ/qJy EfzlghgX7w7ODCYLxvMQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qCdeo-0036Eh-1M; Fri, 23 Jun 2023 10:04:46 +0000 Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qCdeb-003685-2b for linux-arm-kernel@lists.infradead.org; Fri, 23 Jun 2023 10:04:35 +0000 Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-4f96d680399so488485e87.0 for ; Fri, 23 Jun 2023 03:04:32 -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=AUX6BBETdjkdZxZTdvEcc0wnKXJhhY98+/wr5F5suxomocbaHGFQ8SauGJL78nTrmh WiJieYG8kQJ/nuXPpYS2XmxM9ArD4OZZ5iEXZAAUVjK1bHtXeJABf2DwnaiBn16AgGnt 28A1J3FX1quJPeR2mM+m85S4XR6l3wesPe2GOG9fiLrE631LxP0kdBc0VvUFT3zPHTbZ 2WJoLsGad0NOTqgzYoxoWjBjS/bNt3Qk3u625PK5g+1bjdF52FOXGBTVbMAnnhSaHb24 hNztD7KxtIojkVwSjG3BjH/QxqPdALMR/U2OD07pLNxTJerdAH3n8Q0KSsi/IqvzI0zV pvBA== X-Gm-Message-State: AC+VfDxhKmw3Zd8PnT/ujRoKoVUCfu6Fyu30kD8nmUv4CL79lVbnMyt6 8RFr+iFP295MXLeinhSXv6KCpg== 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230623_030433_862683_C0B72066 X-CRM114-Status: GOOD ( 15.46 ) 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 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/drivers/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 *pdev) if (ret) return ret; - 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)) { dev_err(dev, "dt configuration failed\n"); return PTR_ERR(plat_dat); @@ -717,10 +717,8 @@ static int qcom_ethqos_probe(struct platform_device *pdev) plat_dat->clks_config = ethqos_clks_config; ethqos = devm_kzalloc(dev, sizeof(*ethqos), GFP_KERNEL); - if (!ethqos) { - ret = -ENOMEM; - goto out_config_dt; - } + if (!ethqos) + return -ENOMEM; ethqos->phy_mode = 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 = ethqos_configure_sgmii; break; case -ENODEV: - ret = -ENODEV; - goto out_config_dt; + return -ENODEV; default: - ret = -EINVAL; - goto out_config_dt; + return -EINVAL; } ethqos->pdev = pdev; ethqos->rgmii_base = devm_platform_ioremap_resource_byname(pdev, "rgmii"); - if (IS_ERR(ethqos->rgmii_base)) { - ret = PTR_ERR(ethqos->rgmii_base); - goto out_config_dt; - } + if (IS_ERR(ethqos->rgmii_base)) + return PTR_ERR(ethqos->rgmii_base); ethqos->mac_base = stmmac_res.addr; @@ -757,24 +751,20 @@ static int qcom_ethqos_probe(struct platform_device *pdev) ethqos->has_emac_ge_3 = data->has_emac_ge_3; ethqos->link_clk = devm_clk_get(dev, data->link_clk_name ?: "rgmii"); - if (IS_ERR(ethqos->link_clk)) { - ret = PTR_ERR(ethqos->link_clk); - goto out_config_dt; - } + if (IS_ERR(ethqos->link_clk)) + return PTR_ERR(ethqos->link_clk); ret = ethqos_clks_config(ethqos, true); if (ret) - goto out_config_dt; + return ret; ret = devm_add_action_or_reset(dev, ethqos_clks_disable, ethqos); if (ret) - goto out_config_dt; + return ret; ethqos->serdes_phy = devm_phy_optional_get(dev, "serdes"); - if (IS_ERR(ethqos->serdes_phy)) { - ret = PTR_ERR(ethqos->serdes_phy); - goto out_config_dt; - } + if (IS_ERR(ethqos->serdes_phy)) + return PTR_ERR(ethqos->serdes_phy); ethqos->speed = SPEED_1000; ethqos_update_link_clk(ethqos, SPEED_1000); @@ -797,16 +787,7 @@ static int qcom_ethqos_probe(struct platform_device *pdev) plat_dat->serdes_powerdown = qcom_ethqos_serdes_powerdown; } - ret = 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); } static const struct of_device_id qcom_ethqos_match[] = { @@ -820,7 +801,7 @@ MODULE_DEVICE_TABLE(of, qcom_ethqos_match); static struct platform_driver qcom_ethqos_driver = { .probe = qcom_ethqos_probe, - .remove_new = stmmac_pltfr_remove, + .remove_new = stmmac_pltfr_remove_no_dt, .driver = { .name = "qcom-ethqos", .pm = &stmmac_pltfr_pm_ops,