summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJavi Merino <javi.merino@arm.com>2015-08-14 18:56:56 +0100
committerSeung-Woo Kim <sw0312.kim@samsung.com>2016-12-14 13:51:19 +0900
commitf97b42f9e6fd63101ded5bb5c4d37cce59920ff5 (patch)
treedaa7c7b15bba9ea66d14e66933abb9d645a681bc /include
parentc234f2efbe3c3b37fd69084242ade6e2352fa23b (diff)
PM / devfreq: cache the last call to get_dev_status()
The return value of get_dev_status() can be reused. Cache it so that other parts of the kernel can reuse it instead of having to call the same function again. Cc: Kyungmin Park <kyungmin.park@samsung.com> Signed-off-by: Javi Merino <javi.merino@arm.com> Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com> [jy0922.shim: apply mainline patch] Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com>
Diffstat (limited to 'include')
-rw-r--r--include/linux/devfreq.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h
index ce447f0f1bad..70a1c60ddda4 100644
--- a/include/linux/devfreq.h
+++ b/include/linux/devfreq.h
@@ -161,6 +161,7 @@ struct devfreq {
struct delayed_work work;
unsigned long previous_freq;
+ struct devfreq_dev_status last_status;
void *data; /* private data for governors */
@@ -204,6 +205,15 @@ extern int devm_devfreq_register_opp_notifier(struct device *dev,
extern void devm_devfreq_unregister_opp_notifier(struct device *dev,
struct devfreq *devfreq);
+/**
+ * devfreq_update_stats() - update the last_status pointer in struct devfreq
+ * @df: the devfreq instance whose status needs updating
+ */
+static inline int devfreq_update_stats(struct devfreq *df)
+{
+ return df->profile->get_dev_status(df->dev.parent, &df->last_status);
+}
+
#if IS_ENABLED(CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND)
/**
* struct devfreq_simple_ondemand_data - void *data fed to struct devfreq
@@ -289,6 +299,11 @@ static inline void devm_devfreq_unregister_opp_notifier(struct device *dev,
struct devfreq *devfreq)
{
}
+
+static inline int devfreq_update_stats(struct devfreq *df)
+{
+ return -EINVAL;
+}
#endif /* CONFIG_PM_DEVFREQ */
#endif /* __LINUX_DEVFREQ_H__ */