sched: cpufreq: update power usage only if cpufreq_stat is enabled
authorAmit Pundir <amit.pundir@linaro.org>
Thu, 4 Jun 2015 14:34:37 +0000 (20:04 +0530)
committerAmit Pundir <amit.pundir@linaro.org>
Thu, 4 Jun 2015 18:27:26 +0000 (23:57 +0530)
Call acct_update_power() to track power usage of task only if
CONFIG_CPU_FREQ_STAT is enabled, otherwise we run into
following build failure:
---------------
kernel/built-in.o: In function `account_user_time':
kernel/sched/cputime.c:155: undefined reference to `acct_update_power'
kernel/built-in.o: In function `__account_system_time':
kernel/sched/cputime.c:208: undefined reference to `acct_update_power'
make: *** [vmlinux] Error 1
---------------

Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
kernel/sched/cputime.c

index cc211d01f77f7388e9afaf136601a0d9c7a14297..8e8259ee4e1a95124e5aa404d8efab672f5be363 100644 (file)
@@ -151,8 +151,10 @@ void account_user_time(struct task_struct *p, cputime_t cputime,
        /* Account for user time used */
        acct_account_cputime(p);
 
+#ifdef CONFIG_CPU_FREQ_STAT
        /* Account power usage for user time */
        acct_update_power(p, cputime);
+#endif
 }
 
 /*
@@ -204,8 +206,10 @@ void __account_system_time(struct task_struct *p, cputime_t cputime,
        /* Account for system time used */
        acct_account_cputime(p);
 
+#ifdef CONFIG_CPU_FREQ_STAT
        /* Account power usage for system time */
        acct_update_power(p, cputime);
+#endif
 }
 
 /*