From patchwork Mon Jun 12 09:23:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartosz Golaszewski X-Patchwork-Id: 106365 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp2460429vqr; Mon, 12 Jun 2023 02:33:45 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ40GtpoKIHc1wc2OPydIb1a+zIv4fJE5/hrXqdKS3RQT6Y6MzkaiFKqbSthRlvQnbrsod59 X-Received: by 2002:a17:903:11c3:b0:1b0:61dc:db67 with SMTP id q3-20020a17090311c300b001b061dcdb67mr6477761plh.30.1686562425437; Mon, 12 Jun 2023 02:33:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686562425; cv=none; d=google.com; s=arc-20160816; b=nRFAr93BYqvlGb/nbJAMoaKP/ClR0qBy9SOlJxeCs/ROBEeraaGaDv7qBLHvXjaMnC MY7eKVvhq63VE1lfTJ8b6+MahYgd/i80ko3BoKYf9RF2bfO8yJix02lRvtRw2YuIQXmB mKqsYN8oQtxq0bydA2fXBobLd7GNV9SYac/jADpaqcE1w1kHP44Tlf5po83TIHAtzLKe cNiU7vJLVve+htOsKUbGrUsxs6/xDgf606eu6EF8im+PWUqAsSTpnYyHgYde9WKyxsfs 00aB3BWDOaXtiR8u265MWfVmvPS7obZ9b0ubeEDDO9nOcybPvtDvOxEUU5Mf7INB0eqp +Qkg== 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=nw89zfIb59CUkEP5Ai7VazKbf1+XGop4tAXeykv2kzc=; b=XCIVuzcdEomEE7r9tQ5/BXTLaMr2tdTFwaJoOP/SKB9/67NZOpCKVh8cpkjEA8aWDA jnEyruqJppkji45VPZlRgJ11KEcHgaFgQQPCg2Gd3i9PEar/SCXVV/LJJIa/er7siONL dFzRAwveHVUhsU5T64IzFnNCyDgtYvA0NaakYvqvFkC7asfDFrBg/hnofmv43zY0q4IY hqtpwIi34biG7dVE/lDPAB9aV906Ui2pXbbbfBuvJPn4c4kKIyvRvmBeztQboN9z037L ToApTEJo06BcPHZW9eeny0gmRwdEH/yVDTgiRPlm1ZNVmTEmpbP/MfibnEgpmUZTPdpF 3SIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bgdev-pl.20221208.gappssmtp.com header.s=20221208 header.b=HRwjTwYe; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e6-20020a170902cf4600b001aad291018fsi6665943plg.350.2023.06.12.02.33.31; Mon, 12 Jun 2023 02:33:45 -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=@bgdev-pl.20221208.gappssmtp.com header.s=20221208 header.b=HRwjTwYe; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234858AbjFLJal (ORCPT + 99 others); Mon, 12 Jun 2023 05:30:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230186AbjFLJ3p (ORCPT ); Mon, 12 Jun 2023 05:29:45 -0400 Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D218EE62 for ; Mon, 12 Jun 2023 02:24:34 -0700 (PDT) Received: by mail-wm1-x32b.google.com with SMTP id 5b1f17b1804b1-3f6dfc4dffaso29771115e9.0 for ; Mon, 12 Jun 2023 02:24:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20221208.gappssmtp.com; s=20221208; t=1686561873; x=1689153873; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nw89zfIb59CUkEP5Ai7VazKbf1+XGop4tAXeykv2kzc=; b=HRwjTwYewLxWQA+IGypwGPKaQrnA/Wdf9eY6XI4irbPBTq5zqp+2jE6iNjFNtIYokW 2oIEi8K0Q2UE5Z4nrTuXXwlFdZVRdWBaBE7cy60Qy7h/+cwcRoMnGmDUebo+KXdoZpJL krYZKDOSyXAb2+9dK0/JnM/iDhOCDkbgaUG0trEr0awFRqhl55hQSXimZWLdwG1iVSKJ UWqoodIwJxKQa+GGye9WeMzU9XFxA9B8lZIsyeuOVvLx55vIwvivdM9BhrKky0GucXSe 3MeQ54jO/tnJl3G9RxNYKxVxEscpNh+t3vjVw/fQoj8SrecH7Q9NLffXL5EiKFZp2QiB d36A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686561873; x=1689153873; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nw89zfIb59CUkEP5Ai7VazKbf1+XGop4tAXeykv2kzc=; b=P/ox+93fdd/2Mfv09tSMZ9tIeTM4qzpjY+Y4g4cwKglyTFDB/iT8xFLVjVpzV3pP5+ UE+gAi2DZAoxNVXAA/f7sA3jWeajBgQxPlMjcPwN/aLyiquP87nmpk18xUKet9F4Fm/f T6mX8dPf5C0B2l9qA+I68rjkp14GH0ym+h/d/znajv7U1giJG95P7vVyUZFKE6I+IxMV UUyv0Vx5RILLZjBcyTH8F4oTEp4pJ5c22Aqb9F2ull/8a/W5KBSOt4ty0zbFIG6RDLQH hIFpmfyW0VGp2pD6fiPcIRBfCyBKRaz4xqo9ZiIt8U6wEo4ilke7LNi8cUhyDhyK2a7I IukQ== X-Gm-Message-State: AC+VfDxZQy7Vc3cgMGttyyQlQHzfwEU96x5XERKQWD8j5hD4SM+ebZsC MRkO2J2UEBlz7FAz0Gclj+IuPA== X-Received: by 2002:a7b:c347:0:b0:3f7:e7d5:6123 with SMTP id l7-20020a7bc347000000b003f7e7d56123mr5820770wmj.41.1686561873262; Mon, 12 Jun 2023 02:24:33 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:334:ac00:a222:bbe9:c688:33ae]) by smtp.gmail.com with ESMTPSA id p14-20020a7bcc8e000000b003f727764b10sm10892044wma.4.2023.06.12.02.24.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Jun 2023 02:24:32 -0700 (PDT) From: Bartosz Golaszewski To: Vinod Koul , Bhupesh Sharma , Andy Gross , Bjorn Andersson , Konrad Dybcio , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Kishon Vijay Abraham I , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu Cc: netdev@vger.kernel.org, linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, Bartosz Golaszewski Subject: [PATCH 05/26] net: stmmac: dwmac-qcom-ethqos: shrink clock code with devres Date: Mon, 12 Jun 2023 11:23:34 +0200 Message-Id: <20230612092355.87937-6-brgl@bgdev.pl> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230612092355.87937-1-brgl@bgdev.pl> References: <20230612092355.87937-1-brgl@bgdev.pl> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1768488881980139571?= X-GMAIL-MSGID: =?utf-8?q?1768488881980139571?= From: Bartosz Golaszewski We can use a devm action to completely drop the remove callback and use stmmac_pltfr_remove() directly for remove. We can also drop one of the goto labels. Signed-off-by: Bartosz Golaszewski Reviewed-by: Andrew Halaney --- .../stmicro/stmmac/dwmac-qcom-ethqos.c | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c index c801838fae2a..2da0738eed24 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c @@ -586,6 +586,11 @@ static int ethqos_clks_config(void *priv, bool enabled) return ret; } +static void ethqos_clks_disable(void *data) +{ + ethqos_clks_config(data, false); +} + static int qcom_ethqos_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; @@ -636,6 +641,10 @@ static int qcom_ethqos_probe(struct platform_device *pdev) if (ret) goto err_mem; + ret = devm_add_action_or_reset(&pdev->dev, ethqos_clks_disable, ethqos); + if (ret) + goto err_mem; + ethqos->speed = SPEED_1000; ethqos_update_rgmii_clk(ethqos, SPEED_1000); ethqos_set_func_clk_en(ethqos); @@ -653,27 +662,16 @@ static int qcom_ethqos_probe(struct platform_device *pdev) ret = stmmac_dvr_probe(&pdev->dev, plat_dat, &stmmac_res); if (ret) - goto err_clk; + goto err_mem; return ret; -err_clk: - ethqos_clks_config(ethqos, false); - err_mem: stmmac_remove_config_dt(pdev, plat_dat); return ret; } -static void qcom_ethqos_remove(struct platform_device *pdev) -{ - struct qcom_ethqos *ethqos = get_stmmac_bsp_priv(&pdev->dev); - - stmmac_pltfr_remove(pdev); - ethqos_clks_config(ethqos, false); -} - static const struct of_device_id qcom_ethqos_match[] = { { .compatible = "qcom,qcs404-ethqos", .data = &emac_v2_3_0_data}, { .compatible = "qcom,sc8280xp-ethqos", .data = &emac_v3_0_0_data}, @@ -684,7 +682,7 @@ MODULE_DEVICE_TABLE(of, qcom_ethqos_match); static struct platform_driver qcom_ethqos_driver = { .probe = qcom_ethqos_probe, - .remove_new = qcom_ethqos_remove, + .remove_new = stmmac_pltfr_remove, .driver = { .name = "qcom-ethqos", .pm = &stmmac_pltfr_pm_ops,