linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yangtao Li <tiny.windzz@gmail.com>
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 31/31] PM / devfreq: convert to devm_pm_opp_register_notifier and remove unused API
Date: Sun,  3 Jan 2021 03:57:06 +0000	[thread overview]
Message-ID: <20210103035706.24168-1-tiny.windzz@gmail.com> (raw)

 Use devm_pm_opp_* API to simplify code.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
---
 drivers/devfreq/devfreq.c | 66 +--------------------------------------
 include/linux/devfreq.h   | 23 --------------
 2 files changed, 1 insertion(+), 88 deletions(-)

diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index 6aa10de792b3..f593f30529ec 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -2004,40 +2004,6 @@ struct dev_pm_opp *devfreq_recommended_opp(struct device *dev,
 }
 EXPORT_SYMBOL(devfreq_recommended_opp);
 
-/**
- * devfreq_register_opp_notifier() - Helper function to get devfreq notified
- *				     for any changes in the OPP availability
- *				     changes
- * @dev:	The devfreq user device. (parent of devfreq)
- * @devfreq:	The devfreq object.
- */
-int devfreq_register_opp_notifier(struct device *dev, struct devfreq *devfreq)
-{
-	return dev_pm_opp_register_notifier(dev, &devfreq->nb);
-}
-EXPORT_SYMBOL(devfreq_register_opp_notifier);
-
-/**
- * devfreq_unregister_opp_notifier() - Helper function to stop getting devfreq
- *				       notified for any changes in the OPP
- *				       availability changes anymore.
- * @dev:	The devfreq user device. (parent of devfreq)
- * @devfreq:	The devfreq object.
- *
- * At exit() callback of devfreq_dev_profile, this must be included if
- * devfreq_recommended_opp is used.
- */
-int devfreq_unregister_opp_notifier(struct device *dev, struct devfreq *devfreq)
-{
-	return dev_pm_opp_unregister_notifier(dev, &devfreq->nb);
-}
-EXPORT_SYMBOL(devfreq_unregister_opp_notifier);
-
-static void devm_devfreq_opp_release(struct device *dev, void *res)
-{
-	devfreq_unregister_opp_notifier(dev, *(struct devfreq **)res);
-}
-
 /**
  * devm_devfreq_register_opp_notifier() - Resource-managed
  *					  devfreq_register_opp_notifier()
@@ -2047,40 +2013,10 @@ static void devm_devfreq_opp_release(struct device *dev, void *res)
 int devm_devfreq_register_opp_notifier(struct device *dev,
 				       struct devfreq *devfreq)
 {
-	struct devfreq **ptr;
-	int ret;
-
-	ptr = devres_alloc(devm_devfreq_opp_release, sizeof(*ptr), GFP_KERNEL);
-	if (!ptr)
-		return -ENOMEM;
-
-	ret = devfreq_register_opp_notifier(dev, devfreq);
-	if (ret) {
-		devres_free(ptr);
-		return ret;
-	}
-
-	*ptr = devfreq;
-	devres_add(dev, ptr);
-
-	return 0;
+	return devm_pm_opp_register_notifier(dev, &devfreq->nb);
 }
 EXPORT_SYMBOL(devm_devfreq_register_opp_notifier);
 
-/**
- * devm_devfreq_unregister_opp_notifier() - Resource-managed
- *					    devfreq_unregister_opp_notifier()
- * @dev:	The devfreq user device. (parent of devfreq)
- * @devfreq:	The devfreq object.
- */
-void devm_devfreq_unregister_opp_notifier(struct device *dev,
-					 struct devfreq *devfreq)
-{
-	WARN_ON(devres_release(dev, devm_devfreq_opp_release,
-			       devm_devfreq_dev_match, devfreq));
-}
-EXPORT_SYMBOL(devm_devfreq_unregister_opp_notifier);
-
 /**
  * devfreq_register_notifier() - Register a driver with devfreq
  * @devfreq:	The devfreq object.
diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h
index b6d3bae1c74d..aca2cc4f4fa4 100644
--- a/include/linux/devfreq.h
+++ b/include/linux/devfreq.h
@@ -230,14 +230,8 @@ int update_devfreq(struct devfreq *devfreq);
 /* Helper functions for devfreq user device driver with OPP. */
 struct dev_pm_opp *devfreq_recommended_opp(struct device *dev,
 				unsigned long *freq, u32 flags);
-int devfreq_register_opp_notifier(struct device *dev,
-				struct devfreq *devfreq);
-int devfreq_unregister_opp_notifier(struct device *dev,
-				struct devfreq *devfreq);
 int devm_devfreq_register_opp_notifier(struct device *dev,
 				struct devfreq *devfreq);
