Received: by 2002:a05:7412:1703:b0:e2:908c:2ebd with SMTP id dm3csp3090496rdb; Tue, 29 Aug 2023 05:18:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGkhmRBT6SxGdVJACr2NxC5UVFct5t32sE/MkRKc7Bah5rR/vhC9DHyE1quCN5kH18OhgPO X-Received: by 2002:a17:907:6e2a:b0:9a5:8269:2c94 with SMTP id sd42-20020a1709076e2a00b009a582692c94mr9112147ejc.57.1693311534884; Tue, 29 Aug 2023 05:18:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693311534; cv=none; d=google.com; s=arc-20160816; b=CLtx9bkP5P3uegVcNDcDeJOM+0lBvCXkkaTdW1OuxUmN+nGVCzAQ5bQ3MuZewXnQvI e5zqhQqiiHIR5h1D2KZrqpthM4K3V8268YVy4DyYCZezRk0nHZOB7LLb8nLHwZoLICdw 4scWnxPCdgNZdrQRsr+4hMJk+aBw1SjPuX6Z/bXgSSYxcL3SoNNz4bxrGXXI3XZlkexf lr3nb8ykcduTIAM2uMqhQt7E6d2DAv2i87rnCVnQn7KOIq0T/3C7Iw+f+mVmrlfYLyXd LMZW/2w2opNP3FQRaEuGRr0K2NonhiJ7xWXY7yLJuT/4mP6QgoSkwu91nmQhKUdXW6qM b+hA== 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=j2/mmLLXplvYD5E/jacFSncwT0qy8trqwYgNj4S9A+E=; fh=r/VVG12KmrF+nQv7lC2x2sQ0qQnFs7bJUsMqdUzXKDU=; b=voxxDlZ9du7bZ9eKrh22sjHyM/7dOtCgyQra4MfslkxyTe6ugS9m9TSA8OzEl4ACT+ WMabOqXT2ShFnjffpdVXLkNbc2glg7jxksx6v6YOUlYJ7/LAo9rtVia3SxDKq7UkuCzE bLlyQMDlKzg2FugoH9Gi5vulfBeINX+D8/t7mbsuTHTrKy9eUad/nOEXM9jH/qo4zyUk G3VED6wZ9OzuHhFkNHT0AJCr1HVAqsWrI5xcW8sSiTxNtBEqfTrFpQT73AwZ3fWujjOA 9Q9R2onRvAmdbTxxHJzNCp8+RLH1UsCvvQe3dqEHx4ZyKXxrZAiVutF59JpR/USnVZ8D wrqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LvYuLlXS; 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 t25-20020a1709063e5900b009936735fecdsi3618588eji.901.2023.08.29.05.18.18; Tue, 29 Aug 2023 05:18:54 -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=LvYuLlXS; 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 S235181AbjH2Kxb (ORCPT + 99 others); Tue, 29 Aug 2023 06:53:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58274 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232196AbjH2KxN (ORCPT ); Tue, 29 Aug 2023 06:53:13 -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 2E2F7AB for ; Tue, 29 Aug 2023 03:53:10 -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 9F8426545B for ; Tue, 29 Aug 2023 10:53:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E253C433C9; Tue, 29 Aug 2023 10:53:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1693306389; bh=8DqJfXvXVRDqjgnN3KzU58KERFF7Sd7wLkdDZEnq1nM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LvYuLlXSmmeQx/p8z2LlIFcUnd1Wz1BTu0KVbRnLzCOGSy+uQHFbTcnxL6y5CLgSs eTvMrXGUuCsF/O6tYuz6BQwLnivxtNtHu3ki3LZOE7eVKU7lAzCeCHftBgOpL2gfID ztgBHJxUuTh6N+erP5/cpySQMwKzQ/Ynhb0hKjPqqe/scUWzweTRg7I9SVhD+Z4Ls+ IHg7sljE+n5DZkPLztM10xyvPtO6YR2QOJt3BELwd8tE0JaFrKPePk+McRA16eJyrp 4Uo4N550cUnSc9aC1xQ/WlMdPGj7mMKwFAGWgeMz6h4MDd+H0DTHZ/ZNScT1I68Aiq RgISSV7S3+wgg== 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 06/22] net: stmmac: dwmac-ingenic: use devm_stmmac_probe_config_dt() Date: Tue, 29 Aug 2023 18:40:17 +0800 Message-Id: <20230829104033.955-7-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 --- .../ethernet/stmicro/stmmac/dwmac-ingenic.c | 35 ++++++------------- 1 file changed, 10 insertions(+), 25 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c index e22ef0d6bc73..ddfd7af63492 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-ingenic.c @@ -241,29 +241,25 @@ static int ingenic_mac_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); mac = devm_kzalloc(&pdev->dev, sizeof(*mac), GFP_KERNEL); - if (!mac) { - ret = -ENOMEM; - goto err_remove_config_dt; - } + if (!mac) + return -ENOMEM; data = of_device_get_match_data(&pdev->dev); if (!data) { dev_err(&pdev->dev, "No of match data provided\n"); - ret = -EINVAL; - goto err_remove_config_dt; + return -EINVAL; } /* Get MAC PHY control register */ mac->regmap = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, "mode-reg"); if (IS_ERR(mac->regmap)) { dev_err(&pdev->dev, "%s: Failed to get syscon regmap\n", __func__); - ret = PTR_ERR(mac->regmap); - goto err_remove_config_dt; + return PTR_ERR(mac->regmap); } if (!of_property_read_u32(pdev->dev.of_node, "tx-clk-delay-ps", &tx_delay_ps)) { @@ -272,8 +268,7 @@ static int ingenic_mac_probe(struct platform_device *pdev) mac->tx_delay = tx_delay_ps * 1000; } else { dev_err(&pdev->dev, "Invalid TX clock delay: %dps\n", tx_delay_ps); - ret = -EINVAL; - goto err_remove_config_dt; + return -EINVAL; } } @@ -283,8 +278,7 @@ static int ingenic_mac_probe(struct platform_device *pdev) mac->rx_delay = rx_delay_ps * 1000; } else { dev_err(&pdev->dev, "Invalid RX clock delay: %dps\n", rx_delay_ps); - ret = -EINVAL; - goto err_remove_config_dt; + return -EINVAL; } } @@ -295,18 +289,9 @@ static int ingenic_mac_probe(struct platform_device *pdev) ret = ingenic_mac_init(plat_dat); if (ret) - goto err_remove_config_dt; - - 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 ret; + return stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); } #ifdef CONFIG_PM_SLEEP @@ -385,7 +370,7 @@ MODULE_DEVICE_TABLE(of, ingenic_mac_of_matches); static struct platform_driver ingenic_mac_driver = { .probe = ingenic_mac_probe, - .remove_new = stmmac_pltfr_remove, + .remove_new = stmmac_pltfr_remove_no_dt, .driver = { .name = "ingenic-mac", .pm = pm_ptr(&ingenic_mac_pm_ops), -- 2.40.1