Received: by 2002:a05:7412:1703:b0:e2:908c:2ebd with SMTP id dm3csp3124625rdb; Tue, 29 Aug 2023 06:15:41 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHYQsEyAcI5zFJFjEJcp/R7/qRUIMgw/8CmO/WUwF7Z98Hs/a4MkegWHc8ePr4cTO2nnER7 X-Received: by 2002:a05:6402:42c5:b0:51d:cf7b:c9f0 with SMTP id i5-20020a05640242c500b0051dcf7bc9f0mr3461484edc.12.1693314940982; Tue, 29 Aug 2023 06:15:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693314940; cv=none; d=google.com; s=arc-20160816; b=IFrxHOda3JfXrea69CWohsS8a9aTe3BH4Rd8DXZTJznzLkHuSOoJi2HzB7ObWZilpg 9+NF9+WAX+e9ipsC4x9vrZvgaHQSPXEMGi0YllvyXedbPhX8WkCQclD1ce456KIy/ybi 6yCsdSCgS4uMH7RfmUb6DE+TASUmJ/eL22na3IN4cWz38ZVua+gmubtG1a9GqngcIoXT W7HQuqtl8kL73yAorgujeYY8WinZCAVEelwC7guxEzF6BISuZntQE9nAc+3hssJ22WIv XzUwDYnsKzxyslN4EzIUz2ljECPaaW+RZRqDCDUaTV9OnmoZbBN17MJonBawG6p/9rpE be4w== 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=mcJuPdTT5PSeJ0r7Tit+l0BFZMdUShwV7yjDIMm2cWg=; fh=r/VVG12KmrF+nQv7lC2x2sQ0qQnFs7bJUsMqdUzXKDU=; b=C9jp6sfzZv3jHZac2oM7hLuzjolAFxWBupR1hx4+6VOGV67zuBrmMpKSE3LYg247Hy uF27Ty5M4lJOw+PJtuhW+/6WtmL5+xv/Y1ZpTvW5UjM7Ansnv/5EOkyjzZTv46DE0L0E 4OuJDqfjHJ7fyPm1CnSPUXUgVUXKarcgklY+i66qQv6qaEq3DXhty+ARuEvr1725vbmi B51/4/vZ/bJqcq0L6/GH+1QoXB7IPgKYLXyHRJEP3aE5xsv36oAB+zsdODLqmKmbFsXB 4of/hMg0pvp+gzOwKsJcUlwJumQgPRVtuBSrVFeB+qBzKkpdgKq59vvmnoelpa5qLGzb NI4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=vE0bPn+z; 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 i17-20020a056402055100b005236db67178si5776624edx.417.2023.08.29.06.15.05; Tue, 29 Aug 2023 06:15:40 -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=vE0bPn+z; 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 S235192AbjH2Kxd (ORCPT + 99 others); Tue, 29 Aug 2023 06:53:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232221AbjH2KxT (ORCPT ); Tue, 29 Aug 2023 06:53:19 -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 92B14AB for ; Tue, 29 Aug 2023 03:53:16 -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 285896545F for ; Tue, 29 Aug 2023 10:53:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7FE87C433C8; Tue, 29 Aug 2023 10:53:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1693306395; bh=oTujxMOHFGRuGKFiieFc6dhpH7GYKf8q7WqlAEbZzVU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vE0bPn+zxx+fS69k7pLlgnd0gGTx1EHVu1ig+4LLIAtd9G0NCyZyB0VUhrpHI7hQo 2UIPjYH9ebw/aY1aK6dUsLrGJygbxWvkvizNNdiB37xUzmajtoKMt8ZF5FgkxmTRrz yr0lp9FRfaudyab98qDg96TxOeRUvdnAAA2dWEPyMbv2WQgS4ZPCj3iy3HFEJbLjLG ERCjdyX+b9TpK5hrROSqv75Eey72lqRiBTGhHxUUjjL+nOs+hUH03v9/K+A67uuPba 7UkM13iXHIb4YrN7m21iu6mqc+VwIVy+v4f9rQtEkbC5FzV1GyXeAEBQrjYrVTM00e 8wwQNwDDdtM/g== 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 07/22] net: stmmac: dwmac-intel-plat: use devm_stmmac_probe_config_dt() Date: Tue, 29 Aug 2023 18:40:18 +0800 Message-Id: <20230829104033.955-8-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=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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 calling of stmmac_pltfr_remove() now needs to be switched to stmmac_pltfr_remove_no_dt(). Signed-off-by: Jisheng Zhang --- .../stmicro/stmmac/dwmac-intel-plat.c | 27 +++++++------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c index d352a14f9d48..d1aec2ca2b42 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel-plat.c @@ -85,17 +85,15 @@ static int intel_eth_plat_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(&pdev->dev, "dt configuration failed\n"); return PTR_ERR(plat_dat); } dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL); - if (!dwmac) { - ret = -ENOMEM; - goto err_remove_config_dt; - } + if (!dwmac) + return -ENOMEM; dwmac->dev = &pdev->dev; dwmac->tx_clk = NULL; @@ -110,10 +108,8 @@ static int intel_eth_plat_probe(struct platform_device *pdev) /* Enable TX clock */ if (dwmac->data->tx_clk_en) { dwmac->tx_clk = devm_clk_get(&pdev->dev, "tx_clk"); - if (IS_ERR(dwmac->tx_clk)) { - ret = PTR_ERR(dwmac->tx_clk); - goto err_remove_config_dt; - } + if (IS_ERR(dwmac->tx_clk)) + return PTR_ERR(dwmac->tx_clk); clk_prepare_enable(dwmac->tx_clk); @@ -126,7 +122,7 @@ static int intel_eth_plat_probe(struct platform_device *pdev) if (ret) { dev_err(&pdev->dev, "Failed to set tx_clk\n"); - goto err_remove_config_dt; + return ret; } } } @@ -140,7 +136,7 @@ static int intel_eth_plat_probe(struct platform_device *pdev) if (ret) { dev_err(&pdev->dev, "Failed to set clk_ptp_ref\n"); - goto err_remove_config_dt; + return ret; } } } @@ -158,22 +154,17 @@ static int intel_eth_plat_probe(struct platform_device *pdev) ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); if (ret) { clk_disable_unprepare(dwmac->tx_clk); - goto err_remove_config_dt; + return ret; } return 0; - -err_remove_config_dt: - stmmac_remove_config_dt(pdev, plat_dat); - - return ret; } static void intel_eth_plat_remove(struct platform_device *pdev) { struct intel_dwmac *dwmac = get_stmmac_bsp_priv(&pdev->dev); - stmmac_pltfr_remove(pdev); + stmmac_pltfr_remove_no_dt(pdev); clk_disable_unprepare(dwmac->tx_clk); } -- 2.40.1