All of lore.kernel.org
 help / color / mirror / Atom feed
From: Qian Cai <cai@lca.pw>
To: gregkh@linuxfoundation.org
Cc: rjw@rjwysocki.net, khilman@kernel.org, ulf.hansson@linaro.org,
	pavel@ucw.cz, len.brown@intel.com, lina.iyer@linaro.org,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Qian Cai <cai@lca.pw>
Subject: [PATCH -next] power/domain_governor: fix a compilation error
Date: Thu, 11 Apr 2019 08:47:39 -0400	[thread overview]
Message-ID: <20190411124739.5542-1-cai@lca.pw> (raw)

The commit 50899f7d5078 ("PM / Domains: Add genpd governor for CPUs")
introduced a compilation error on arm64 with CONFIG_CPU_IDLE=n because
cpuidle_devices is undefined there.

drivers/base/power/domain_governor.o: In function `cpu_power_down_ok':
drivers/base/power/domain_governor.c:263: undefined reference to
'cpuidle_devices' ld: drivers/base/power/domain_governor.o: relocation
R_AARCH64_ADR_PREL_PG_HI21 against symbol 'cpuidle_devices' which may
bind externally can not be used when making a shared object; recompile
with -fPIC
drivers/base/power/domain_governor.c:263:(.text+0x638): dangerous
relocation: unsupported relocation
drivers/base/power/domain_governor.c:263: undefined reference to
'cpuidle_devices'
make: *** [Makefile:1047: vmlinux] Error 1

Signed-off-by: Qian Cai <cai@lca.pw>
---
 drivers/base/power/domain_governor.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/base/power/domain_governor.c b/drivers/base/power/domain_governor.c
index 39c8a699cb53..252d88fcf760 100644
--- a/drivers/base/power/domain_governor.c
+++ b/drivers/base/power/domain_governor.c
@@ -270,11 +270,13 @@ static bool cpu_power_down_ok(struct dev_pm_domain *pd)
 	 */
 	domain_wakeup = ktime_set(KTIME_SEC_MAX, 0);
 	for_each_cpu_and(cpu, genpd->cpus, cpu_online_mask) {
-		dev = per_cpu(cpuidle_devices, cpu);
-		if (dev) {
-			next_hrtimer = READ_ONCE(dev->next_hrtimer);
-			if (ktime_before(next_hrtimer, domain_wakeup))
-				domain_wakeup = next_hrtimer;
+		if (IS_ENABLED(CONFIG_CPU_IDLE)) {
+			dev = per_cpu(cpuidle_devices, cpu);
+			if (dev) {
+				next_hrtimer = READ_ONCE(dev->next_hrtimer);
+				if (ktime_before(next_hrtimer, domain_wakeup))
+					domain_wakeup = next_hrtimer;
+			}
 		}
 	}
 
-- 
2.20.1 (Apple Git-117)


             reply	other threads:[~2019-04-11 12:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-11 12:47 Qian Cai [this message]
2019-04-11 13:22 ` [PATCH -next] power/domain_governor: fix a compilation error Ulf Hansson
2019-04-11 14:36   ` Rafael J. Wysocki
2019-04-11 18:00     ` Ulf Hansson

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=20190411124739.5542-1-cai@lca.pw \
    --to=cai@lca.pw \
    --cc=gregkh@linuxfoundation.org \
    --cc=khilman@kernel.org \
    --cc=len.brown@intel.com \
    --cc=lina.iyer@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=rjw@rjwysocki.net \
    --cc=ulf.hansson@linaro.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.