From patchwork Sun Jan 3 03:54:45 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 356181 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EAB29C43331 for ; Sun, 3 Jan 2021 03:56:09 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D3E9520936 for ; Sun, 3 Jan 2021 03:56:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725827AbhACDzs (ORCPT ); Sat, 2 Jan 2021 22:55:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52034 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726512AbhACDzs (ORCPT ); Sat, 2 Jan 2021 22:55:48 -0500 Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3F15C0613CF; Sat, 2 Jan 2021 19:55:07 -0800 (PST) Received: by mail-pg1-x52e.google.com with SMTP id v19so16561270pgj.12; Sat, 02 Jan 2021 19:55:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=XukCghNiyOItZhHaZYN/GSrSL5U50HSG0l4LszYD+Co=; b=YKg7J93UN+43tgiOnq52fm9GQJNJt8EzL0xhqubddoujHgkE6oqBQbiylU9wCJ0ugP t7ei6QE6u2qNut7tLfJIvddWZj1EOvm7EWvxIxQWPDVcaMly5FywYUNKjuDaEDGQtSeZ g80TdfUR8svyTcpN4r3lAg4UKTQtCIWJzWvLDvwp6vdp6RhY/b7hbW8ErpScpfbpKiHk DUZvL/mpfw1msfOEX4ljnKoWshzYRLHH/pH1tFwfm9Am7ljlg28wTm+S4izfKEGzxIm4 Ov8IDeDWD2wzaOWLyjEqbGfJjCmNV5ywp7ylpoz+hdQ0IUvZvhiLLUG+xTGmA7m7chVh qFKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=XukCghNiyOItZhHaZYN/GSrSL5U50HSG0l4LszYD+Co=; b=dfbxVBlDPgaI+VJLkCJn3Q91e321KTLO5V5CzFA2jmXrpTOpKNWB/UKqmq/jR3lECY VFcrV+5bjrsxZ7rV7g1hthLr18bEJF32Yr69oInQXWnr503mqT8AXvwBz5/jky+6RFRK mpplBROJKtF6gKYJ+aiBvvRAowTBmAnwjUk/EcHe+GwJZSPWZrTH9oQ9/Ihoirp0qcB2 IFFGh78RPaeWGqiP9D/wNCMKHECQUU1qX7lHBhgYnEiiDSEe4uv6aSHrAgsNTpQy89hG fnG6KNwsAfuV7ze/jLCPk4aKkdCyUvcyjbt6JMOfewUvXjwuF8HAuhLRUKzgLOBP7DHi f0ew== X-Gm-Message-State: AOAM530VeaKFzXia41a8SyUymF6gbQ8nacj1Rm4Ve4sH/k1LxSfkgMQw clmQ+ilaAIn1XDsvcZncrb4= X-Google-Smtp-Source: ABdhPJztzvvTllaqz7ejOV4bbiE80gA6URGwLsGIb0AJ86cxZXMSpVpCDIvAE+92iRA1fFhFsGEGMw== X-Received: by 2002:a62:7c4a:0:b029:19d:b7bc:2c51 with SMTP id x71-20020a627c4a0000b029019db7bc2c51mr61899143pfc.30.1609646107481; Sat, 02 Jan 2021 19:55:07 -0800 (PST) Received: from localhost.localdomain ([43.255.31.23]) by smtp.gmail.com with ESMTPSA id z3sm10967448pfb.157.2021.01.02.19.54.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Jan 2021 19:55:06 -0800 (PST) From: Yangtao Li To: myungjoo.ham@samsung.com, kyungmin.park@samsung.com, cw00.choi@samsung.com, krzk@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, digetx@gmail.com, thierry.reding@gmail.com, jonathanh@nvidia.com, yuq825@gmail.com, airlied@linux.ie, daniel@ffwll.ch, robdclark@gmail.com, sean@poorly.run, robh@kernel.org, tomeu.vizoso@collabora.com, steven.price@arm.com, alyssa.rosenzweig@collabora.com, stanimir.varbanov@linaro.org, agross@kernel.org, bjorn.andersson@linaro.org, mchehab@kernel.org, lukasz.luba@arm.com, adrian.hunter@intel.com, ulf.hansson@linaro.org, vireshk@kernel.org, nm@ti.com, sboyd@kernel.org, broonie@kernel.org, gregkh@linuxfoundation.org, jirislaby@kernel.org, rjw@rjwysocki.net, jcrouse@codeaurora.org, hoegsberg@google.com, eric@anholt.net, tzimmermann@suse.de, marijn.suijten@somainline.org, gustavoars@kernel.org, emil.velikov@collabora.com, jonathan@marek.ca, akhilpo@codeaurora.org, smasetty@codeaurora.org, airlied@redhat.com, masneyb@onstation.org, kalyan_t@codeaurora.org, tanmay@codeaurora.org, tiny.windzz@gmail.com, ddavenport@chromium.org, jsanka@codeaurora.org, rnayak@codeaurora.org, tongtiangen@huawei.com, miaoqinglang@huawei.com, khsieh@codeaurora.org, abhinavk@codeaurora.org, chandanu@codeaurora.org, groeck@chromium.org, varar@codeaurora.org, mka@chromium.org, harigovi@codeaurora.org, rikard.falkeborn@gmail.com, natechancellor@gmail.com, georgi.djakov@linaro.org, akashast@codeaurora.org, parashar@codeaurora.org, dianders@chromium.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-tegra@vger.kernel.org, dri-devel@lists.freedesktop.org, lima@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, linux-media@vger.kernel.org, linux-mmc@vger.kernel.org, linux-spi@vger.kernel.org, linux-serial@vger.kernel.org Subject: [PATCH 26/31] PM / devfreq: tegra30: convert to use devm_pm_opp_* API Date: Sun, 3 Jan 2021 03:54:45 +0000 Message-Id: <20210103035445.23696-1-tiny.windzz@gmail.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use devm_pm_opp_* API to simplify code, and remove opp_table from tegra_devfreq. Signed-off-by: Yangtao Li --- drivers/devfreq/tegra30-devfreq.c | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/drivers/devfreq/tegra30-devfreq.c b/drivers/devfreq/tegra30-devfreq.c index 117cad7968ab..4984cb91e9ea 100644 --- a/drivers/devfreq/tegra30-devfreq.c +++ b/drivers/devfreq/tegra30-devfreq.c @@ -178,7 +178,6 @@ struct tegra_devfreq_soc_data { struct tegra_devfreq { struct devfreq *devfreq; - struct opp_table *opp_table; struct reset_control *reset; struct clk *clock; @@ -794,6 +793,7 @@ static int tegra_devfreq_probe(struct platform_device *pdev) struct tegra_devfreq_device *dev; struct tegra_devfreq *tegra; struct devfreq *devfreq; + struct opp_tabl *opp_table; unsigned int i; long rate; int err; @@ -841,25 +841,25 @@ static int tegra_devfreq_probe(struct platform_device *pdev) return err; } - tegra->opp_table = dev_pm_opp_set_supported_hw(&pdev->dev, - &hw_version, 1); - err = PTR_ERR_OR_ZERO(tegra->opp_table); + opp_table = devm_pm_opp_set_supported_hw(&pdev->dev, + &hw_version, 1); + err = PTR_ERR_OR_ZERO(opp_table); if (err) { dev_err(&pdev->dev, "Failed to set supported HW: %d\n", err); return err; } - err = dev_pm_opp_of_add_table(&pdev->dev); + err = devm_pm_opp_of_add_table(&pdev->dev); if (err) { dev_err(&pdev->dev, "Failed to add OPP table: %d\n", err); - goto put_hw; + return err; } err = clk_prepare_enable(tegra->clock); if (err) { dev_err(&pdev->dev, "Failed to prepare and enable ACTMON clock\n"); - goto remove_table; + return err; } err = reset_control_reset(tegra->reset); @@ -917,10 +917,6 @@ static int tegra_devfreq_probe(struct platform_device *pdev) reset_control_reset(tegra->reset); disable_clk: clk_disable_unprepare(tegra->clock); -remove_table: - dev_pm_opp_of_remove_table(&pdev->dev); -put_hw: - dev_pm_opp_put_supported_hw(tegra->opp_table); return err; } @@ -935,9 +931,6 @@ static int tegra_devfreq_remove(struct platform_device *pdev) reset_control_reset(tegra->reset); clk_disable_unprepare(tegra->clock); - dev_pm_opp_of_remove_table(&pdev->dev); - dev_pm_opp_put_supported_hw(tegra->opp_table); - return 0; } From patchwork Sun Jan 3 03:55:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 356180 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5386BC433E0 for ; Sun, 3 Jan 2021 03:56:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2D58720936 for ; Sun, 3 Jan 2021 03:56:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726665AbhACD4j (ORCPT ); Sat, 2 Jan 2021 22:56:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52166 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726512AbhACD4i (ORCPT ); Sat, 2 Jan 2021 22:56:38 -0500 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0686C0613C1; Sat, 2 Jan 2021 19:55:58 -0800 (PST) Received: by mail-pl1-x62b.google.com with SMTP id j1so12673433pld.3; Sat, 02 Jan 2021 19:55:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=SxpOyeiM3z18aNMuDs4uqaleFHYcq3v3an1mAR1G/5I=; b=AfqoZriugPzwzYSNyVjK7DhI0hUXwCi2rh6VXlP87GQQa5fjpFiZGRGOKaa2bVC6qS KNUGWoDbWwi99UvbXCoiMLncRbhKM90XVtGVix8wNxybq0PPu1+ANZovkGJ756+3RFhR zP9nG/12bnrj5Ey60RFSl4qHGJol0jCLf9L4aQm1kwh4H56RYa/55+iY9tIgt++AW74x mXgK8k3GTn0nq6GOCImWE6OxFd8cyGibeXduGU/UJnKTASfEHM+ZKRR8oQI5JGn3qfJV M83qVzQsm8/sxJuz1JjMaoaibL2VVkB00j++VrDnODpsrfBQfYod9P5VyZH8xa8sT7su muLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=SxpOyeiM3z18aNMuDs4uqaleFHYcq3v3an1mAR1G/5I=; b=qa8NCsO46XRrbzZbBC601U+Vi0aeoOi5Y/0yufdJdSYTeWRugMExeIEI8pr+1gT9Ly j4ywF3f39d6xzUlU+abxl66C4ux18MCKmBPb0yBGGnzQxTbra3D18OpX6PdRNzm0LAiP YpxHARFpVVHg4ipLhrj48dJGo6JymjykHrB1d7YXb5pfs0pyB5TqfwgC1jIXpr1MDF9L VELqgRoISZh4SlZs1/AnKW1jRS+hUnvYDYX/8RwA4QEod9WEGyyDTd1Kw8EDGvD73Y+N RC8PfSMdRubW+fVEtVnI+rdZmt+tqw9fqVtFpjSKmy338wqC2HuIHZSQFn/hBFr4FFR3 YOBw== X-Gm-Message-State: AOAM533OfMgdneAtQEi3HxN7WQDLreqZXXBxgHZdxDe9xYf4SH4jPKpP kXlR7cTES7ACRMfH3q2ZOFU= X-Google-Smtp-Source: ABdhPJw9UCd2o0dVAOrYYYoU83PIRdrJPypmz/g74Y1c9s2nzpejBc2/fDlERUdGOBi5P6mnd+gbww== X-Received: by 2002:a17:902:7489:b029:da:5aed:8ebf with SMTP id h9-20020a1709027489b02900da5aed8ebfmr66298619pll.35.1609646158201; Sat, 02 Jan 2021 19:55:58 -0800 (PST) Received: from localhost.localdomain ([43.255.31.23]) by smtp.gmail.com with ESMTPSA id f67sm45500049pfg.159.2021.01.02.19.55.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Jan 2021 19:55:57 -0800 (PST) From: Yangtao Li To: myungjoo.ham@samsung.com, kyungmin.park@samsung.com, cw00.choi@samsung.com, krzk@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, digetx@gmail.com, thierry.reding@gmail.com, jonathanh@nvidia.com, yuq825@gmail.com, airlied@linux.ie, daniel@ffwll.ch, robdclark@gmail.com, sean@poorly.run, robh@kernel.org, tomeu.vizoso@collabora.com, steven.price@arm.com, alyssa.rosenzweig@collabora.com, stanimir.varbanov@linaro.org, agross@kernel.org, bjorn.andersson@linaro.org, mchehab@kernel.org, lukasz.luba@arm.com, adrian.hunter@intel.com, ulf.hansson@linaro.org, vireshk@kernel.org, nm@ti.com, sboyd@kernel.org, broonie@kernel.org, gregkh@linuxfoundation.org, jirislaby@kernel.org, rjw@rjwysocki.net, jcrouse@codeaurora.org, hoegsberg@google.com, eric@anholt.net, tzimmermann@suse.de, marijn.suijten@somainline.org, gustavoars@kernel.org, emil.velikov@collabora.com, jonathan@marek.ca, akhilpo@codeaurora.org, smasetty@codeaurora.org, airlied@redhat.com, masneyb@onstation.org, kalyan_t@codeaurora.org, tanmay@codeaurora.org, tiny.windzz@gmail.com, ddavenport@chromium.org, jsanka@codeaurora.org, rnayak@codeaurora.org, tongtiangen@huawei.com, miaoqinglang@huawei.com, khsieh@codeaurora.org, abhinavk@codeaurora.org, chandanu@codeaurora.org, groeck@chromium.org, varar@codeaurora.org, mka@chromium.org, harigovi@codeaurora.org, rikard.falkeborn@gmail.com, natechancellor@gmail.com, georgi.djakov@linaro.org, akashast@codeaurora.org, parashar@codeaurora.org, dianders@chromium.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-tegra@vger.kernel.org, dri-devel@lists.freedesktop.org, lima@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, linux-media@vger.kernel.org, linux-mmc@vger.kernel.org, linux-spi@vger.kernel.org, linux-serial@vger.kernel.org Subject: [PATCH 28/31] PM / devfreq: imx8m-ddrc: convert to use devm_pm_opp_* API Date: Sun, 3 Jan 2021 03:55:40 +0000 Message-Id: <20210103035540.23886-1-tiny.windzz@gmail.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use devm_pm_opp_* API to simplify code. Signed-off-by: Yangtao Li --- drivers/devfreq/imx8m-ddrc.c | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/drivers/devfreq/imx8m-ddrc.c b/drivers/devfreq/imx8m-ddrc.c index bc82d3653bff..9383d6e5538b 100644 --- a/drivers/devfreq/imx8m-ddrc.c +++ b/drivers/devfreq/imx8m-ddrc.c @@ -370,11 +370,6 @@ static int imx8m_ddrc_check_opps(struct device *dev) return 0; } -static void imx8m_ddrc_exit(struct device *dev) -{ - dev_pm_opp_of_remove_table(dev); -} - static int imx8m_ddrc_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -419,7 +414,7 @@ static int imx8m_ddrc_probe(struct platform_device *pdev) return ret; } - ret = dev_pm_opp_of_add_table(dev); + ret = devm_pm_opp_of_add_table(dev); if (ret < 0) { dev_err(dev, "failed to get OPP table\n"); return ret; @@ -427,12 +422,11 @@ static int imx8m_ddrc_probe(struct platform_device *pdev) ret = imx8m_ddrc_check_opps(dev); if (ret < 0) - goto err; + return ret; priv->profile.polling_ms = 1000; priv->profile.target = imx8m_ddrc_target; priv->profile.get_dev_status = imx8m_ddrc_get_dev_status; - priv->profile.exit = imx8m_ddrc_exit; priv->profile.get_cur_freq = imx8m_ddrc_get_cur_freq; priv->profile.initial_freq = clk_get_rate(priv->dram_core); @@ -441,13 +435,8 @@ static int imx8m_ddrc_probe(struct platform_device *pdev) if (IS_ERR(priv->devfreq)) { ret = PTR_ERR(priv->devfreq); dev_err(dev, "failed to add devfreq device: %d\n", ret); - goto err; } - return 0; - -err: - dev_pm_opp_of_remove_table(dev); return ret; } From patchwork Sun Jan 3 03:56:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yangtao Li X-Patchwork-Id: 356179 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A04E4C433E0 for ; Sun, 3 Jan 2021 03:57:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 699AF2078E for ; Sun, 3 Jan 2021 03:57:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726434AbhACD5k (ORCPT ); Sat, 2 Jan 2021 22:57:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726333AbhACD5j (ORCPT ); Sat, 2 Jan 2021 22:57:39 -0500 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AAF42C0613C1; Sat, 2 Jan 2021 19:56:59 -0800 (PST) Received: by mail-pj1-x102d.google.com with SMTP id l23so8365649pjg.1; Sat, 02 Jan 2021 19:56:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=UYvvP6SStchIhnOCc/d2wO2luke2y75zaTjf1k4T2Gc=; b=lRhaXcQf+r5f3C6MFuktoCpUcGXDv+WzTWpQU9uFbd8tMxVgdzi2F19mlgk0WTSzWw JSQJKBV1A7YHffSJVtpzhAStCmrKxZu8eaQTwaBrcUyEE5ZWRfAVuujWCcwbTq+nG5y0 BtJ76pMOyL9ReowwYpmf6+rp3LBpSFZe9qFLaMxKC8Hsp0GY53GUvx5y7X3E+JQ4301L khHs5diQLNpB08Ncf58Hi15L0rbkiF6I3AxLUixuXNY4sEn6/1bf4prjKGaySV4PZld8 kzZuISyPM92YQI2xQjm4qXT9E+lfwtKHbAyAneEkLXc5gdFyETACmNQDvJ8lSSKw2KBq zgpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=UYvvP6SStchIhnOCc/d2wO2luke2y75zaTjf1k4T2Gc=; b=Lsr/7nPzY/MI6+8t+3N9M5YweycJtTK66yzbuw65MbKeGg8KdTbLPzg7+FzQmXHuKY j0x0RGsJX7dH/a6SdbUpytPITtiCkVQNhLjFRio6iN3pIYBayAP38N+bB1d40YR+pKbD t9fYLYNF/sYwulSR4PwY8jY+Tedly1OLJzIz/e0c4MqbaG2YYj0fC4ZAdtfZdtngFK96 HNGFsmvX0JkWbpMMvZXd9twOLcLkmvVs/gF2T5kisIeQ/maUZ3Y5xtXqbd52CkJN8rdI ud98lozBg8z1GShIp31OU2VoOHEV4JyMxaMoWF+1tgYd4SWTsbVi/9ORBWRgCATmsaG1 +uhA== X-Gm-Message-State: AOAM530eM3oDnG1cj3Nyz7pdkH9tk97LQmjCLIDzy+KgadPsiNYBVl/h ogQRfFIWxcsGCooNv7F0ZBA= X-Google-Smtp-Source: ABdhPJx3h+oZWgPqlK+4gKf036fKNpQsVwd9V4GzEO/e57owVPNM0pZq32dnWf5IdKt6unK4FXIp7Q== X-Received: by 2002:a17:90b:68e:: with SMTP id m14mr23932071pjz.228.1609646219284; Sat, 02 Jan 2021 19:56:59 -0800 (PST) Received: from localhost.localdomain ([43.255.31.23]) by smtp.gmail.com with ESMTPSA id iq3sm17030533pjb.57.2021.01.02.19.56.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Jan 2021 19:56:58 -0800 (PST) From: Yangtao Li To: myungjoo.ham@samsung.com, kyungmin.park@samsung.com, cw00.choi@samsung.com, krzk@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, digetx@gmail.com, thierry.reding@gmail.com, jonathanh@nvidia.com, yuq825@gmail.com, airlied@linux.ie, daniel@ffwll.ch, robdclark@gmail.com, sean@poorly.run, robh@kernel.org, tomeu.vizoso@collabora.com, steven.price@arm.com, alyssa.rosenzweig@collabora.com, stanimir.varbanov@linaro.org, agross@kernel.org, bjorn.andersson@linaro.org, mchehab@kernel.org, lukasz.luba@arm.com, adrian.hunter@intel.com, ulf.hansson@linaro.org, vireshk@kernel.org, nm@ti.com, sboyd@kernel.org, broonie@kernel.org, gregkh@linuxfoundation.org, jirislaby@kernel.org, rjw@rjwysocki.net, jcrouse@codeaurora.org, hoegsberg@google.com, eric@anholt.net, tzimmermann@suse.de, marijn.suijten@somainline.org, gustavoars@kernel.org, emil.velikov@collabora.com, jonathan@marek.ca, akhilpo@codeaurora.org, smasetty@codeaurora.org, airlied@redhat.com, masneyb@onstation.org, kalyan_t@codeaurora.org, tanmay@codeaurora.org, tiny.windzz@gmail.com, ddavenport@chromium.org, jsanka@codeaurora.org, rnayak@codeaurora.org, tongtiangen@huawei.com, miaoqinglang@huawei.com, khsieh@codeaurora.org, abhinavk@codeaurora.org, chandanu@codeaurora.org, groeck@chromium.org, varar@codeaurora.org, mka@chromium.org, harigovi@codeaurora.org, rikard.falkeborn@gmail.com, natechancellor@gmail.com, georgi.djakov@linaro.org, akashast@codeaurora.org, parashar@codeaurora.org, dianders@chromium.org Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-tegra@vger.kernel.org, dri-devel@lists.freedesktop.org, lima@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, linux-media@vger.kernel.org, linux-mmc@vger.kernel.org, linux-spi@vger.kernel.org, linux-serial@vger.kernel.org Subject: [PATCH 30/31] PM / devfreq: exynos: convert to use devm_pm_opp_* API Date: Sun, 3 Jan 2021 03:56:39 +0000 Message-Id: <20210103035639.24076-1-tiny.windzz@gmail.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Use devm_pm_opp_* API to simplify code, and remove opp_table from exynos_bus. Signed-off-by: Yangtao Li --- drivers/devfreq/exynos-bus.c | 42 ++++++++---------------------------- 1 file changed, 9 insertions(+), 33 deletions(-) diff --git a/drivers/devfreq/exynos-bus.c b/drivers/devfreq/exynos-bus.c index e689101abc93..51752e5ce980 100644 --- a/drivers/devfreq/exynos-bus.c +++ b/drivers/devfreq/exynos-bus.c @@ -33,7 +33,6 @@ struct exynos_bus { unsigned long curr_freq; - struct opp_table *opp_table; struct clk *clk; unsigned int ratio; }; @@ -159,10 +158,7 @@ static void exynos_bus_exit(struct device *dev) platform_device_unregister(bus->icc_pdev); - dev_pm_opp_of_remove_table(dev); clk_disable_unprepare(bus->clk); - dev_pm_opp_put_regulators(bus->opp_table); - bus->opp_table = NULL; } static void exynos_bus_passive_exit(struct device *dev) @@ -171,7 +167,6 @@ static void exynos_bus_passive_exit(struct device *dev) platform_device_unregister(bus->icc_pdev); - dev_pm_opp_of_remove_table(dev); clk_disable_unprepare(bus->clk); } @@ -183,15 +178,13 @@ static int exynos_bus_parent_parse_of(struct device_node *np, const char *vdd = "vdd"; int i, ret, count, size; - opp_table = dev_pm_opp_set_regulators(dev, &vdd, 1); + opp_table = devm_pm_opp_set_regulators(dev, &vdd, 1); if (IS_ERR(opp_table)) { ret = PTR_ERR(opp_table); dev_err(dev, "failed to set regulators %d\n", ret); return ret; } - bus->opp_table = opp_table; - /* * Get the devfreq-event devices to get the current utilization of * buses. This raw data will be used in devfreq ondemand governor. @@ -199,25 +192,20 @@ static int exynos_bus_parent_parse_of(struct device_node *np, count = devfreq_event_get_edev_count(dev, "devfreq-events"); if (count < 0) { dev_err(dev, "failed to get the count of devfreq-event dev\n"); - ret = count; - goto err_regulator; + return count; } bus->edev_count = count; size = sizeof(*bus->edev) * count; bus->edev = devm_kzalloc(dev, size, GFP_KERNEL); - if (!bus->edev) { - ret = -ENOMEM; - goto err_regulator; - } + if (!bus->edev) + return -ENOMEM; for (i = 0; i < count; i++) { bus->edev[i] = devfreq_event_get_edev_by_phandle(dev, "devfreq-events", i); - if (IS_ERR(bus->edev[i])) { - ret = -EPROBE_DEFER; - goto err_regulator; - } + if (IS_ERR(bus->edev[i])) + return -EPROBE_DEFER; } /* @@ -234,12 +222,6 @@ static int exynos_bus_parent_parse_of(struct device_node *np, bus->ratio = DEFAULT_SATURATION_RATIO; return 0; - -err_regulator: - dev_pm_opp_put_regulators(bus->opp_table); - bus->opp_table = NULL; - - return ret; } static int exynos_bus_parse_of(struct device_node *np, @@ -264,7 +246,7 @@ static int exynos_bus_parse_of(struct device_node *np, } /* Get the freq and voltage from OPP table to scale the bus freq */ - ret = dev_pm_opp_of_add_table(dev); + ret = devm_pm_opp_of_add_table(dev); if (ret < 0) { dev_err(dev, "failed to get OPP table\n"); goto err_clk; @@ -276,15 +258,13 @@ static int exynos_bus_parse_of(struct device_node *np, if (IS_ERR(opp)) { dev_err(dev, "failed to find dev_pm_opp\n"); ret = PTR_ERR(opp); - goto err_opp; + goto err_clk; } bus->curr_freq = dev_pm_opp_get_freq(opp); dev_pm_opp_put(opp); return 0; -err_opp: - dev_pm_opp_of_remove_table(dev); err_clk: clk_disable_unprepare(bus->clk); @@ -425,7 +405,7 @@ static int exynos_bus_probe(struct platform_device *pdev) /* Parse the device-tree to get the resource information */ ret = exynos_bus_parse_of(np, bus); if (ret < 0) - goto err_reg; + return ret; if (passive) ret = exynos_bus_profile_init_passive(bus, profile); @@ -456,11 +436,7 @@ static int exynos_bus_probe(struct platform_device *pdev) return 0; err: - dev_pm_opp_of_remove_table(dev); clk_disable_unprepare(bus->clk); -err_reg: - dev_pm_opp_put_regulators(bus->opp_table); - bus->opp_table = NULL; return ret; }