summaryrefslogtreecommitdiff
path: root/drivers/devfreq/devfreq.c
diff options
context:
space:
mode:
authorChanwoo Choi <cw00.choi@samsung.com>2020-10-07 22:02:39 +0900
committerChanwoo Choi <cw00.choi@samsung.com>2020-10-26 10:52:37 +0900
commitb4365423bb7adf9feb4659126eaec374dfbde806 (patch)
tree564436e9764d9d5a938c41befdab77fb826b699b /drivers/devfreq/devfreq.c
parent4281461c01f702f9427554718988b5e8fbfd64fb (diff)
PM / devfreq: Unify frequency change to devfreq_update_target func
The update_devfreq() and update_passive_devfreq() have the duplicate code when changing the target frequency on final stage. So, unify frequency change code to devfreq_update_target() to remove the duplicate code and to centralize the frequency change code. Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
Diffstat (limited to 'drivers/devfreq/devfreq.c')
-rw-r--r--drivers/devfreq/devfreq.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c
index 861c100f9fac..ab5dd9d5fdc7 100644
--- a/drivers/devfreq/devfreq.c
+++ b/drivers/devfreq/devfreq.c
@@ -382,18 +382,19 @@ static int devfreq_set_target(struct devfreq *devfreq, unsigned long new_freq,
return err;
}
-/* Load monitoring helper functions for governors use */
-
/**
- * update_devfreq() - Reevaluate the device and configure frequency.
+ * devfreq_update_target() - Reevaluate the device and configure frequency
+ * on the final stage.
* @devfreq: the devfreq instance.
+ * @freq: the new frequency of parent device. This argument
+ * is only used for devfreq device using passive governor.
*
- * Note: Lock devfreq->lock before calling update_devfreq
- * This function is exported for governors.
+ * Note: Lock devfreq->lock before calling devfreq_update_target. This function
+ * should be only used by both update_devfreq() and devfreq governors.
*/
-int update_devfreq(struct devfreq *devfreq)
+int devfreq_update_target(struct devfreq *devfreq, unsigned long freq)
{
- unsigned long freq, min_freq, max_freq;
+ unsigned long min_freq, max_freq;
int err = 0;
u32 flags = 0;
@@ -418,7 +419,21 @@ int update_devfreq(struct devfreq *devfreq)
}
return devfreq_set_target(devfreq, freq, flags);
+}
+EXPORT_SYMBOL(devfreq_update_target);
+
+/* Load monitoring helper functions for governors use */
+/**
+ * update_devfreq() - Reevaluate the device and configure frequency.
+ * @devfreq: the devfreq instance.
+ *
+ * Note: Lock devfreq->lock before calling update_devfreq
+ * This function is exported for governors.
+ */
+int update_devfreq(struct devfreq *devfreq)
+{
+ return devfreq_update_target(devfreq, 0L);
}
EXPORT_SYMBOL(update_devfreq);