From: Andrew Morton <akpm@linux-foundation.org>
To: Len Brown <lenb@kernel.org>
Cc: x86@kernel.org, linux-pm@lists.linux-foundation.org,
linux-kernel@vger.kernel.org, Len Brown <len.brown@intel.com>
Subject: Re: [PATCH 2/8] cpuidle: add cpuidle_unregister_driver() error check
Date: Wed, 26 May 2010 20:14:37 -0700 [thread overview]
Message-ID: <20100526201437.51f5c7f7.akpm@linux-foundation.org> (raw)
In-Reply-To: <56b9c89c17c1a85886f6d1928349e35bbb48c856.1274926772.git.len.brown@intel.com>
On Wed, 26 May 2010 22:42:25 -0400 Len Brown <lenb@kernel.org> wrote:
> From: Len Brown <len.brown@intel.com>
>
> When cpuidle_unregister_driver() is called with a driver
> other than the one that was successfully registered, do nothing.
>
> Previously we'd NULL-out the one that was registered.
> But that required the callers to remember what this
> routine already remembers. With this check, the callers
> can be simplified.
>
> Signed-off-by: Len Brown <len.brown@intel.com>
> ---
> drivers/cpuidle/driver.c | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/cpuidle/driver.c b/drivers/cpuidle/driver.c
> index 2257004..30bcd44 100644
> --- a/drivers/cpuidle/driver.c
> +++ b/drivers/cpuidle/driver.c
> @@ -49,7 +49,8 @@ void cpuidle_unregister_driver(struct cpuidle_driver *drv)
> return;
>
> spin_lock(&cpuidle_driver_lock);
> - cpuidle_curr_driver = NULL;
> + if (drv == cpuidle_curr_driver)
> + cpuidle_curr_driver = NULL;
> spin_unlock(&cpuidle_driver_lock);
> }
This can only happen as a result of a coding bug, yes? If so, the
kernel should go BUG() rather than secretly concealing the problem.
Also (alternatively), the `drv' arg to this function is superfluous?
next prev parent reply other threads:[~2010-05-27 3:14 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-27 2:42 idle-test patches queued for upstream Len Brown
2010-05-27 2:42 ` [PATCH 1/8] cpuidle: fail to register if !CONFIG_CPU_IDLE Len Brown
2010-05-27 2:42 ` [PATCH 2/8] cpuidle: add cpuidle_unregister_driver() error check Len Brown
2010-05-27 3:14 ` Andrew Morton [this message]
2010-05-27 5:11 ` [PATCH-v2 " Len Brown
2010-05-27 5:13 ` Andrew Morton
2010-05-27 2:42 ` [PATCH 3/8] cpuidle: make cpuidle_curr_driver static Len Brown
2010-05-27 5:27 ` [PATCH-v2 " Len Brown
2010-05-27 18:40 ` Luck, Tony
2010-05-27 23:30 ` Len Brown
2010-05-27 2:42 ` [PATCH 4/8] ACPI: allow a native cpuidle driver to displace ACPI Len Brown
2010-05-27 2:42 ` [PATCH 5/8] sched: clarify commment for TS_POLLING Len Brown
2010-05-27 5:53 ` [PATCH-v2 " Len Brown
2010-05-27 2:42 ` [PATCH 6/8] acpi_pad: uses MONITOR/MWAIT, so it doesn't need to clear TS_POLLING Len Brown
2010-05-27 2:42 ` [PATCH 7/8] ACPI: acpi_idle: touch TS_POLLING only in the non-MWAIT case Len Brown
2010-05-27 2:42 ` [PATCH 8/8] intel_idle: create a native cpuidle driver for select intel processors Len Brown
2010-05-27 3:44 ` Andrew Morton
2010-05-28 3:57 ` Len Brown
2010-05-30 9:20 ` Andi Kleen
2010-05-27 8:53 ` [linux-pm] " Thomas Renninger
2010-05-28 1:44 ` Len Brown
2010-05-28 7:46 ` Thomas Renninger
2010-05-28 17:38 ` Len Brown
2010-05-29 4:17 ` Thomas Renninger
2010-05-27 14:14 ` Kevin Hilman
2010-05-27 14:22 ` Arjan van de Ven
2010-05-27 14:36 ` Kevin Hilman
2010-05-28 0:22 ` Len Brown
2010-05-28 17:28 ` Kevin Hilman
2010-05-27 14:51 ` [linux-pm] " Igor Stoppa
2010-05-28 3:14 ` Arjan van de Ven
2010-05-28 17:27 ` Kevin Hilman
2010-05-29 0:38 ` Arjan van de Ven
2010-05-28 2:32 ` Chase Douglas
2010-05-28 4:16 ` Len Brown
2010-05-28 15:09 ` Chase Douglas
2010-05-28 17:43 ` Len Brown
2010-05-28 19:51 ` Chase Douglas
2010-05-28 20:14 ` Chase Douglas
2010-05-27 5:25 ` (No subject header) Milton Miller
2010-05-27 5:47 ` Len Brown
2010-05-27 8:45 ` [linux-pm] idle-test patches queued for upstream Thomas Renninger
2010-05-28 0:59 ` Len Brown
2010-05-28 8:07 ` Thomas Renninger
2010-05-28 17:42 ` Len Brown
2010-06-16 7:53 ` Pavel Machek
-- strict thread matches above, loose matches on Subject: below --
2010-05-28 6:01 idle patches for 2.6.35 Len Brown
2010-05-28 6:01 ` [PATCH 1/8] cpuidle: fail to register if !CONFIG_CPU_IDLE Len Brown
2010-05-28 6:01 ` [PATCH 2/8] cpuidle: add cpuidle_unregister_driver() error check Len Brown
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=20100526201437.51f5c7f7.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=len.brown@intel.com \
--cc=lenb@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@lists.linux-foundation.org \
--cc=x86@kernel.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 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).