-void devm_devfreq_unregister_opp_notifier(struct device *dev,
-				struct devfreq *devfreq);
 int devfreq_register_notifier(struct devfreq *devfreq,
 				struct notifier_block *nb,
 				unsigned int list);
@@ -355,29 +349,12 @@ static inline struct dev_pm_opp *devfreq_recommended_opp(struct device *dev,
 	return ERR_PTR(-EINVAL);
 }
 
-static inline int devfreq_register_opp_notifier(struct device *dev,
-					struct devfreq *devfreq)
-{
-	return -EINVAL;
-}
-
-static inline int devfreq_unregister_opp_notifier(struct device *dev,
-					struct devfreq *devfreq)
-{
-	return -EINVAL;
-}
-
 static inline int devm_devfreq_register_opp_notifier(struct device *dev,
 					struct devfreq *devfreq)
 {
 	return -EINVAL;
 }
 
-static inline void devm_devfreq_unregister_opp_notifier(struct device *dev,
-					struct devfreq *devfreq)
-{
-}
-
 static inline int devfreq_register_notifier(struct devfreq *devfreq,
 					struct notifier_block *nb,
 					unsigned int list)
-- 
2.25.1


             reply	other threads:[~2021-01-03  3:58 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-03  3:57 Yangtao Li [this message]
2021-01-04  7:40 ` [PATCH 31/31] PM / devfreq: convert to devm_pm_opp_register_notifier and remove unused API Viresh Kumar
2021-01-05  5:36 ` Chanwoo Choi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210103035706.24168-1-tiny.windzz@gmail.com \
    --to=tiny.windzz@gmail.com \
    --cc=abhinavk@codeaurora.org \
    --cc=adrian.hunter@intel.com \
    --cc=agross@kernel.org \
    --cc=airlied@linux.ie \
    --cc=airlied@redhat.com \
    --cc=akashast@codeaurora.org \
    --cc=akhilpo@codeaurora.org \
    --cc=alyssa.rosenzweig@collabora.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=broonie@kernel.org \
    --cc=chandanu@codeaurora.org \
    --cc=cw00.choi@samsung.com \
    --cc=daniel@ffwll.ch \
    --cc=ddavenport@chromium.org \
    --cc=dianders@chromium.org \
    --cc=digetx@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=emil.velikov@collabora.com \
    --cc=eric@anholt.net \
    --cc=festevam@gmail.com \
    --cc=freedreno@lists.freedesktop.org \
    --cc=georgi.djakov@linaro.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=groeck@chromium.org \
    --cc=gustavoars@kernel.org \
    --cc=harigovi@codeaurora.org \
    --cc=hoegsberg@google.com \
    --cc=jcrouse@codeaurora.org \
    --cc=jirislaby@kernel.org \
    --cc=jonathan@marek.ca \
    --cc=jonathanh@nvidia.com \
    --cc=jsanka@codeaurora.org \
    --cc=kalyan_t@codeaurora.org \
    --cc=kernel@pengutronix.de \
    --cc=khsieh@codeaurora.org \
    --cc=krzk@kernel.org \
    --cc=kyungmin.park@samsung.com \
    --cc=lima@lists.freedesktop.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=linux-tegra@vger.kernel.org \
    --cc=lukasz.luba@arm.com \
    --cc=marijn.suijten@somainline.org \
    --cc=masneyb@onstation.org \
    --cc=mchehab@kernel.org \
    --cc=miaoqinglang@huawei.com \
    --cc=mka@chromium.org \
    --cc=myungjoo.ham@samsung.com \
    --cc=natechancellor@gmail.com \
    --cc=nm@ti.com \
    --cc=parashar@codeaurora.org \
    --cc=rikard.falkeborn@gmail.com \
    --cc=rjw@rjwysocki.net \
    --cc=rnayak@codeaurora.org \
    --cc=robdclark@gmail.com \
    --cc=robh@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=sboyd@kernel.org \
    --cc=sean@poorly.run \
    --cc=shawnguo@kernel.org \
    --cc=smasetty@codeaurora.org \
    --cc=stanimir.varbanov@linaro.org \
    --cc=steven.price@arm.com \
    --cc=tanmay@codeaurora.org \
    --cc=thierry.reding@gmail.com \
    --cc=tomeu.vizoso@collabora.com \
    --cc=tongtiangen@huawei.com \
    --cc=tzimmermann@suse.de \
    --cc=ulf.hansson@linaro.org \
    --cc=varar@codeaurora.org \
    --cc=vireshk@kernel.org \
    --cc=yuq825@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).