Received: by 2002:a05:7412:1703:b0:e2:908c:2ebd with SMTP id dm3csp3113499rdb; Tue, 29 Aug 2023 06:01:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHyt8ZBjCx92idXHVUR63dwhKKofPXQSXn1Y9tBlOc6ZQuayGw45sMNr6kST/oIUykcunfC X-Received: by 2002:a17:903:187:b0:1bd:a22a:d40a with SMTP id z7-20020a170903018700b001bda22ad40amr25467530plg.2.1693314088121; Tue, 29 Aug 2023 06:01:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693314088; cv=none; d=google.com; s=arc-20160816; b=u/xcUP6si0FCtBQR3RVP8t1VopkovO5PpLKA8cZ3Oq4o4O2WapHrYafW7CIQonV6nk MCQR+U/NyjNEqhMCib1dqNxoToMWvv6WFlaLBES8kmos65TanBVqc88H04xyRQBveB2n QG+9mGAIAZzICm2hv7riKOP9NZecQpxjk0zwZ2NeqoBYcAgK3syjJY4l2nnTGH7FpSQ9 KARK0l9Cgv25SDYX9WfAolhLP5tPlcEPkhR1Obeq+7XLUZYUJ08c+shNYtbXCYdGbdFi c/zXHznHZP0b1fio4sT0pmg+0wiHk9npvLpo6y1ofCDou308eeug4ZjCC8GiUqAL37hj 1FdA== 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=Wl3Iq/KTaj+p1zQe025B02vuUOqP+7uOx8IcKKWNCLA=; fh=r/VVG12KmrF+nQv7lC2x2sQ0qQnFs7bJUsMqdUzXKDU=; b=UA7Qbma2Djbz3a5guFYC8WqvVsXZrEoWFtKIDM2oD/0+tg252RC2nQ7XLTcTi9g82d 3xdF0Z3NF9O/0mhZqRhWGhjPHNIhm6kozG1NDU1M69zLnasACr6BUA4ox9BnjzhINbQU db6B7o0seMpPuMt4yaVd2iW/Fxa+HpxkeZF0N5W0v1YEJ/PHghgfeikpJ0VrjfrOEfo+ PkUezA6vIhoao2/xA2Aw+kjgb4KBCRmGvjZWkW8gmK0kIWdZw0cqGixCmfKWtR6+V8Lq D3bvJOi/J1AkRSBvxEWpaNZvVYx4a26XNubRn4xy5pgYBWzMDd/6cjw5waiviatZfNp4 Vh+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ilhXRwxh; 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 c1-20020a170903234100b001b9736814b6si10177268plh.309.2023.08.29.06.01.07; Tue, 29 Aug 2023 06:01:28 -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=ilhXRwxh; 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 S235270AbjH2Kzj (ORCPT + 99 others); Tue, 29 Aug 2023 06:55:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235348AbjH2KzW (ORCPT ); Tue, 29 Aug 2023 06:55:22 -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 1D337E4A for ; Tue, 29 Aug 2023 03:54:54 -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 70908654B4 for ; Tue, 29 Aug 2023 10:54:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BC32AC433C8; Tue, 29 Aug 2023 10:54:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1693306492; bh=xaX/1pgdUp6jF0eAGOIu3QPf4VByZDmH71/iKbXHLBY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ilhXRwxhYHCwcTM0jfOnU1+PAELTaALR5BuUY5pkvJ41r8pdlesyGZZf8+8ntDxF0 S8Q9NUnqQyJvAE4afUKQrCRbe+E2xtKbpPgnTRbbiJrsq92illV9gNdd4z05zUBKQK P3HJHlvNUw7trN6hsLTXDzRkNaEuJ/hjWK2xQSuKhQv0xiDk5jfWkTLU7cPgo2NNwd mMjnyLPFyNBCkN97M5l8v619Csd77VWjb8UYiORhIdson+Ikj8+Gbo8QhJgDdXoMbC 824HRqoFSSIc8Uo7miNP9ZCxiRu923uCjqSdU4H5LropysJyVR+ddB48nxzGjNy4N6 lhfRBoYBgx6Jw== 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 21/22] net: stmmac: dwmac-visconti: use devm_stmmac_probe_config_dt() Date: Tue, 29 Aug 2023 18:40:32 +0800 Message-Id: <20230829104033.955-22-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 --- .../net/ethernet/stmicro/stmmac/dwmac-visconti.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c index 22d113fb8e09..75fafd23385a 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-visconti.c @@ -220,15 +220,13 @@ static int visconti_eth_dwmac_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)) return PTR_ERR(plat_dat); dwmac = devm_kzalloc(&pdev->dev, sizeof(*dwmac), GFP_KERNEL); - if (!dwmac) { - ret = -ENOMEM; - goto remove_config; - } + if (!dwmac) + return -ENOMEM; spin_lock_init(&dwmac->lock); dwmac->reg = stmmac_res.addr; @@ -238,7 +236,7 @@ static int visconti_eth_dwmac_probe(struct platform_device *pdev) ret = visconti_eth_clock_probe(pdev, plat_dat); if (ret) - goto remove_config; + return ret; visconti_eth_init_hw(pdev, plat_dat); @@ -252,8 +250,6 @@ static int visconti_eth_dwmac_probe(struct platform_device *pdev) remove: visconti_eth_clock_remove(pdev); -remove_config: - stmmac_remove_config_dt(pdev, plat_dat); return ret; } @@ -263,7 +259,7 @@ static void visconti_eth_dwmac_remove(struct platform_device *pdev) struct net_device *ndev = platform_get_drvdata(pdev); struct stmmac_priv *priv = netdev_priv(ndev); - stmmac_pltfr_remove(pdev); + stmmac_pltfr_remove_no_dt(pdev); visconti_eth_clock_remove(pdev); -- 2.40.1