public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Xiaotian Feng <dfeng@redhat.com>
To: tglx@linutronix.de, damm@igel.co.jp,
	hsweeten@visionengravers.com, akpm@linux-foundation.org,
	venkatesh.pallipadi@intel.com
Cc: linux-kernel@vger.kernel.org, Xiaotian Feng <dfeng@redhat.com>
Subject: [PATCH 1/4] clockevents: use list_for_each_entry_safe
Date: Thu, 10 Dec 2009 21:07:36 +0800	[thread overview]
Message-ID: <1260450459-18072-2-git-send-email-dfeng@redhat.com> (raw)
In-Reply-To: <1260450459-18072-1-git-send-email-dfeng@redhat.com>

Iterating behaviour is same as before, but later patches will
get benifit from this convert.

Signed-off-by: Xiaotian Feng <dfeng@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Magnus Damm <damm@igel.co.jp>
Cc: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
---
 kernel/time/clockevents.c |   12 +++++-------
 1 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c
index 20a8920..1896d9d 100644
--- a/kernel/time/clockevents.c
+++ b/kernel/time/clockevents.c
@@ -163,11 +163,9 @@ static void clockevents_do_notify(unsigned long reason, void *dev)
  */
 static void clockevents_notify_released(void)
 {
-	struct clock_event_device *dev;
+	struct clock_event_device *dev, *tmp;
 
-	while (!list_empty(&clockevents_released)) {
-		dev = list_entry(clockevents_released.next,
-				 struct clock_event_device, list);
+	list_for_each_entry_safe(dev, tmp, &clockevents_released, list) {
 		list_del(&dev->list);
 		list_add(&dev->list, &clockevent_devices);
 		clockevents_do_notify(CLOCK_EVT_NOTIFY_ADD, dev);
@@ -238,7 +236,7 @@ void clockevents_exchange_device(struct clock_event_device *old,
  */
 void clockevents_notify(unsigned long reason, void *arg)
 {
-	struct list_head *node, *tmp;
+	struct clock_event_device *dev, *tmp;
 	unsigned long flags;
 
 	spin_lock_irqsave(&clockevents_lock, flags);
@@ -250,8 +248,8 @@ void clockevents_notify(unsigned long reason, void *arg)
 		 * Unregister the clock event devices which were
 		 * released from the users in the notify chain.
 		 */
-		list_for_each_safe(node, tmp, &clockevents_released)
-			list_del(node);
+		list_for_each_entry_safe(dev, tmp, &clockevents_released, list)
+			list_del(&dev->list);
 		break;
 	default:
 		break;
-- 
1.6.5.2


  reply	other threads:[~2009-12-10 13:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-10 13:07 [RFC PATCH 0/4] clockevents: fix clockevent_devices list corruption after cpu hotplug Xiaotian Feng
2009-12-10 13:07 ` Xiaotian Feng [this message]
2009-12-10 13:07   ` [PATCH 2/4] clockevents: convert clockevents_do_notify to int Xiaotian Feng
2009-12-10 13:07     ` [PATCH 3/4] clockevents: add device to clockevent_devices list if notify ADD success Xiaotian Feng
2009-12-10 13:07       ` [PATCH 4/4] clockevents: remove related device from clockevents_released list when cpu is DEAD Xiaotian Feng
2009-12-10 14:35 ` [RFC PATCH 0/4] clockevents: fix clockevent_devices list corruption after cpu hotplug Thomas Gleixner
2009-12-11  2:29   ` Xiaotian Feng
2010-01-17  9:28   ` Ozan Çağlayan
2010-01-18  2:30     ` Xiaotian Feng
2010-01-18 13:51       ` Thomas Gleixner

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=1260450459-18072-2-git-send-email-dfeng@redhat.com \
    --to=dfeng@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=damm@igel.co.jp \
    --cc=hsweeten@visionengravers.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=venkatesh.pallipadi@intel.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