Received: by 2002:a05:7412:1703:b0:e2:908c:2ebd with SMTP id dm3csp3115274rdb; Tue, 29 Aug 2023 06:03:20 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE5Kontvn2/+0zSpJnhIqx4tIw1mxgKR2/NPOUdp50K5XMNc4Glrbnc01xPs2JR89H3mYEd X-Received: by 2002:a17:902:e5d1:b0:1c0:cbaf:6930 with SMTP id u17-20020a170902e5d100b001c0cbaf6930mr15433641plf.54.1693314199698; Tue, 29 Aug 2023 06:03:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693314199; cv=none; d=google.com; s=arc-20160816; b=PIGxqo5BAA4GiGtxej5+2XcTy/PxmiOdzZi3/nmnz6EUW/GtZ6QilFoWhASrpxYlh9 mMWyX2xUzHwGjLTq40U3K69j1mo2gRvYp1vRYHGsnKXiIFQKWtgyza8VAS31zvxZWREY BdW85pGDujhNHPc3AdTYsxFf0T0zPVqpQA7lIznTRl04iLJv53RiUKVeDd/b2Ienwbtx SB8v1MvjA5hWf2HDXDzGoOsZo8FgkTgSLidxhcbcyoGqMI3ECdlLVMO7m+QTyTaE5R57 mpxZmeh538RHs2+LMm48UIM7OVefBpvUbOAVfOS1Y0E8cD2FyvstmzplMVCR0xVnW4U3 94Dg== 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=9OTT+JZ8B5AZP/dk95WZNBIxvAsigYYj4rOJQjlZFGw=; fh=r/VVG12KmrF+nQv7lC2x2sQ0qQnFs7bJUsMqdUzXKDU=; b=H7GwbYNks0wVuasIg41epUNK5vnYTVzPrluIhOQP98y2GN1kW7CORP0G8Xyu/X18tC hU/llDcQQ2m+SM5EIbDUVvBCBtMDjlHx/Pha0Kuc0NoLyi8I5qmEpf/5hiRdGcE/b0Dw E4f+vvNcHUsNHFPLxOVvgK/ztyAGaBVLqDNdtt0Z+6i8/nUHh8PRIoSYHmihuppKb2yA I/mivzmjNjis2Yd4riyzmDpshRMVCrX4f5bA/wsfbymSt5YbtJ6C3LAO+tuHZ7cgdv0u DYW04/bxqhg911i5qY8no0fTfsnVFkDL1qQFX9g2qDSFh/YsmwvHDjVBM0MtogDbAbbX wikg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="s5HtVQg/"; 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 q11-20020a170902a3cb00b001b7d2b55d8asi8744139plb.626.2023.08.29.06.02.48; Tue, 29 Aug 2023 06:03:19 -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="s5HtVQg/"; 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 S235335AbjH2Kx4 (ORCPT + 99 others); Tue, 29 Aug 2023 06:53:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57928 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232651AbjH2Kx0 (ORCPT ); Tue, 29 Aug 2023 06:53:26 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C19251A6 for ; Tue, 29 Aug 2023 03:53:23 -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 60ED565477 for ; Tue, 29 Aug 2023 10:53:23 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 042DCC433C9; Tue, 29 Aug 2023 10:53:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1693306402; bh=08rPVmjgSTC5liiFw2rBYcil6Ema5CtgYx2svnPVZ9s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=s5HtVQg/NZDq8bzJbfWKwq8tryUNgQg8yaetqX9K5c4yo0GDp9ttEHol3rIDBiylv EqcnhPRKkLuSs+3TWvl68Co1GKm+imRd60uNXw6y9E6CtGeP0OV/T1K8+6vJQH/4dz YiVGAU+O+9z6xtVPi91F3t921Dg/OBD+WA1r/bUFIXmqpdVJ+8VvtTigIKtt4jx4tS ny50lX/LrFOLgbrkzAewDhK0pb2sdjKB9k4ixh4RGy9dtHKWFDf5I6kixKtGhhjQ6j Im9sFPuT0ffHm81u97su6N9yYn00q58lTt3kIOgpepJDbH39G51kLhziUnjyG3fW6N K36iDXIcTja7Q== 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 08/22] net: stmmac: dwmac-ipq806x: use devm_stmmac_probe_config_dt() Date: Tue, 29 Aug 2023 18:40:19 +0800 Message-Id: <20230829104033.955-9-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=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 --- .../ethernet/stmicro/stmmac/dwmac-ipq806x.c | 29 ++++++------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c index 9b0200749109..a9916fd07616 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-ipq806x.c @@ -384,22 +384,20 @@ static int ipq806x_gmac_probe(struct platform_device *pdev) if (val) return val; - 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); gmac = devm_kzalloc(dev, sizeof(*gmac), GFP_KERNEL); - if (!gmac) { - err = -ENOMEM; - goto err_remove_config_dt; - } + if (!gmac) + return -ENOMEM; gmac->pdev = pdev; err = ipq806x_gmac_of_parse(gmac); if (err) { dev_err(dev, "device tree parsing error\n"); - goto err_remove_config_dt; + return err; } regmap_write(gmac->qsgmii_csr, QSGMII_PCS_CAL_LCKDT_CTL, @@ -459,11 +457,11 @@ static int ipq806x_gmac_probe(struct platform_device *pdev) if (gmac->phy_mode == PHY_INTERFACE_MODE_SGMII) { err = ipq806x_gmac_configure_qsgmii_params(gmac); if (err) - goto err_remove_config_dt; + return err; err = ipq806x_gmac_configure_qsgmii_pcs_speed(gmac); if (err) - goto err_remove_config_dt; + return err; } plat_dat->has_gmac = true; @@ -473,21 +471,12 @@ static int ipq806x_gmac_probe(struct platform_device *pdev) plat_dat->tx_fifo_size = 8192; plat_dat->rx_fifo_size = 8192; - err = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); - if (err) - goto err_remove_config_dt; - - return 0; + return stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); err_unsupported_phy: dev_err(&pdev->dev, "Unsupported PHY mode: \"%s\"\n", phy_modes(gmac->phy_mode)); - err = -EINVAL; - -err_remove_config_dt: - stmmac_remove_config_dt(pdev, plat_dat); - - return err; + return -EINVAL; } static const struct of_device_id ipq806x_gmac_dwmac_match[] = { @@ -498,7 +487,7 @@ MODULE_DEVICE_TABLE(of, ipq806x_gmac_dwmac_match); static struct platform_driver ipq806x_gmac_dwmac_driver = { .probe = ipq806x_gmac_probe, - .remove_new = stmmac_pltfr_remove, + .remove_new = stmmac_pltfr_remove_no_dt, .driver = { .name = "ipq806x-gmac-dwmac", .pm = &stmmac_pltfr_pm_ops, -- 2.40.1