linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leo Yan <leo.yan@linaro.org>
To: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Leo Yan <leo.yan@linaro.org>, Stefan Wahren <stefan.wahren@i2se.com>
Subject: [PATCH 2/2] ARM: cpuidle: replace cpuidle_get_driver with cpuidle_get_cpu_driver
Date: Mon,  4 Sep 2017 14:52:14 +0800	[thread overview]
Message-ID: <1504507934-14218-2-git-send-email-leo.yan@linaro.org> (raw)
In-Reply-To: <1504507934-14218-1-git-send-email-leo.yan@linaro.org>

commit d50a7d8acd78 ("ARM: cpuidle: Support asymmetric idle definition")
supports multiple CPU idle driver so every CPU has its own driver. When
the initialization fails, the failure handling releases the resources
for every previous CPU; so it needs to retrieve every CPU device and
driver handler and unregister them. But the function
cpuidle_get_driver() can only return current CPU driver handler but not
the iterated CPU driver handler, so it cannot release resource properly.

This patch is to replace cpuidle_get_driver() with
cpuidle_get_cpu_driver(), every CPU has its own device handler so this
function can get back correct driver handler for the CPU according to
the CPU device handler. By using this CPU driver handler we can release
resource properly.

Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Stefan Wahren <stefan.wahren@i2se.com>
Signed-off-by: Leo Yan <leo.yan@linaro.org>
Fixes: d50a7d8acd78 ("ARM: cpuidle: Support asymmetric idle definition")
---
 drivers/cpuidle/cpuidle-arm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cpuidle/cpuidle-arm.c b/drivers/cpuidle/cpuidle-arm.c
index f419f6a..ef34780 100644
--- a/drivers/cpuidle/cpuidle-arm.c
+++ b/drivers/cpuidle/cpuidle-arm.c
@@ -161,9 +161,9 @@ static int __init arm_idle_init(void)
 
 	while (--cpu >= 0) {
 		dev = per_cpu(cpuidle_devices, cpu);
+		drv = cpuidle_get_cpu_driver(dev);
 		cpuidle_unregister_device(dev);
 		kfree(dev);
-		drv = cpuidle_get_driver();
 		cpuidle_unregister_driver(drv);
 		kfree(drv);
 	}
-- 
2.7.4

  reply	other threads:[~2017-09-04  6:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-04  6:52 [PATCH 1/2] ARM: cpuidle: refine failure handling in init flow Leo Yan
2017-09-04  6:52 ` Leo Yan [this message]
2017-10-07 12:12   ` [PATCH 2/2] ARM: cpuidle: replace cpuidle_get_driver with cpuidle_get_cpu_driver Leo Yan
2017-09-04  7:00 ` [PATCH 1/2] ARM: cpuidle: refine failure handling in init flow Leo Yan
2017-10-07 12:12 ` Leo Yan
2017-10-09 12:04 ` Daniel Lezcano
2017-10-09 14:24   ` Leo Yan

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=1504507934-14218-2-git-send-email-leo.yan@linaro.org \
    --to=leo.yan@linaro.org \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=stefan.wahren@i2se.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).