Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1185742

[PATCH 23/23] kernel: broadcast-hrtimer: Migrate to new 'set-state' interface

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From Viresh Kumar <viresh.kumar@linaro.org>
Newsgroups linux.kernel
Subject [PATCH 23/23] kernel: broadcast-hrtimer: Migrate to new 'set-state' interface
Date Thu, 16 Jul 2015 13:30:01 +0200
Message-ID <pMPwt-5cU-7@gated-at.bofh.it> (permalink)
References <pMPwt-5cU-9@gated-at.bofh.it>
X-Original-To Thomas Gleixner <tglx@linutronix.de>, Daniel Lezcano <daniel.lezcano@linaro.org>
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=ueekJxM7rPJnKPXnNCnMa73FmAVEeoM+E1FyPNpVios=; b=AnZSfdAx5PM7T6ubrGcZD3CFuUcc1WUjtLCTMVxmPuVTzbJuPpPH6t/TFpy6GdTbJY AnzHunK6GXDmmQhtz0Qi6cPVeBrGdKtkg2T9b6S4Shw1doazLP1fP5pMwLISrFUZwzhe JY7RFmjDLySa+WDmOITJbx3Mbmnjn3MLtoZ15wCbczlhJqqCvjHYG0W36BZFaVKOvLNJ iQ6StebXz/+twocNqavXOqJFE0i8LeQFfmWQDSaa5Di5PZfJqq2rQNclyq3QRcpeBvEs G/SEx/e1/SY05RLtH4o+YEFfGsPPnIiipZVvwVCUcLlQVnXjfNFFrn+WlM9tX2b4vT27 6YMw==
X-Gm-Message-State ALoCoQn0IqjCthYQtDFrq9EAiHJXYPOL9QOjkqh32V0o+hPrhYBReqHKfkZJJ5Smhp8hTtjEA9Ww
X-Received by 10.70.40.227 with SMTP id a3mr17449632pdl.119.1437046172174; Thu, 16 Jul 2015 04:29:32 -0700 (PDT)
X-Mailer git-send-email 2.4.0
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 95
Organization linux.* mail to news gateway
X-Original-Cc linaro-kernel@lists.linaro.org, linux-kernel@vger.kernel.org, Viresh Kumar <viresh.kumar@linaro.org>
X-Original-Date Thu, 16 Jul 2015 16:56:35 +0530
X-Original-Message-ID <557ae9e7b3259d65a8221e19c8d786322cb928d5.1437044518.git.viresh.kumar@linaro.org>
X-Original-References <cover.1437044517.git.viresh.kumar@linaro.org>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref aioe.org linux.kernel:1185742

Show key headers only | View raw


Migrate broadcast-hrtimer driver to the new 'set-state' interface
provided by clockevents core, the earlier 'set-mode' interface is marked
obsolete now.

Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 kernel/time/tick-broadcast-hrtimer.c | 49 +++++++++++++++---------------------
 1 file changed, 20 insertions(+), 29 deletions(-)

diff --git a/kernel/time/tick-broadcast-hrtimer.c b/kernel/time/tick-broadcast-hrtimer.c
index 3e7db49a2381..53d7184da0be 100644
--- a/kernel/time/tick-broadcast-hrtimer.c
+++ b/kernel/time/tick-broadcast-hrtimer.c
@@ -18,30 +18,23 @@
 
 static struct hrtimer bctimer;
 
-static void bc_set_mode(enum clock_event_mode mode,
-			struct clock_event_device *bc)
+static int bc_shutdown(struct clock_event_device *evt)
 {
-	switch (mode) {
-	case CLOCK_EVT_MODE_UNUSED:
-	case CLOCK_EVT_MODE_SHUTDOWN:
-		/*
-		 * Note, we cannot cancel the timer here as we might
-		 * run into the following live lock scenario:
-		 *
-		 * cpu 0		cpu1
-		 * lock(broadcast_lock);
-		 *			hrtimer_interrupt()
-		 *			bc_handler()
-		 *			   tick_handle_oneshot_broadcast();
-		 *			    lock(broadcast_lock);
-		 * hrtimer_cancel()
-		 *  wait_for_callback()
-		 */
-		hrtimer_try_to_cancel(&bctimer);
-		break;
-	default:
-		break;
-	}
+	/*
+	 * Note, we cannot cancel the timer here as we might
+	 * run into the following live lock scenario:
+	 *
+	 * cpu 0		cpu1
+	 * lock(broadcast_lock);
+	 *			hrtimer_interrupt()
+	 *			bc_handler()
+	 *			   tick_handle_oneshot_broadcast();
+	 *			    lock(broadcast_lock);
+	 * hrtimer_cancel()
+	 *  wait_for_callback()
+	 */
+	hrtimer_try_to_cancel(&bctimer);
+	return 0;
 }
 
 /*
@@ -82,7 +75,7 @@ static int bc_set_next(ktime_t expires, struct clock_event_device *bc)
 }
 
 static struct clock_event_device ce_broadcast_hrtimer = {
-	.set_mode		= bc_set_mode,
+	.set_state_shutdown	= bc_shutdown,
 	.set_next_ktime		= bc_set_next,
 	.features		= CLOCK_EVT_FEAT_ONESHOT |
 				  CLOCK_EVT_FEAT_KTIME |
@@ -102,13 +95,11 @@ static enum hrtimer_restart bc_handler(struct hrtimer *t)
 {
 	ce_broadcast_hrtimer.event_handler(&ce_broadcast_hrtimer);
 
-	switch (ce_broadcast_hrtimer.mode) {
-	case CLOCK_EVT_MODE_ONESHOT:
+	if (clockevent_state_oneshot(&ce_broadcast_hrtimer))
 		if (ce_broadcast_hrtimer.next_event.tv64 != KTIME_MAX)
 			return HRTIMER_RESTART;
-	default:
-		return HRTIMER_NORESTART;
-	}
+
+	return HRTIMER_NORESTART;
 }
 
 void tick_setup_hrtimer_broadcast(void)
-- 
2.4.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | Next | Find similar | Unroll thread


Thread

[PATCH 23/23] kernel: broadcast-hrtimer: Migrate to new 'set-state' interface Viresh Kumar <viresh.kumar@linaro.org> - 2015-07-16 13:30 +0200

csiph-web