Received: by 2002:a05:7412:1703:b0:e2:908c:2ebd with SMTP id dm3csp3078073rdb; Tue, 29 Aug 2023 05:00:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHRrnINMlx4eT6A/UGVDCPee3BPUNlzbB0v18w9we2T+QWVjTw5a4o3i/zhF04a3tyx5WgH X-Received: by 2002:a05:6a00:1a4f:b0:68a:5395:7aa9 with SMTP id h15-20020a056a001a4f00b0068a53957aa9mr20522066pfv.6.1693310427063; Tue, 29 Aug 2023 05:00:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693310427; cv=none; d=google.com; s=arc-20160816; b=hSHss8qzDXsaxR+jSLDBY/QUwuyLxDb5HcP8Fe6bH0a3wyjCWNXKgkJxTILOHSj4Hm e3GTpj0rYpnSQmab3E0AOAuwvoLBFsPKESS72PKkv/Vsu7dm3El6Z3eU26nNZxTKhkN2 bspZnYk9Fi7gk7cicecR5G769zLv6jtnAT7b1gzr1PWybWkzQ2Z0wKfrxFc4/6nB85lF 9Nkj7Yk2lOpapKL7ePFb2PJa7Ze3pFL29aeDSH5jNUxnoJj7EiXp0doSXkp27lwSWVyb XLV/f6Jl7eqE0/i0jf0gEOx3p7UhNSwCeJF8JfqMjb7H4Alj8A66XVzTeqwkacw/IC3W Vz6Q== 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=qfKu+/bnqYHOtnVeyPl0mBacMAK/u2PsFV/2pwS2GBA=; fh=r/VVG12KmrF+nQv7lC2x2sQ0qQnFs7bJUsMqdUzXKDU=; b=LmL5RJSMu0NYCA0+RH9hJmaOWgqD+MPZB1SuVOBmJUD447ZQXgaV8jYLyfICBBwvlU QriIEh/991RU+tF59jbB9mTuItaALWqP+3pbpgD5uSueXcns0aVBQVeCsoCkL5o+lOEK /b8R6OByrqKGIfzTKIcbBEYuVV26n4hT7480Z6G0+NPdu1w4KCsfiiokS8+zc2ZlKnpS pBfTTWJ+viUnWB5M0hHskjmGQ3L/3FMrg5UO3q/2NzrAq64ordjWaRYTqLzy66KuWRfo aPIq4h+HMDmz2991GUWWYGsujWL28kQMz2fbsqKdafy9j59J66OcgwjNItcccFHUjq9l 5pQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WVVrPESK; 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 fb12-20020a056a002d8c00b00686dd813934si10042334pfb.82.2023.08.29.05.00.07; Tue, 29 Aug 2023 05:00:27 -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=WVVrPESK; 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 S235241AbjH2Kye (ORCPT + 99 others); Tue, 29 Aug 2023 06:54:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52082 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235341AbjH2KyY (ORCPT ); Tue, 29 Aug 2023 06:54:24 -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 1180DE5D for ; Tue, 29 Aug 2023 03:53:56 -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 9309365469 for ; Tue, 29 Aug 2023 10:53:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A4E34C433D9; Tue, 29 Aug 2023 10:53:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1693306423; bh=9zmrYjn6LWQoCN8M+Pfq1cMEVS3X4afFI5xUTUylk9U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WVVrPESKLYcAUxzJmt5RAO+ycX88zWTndFYyE+Q94iGeJUeSk2tj1ca82lhJ9phtN QFcks0qmANxaz0vEwhUBNZxkftuZY3DxiIDwm1h3BoZMXDayn/yHibKkvugLcqtlzs sB2DjgbPLJ3T5omR1SXoE4SU3JmIlFlqcykhhAAqCvlYvpSSVEwZyYgNZyiLFAH1ef ur4OcijEYZmyQ72JJAhc3GclZs0qglAKH5YxLnPAUkWRrxt6Hrqss7lvYLABhPEglT qP2aXjnfg7YuvuvhrldQRMA+kGhpwWTRfBZEYa7qDhNFfA1l5WgS/j0gARvKCIvP56 iZZHa9GuWCBGg== 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 11/22] net: stmmac: dwmac-meson: use devm_stmmac_probe_config_dt() Date: Tue, 29 Aug 2023 18:40:22 +0800 Message-Id: <20230829104033.955-12-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 remove_new() callback now needs to be switched to stmmac_pltfr_remove_no_dt(). Signed-off-by: Jisheng Zhang --- .../net/ethernet/stmicro/stmmac/dwmac-meson.c | 27 +++++-------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c index 959f88c6da16..3373d3ec2368 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-meson.c @@ -52,35 +52,22 @@ static int meson6_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 err_remove_config_dt; - } + if (!dwmac) + return -ENOMEM; dwmac->reg = devm_platform_ioremap_resource(pdev, 1); - if (IS_ERR(dwmac->reg)) { - ret = PTR_ERR(dwmac->reg); - goto err_remove_config_dt; - } + if (IS_ERR(dwmac->reg)) + return PTR_ERR(dwmac->reg); plat_dat->bsp_priv = dwmac; plat_dat->fix_mac_speed = meson6_dwmac_fix_mac_speed; - ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); - if (ret) - goto err_remove_config_dt; - - return 0; - -err_remove_config_dt: - stmmac_remove_config_dt(pdev, plat_dat); - - return ret; + return stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); } static const struct of_device_id meson6_dwmac_match[] = { @@ -91,7 +78,7 @@ MODULE_DEVICE_TABLE(of, meson6_dwmac_match); static struct platform_driver meson6_dwmac_driver = { .probe = meson6_dwmac_probe, - .remove_new = stmmac_pltfr_remove, + .remove_new = stmmac_pltfr_remove_no_dt, .driver = { .name = "meson6-dwmac", .pm = &stmmac_pltfr_pm_ops, -- 2.40.1