lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 14 Apr 2014 21:54:00 +0530
From:	Viresh Kumar <viresh.kumar@...aro.org>
To:	tglx@...utronix.de
Cc:	linaro-kernel@...ts.linaro.org, linux-kernel@...r.kernel.org,
	fweisbec@...il.com, Arvind.Chauhan@....com,
	linaro-networking@...aro.org,
	Viresh Kumar <viresh.kumar@...aro.org>
Subject: [PATCH 38/38] clockevents: set event_handler to clockevents_handle_noop() in clockevents_exchange_device()

All users of clockevents_handle_noop() are setting old->event_handler to it
after calling clockevents_exchange_device() and so it would be better if we can
do this at a single place. The only thing we need to make sure is, we preserve
it before calling clockevents_exchange_device() in case we need it.

As there are no external users of it, make it static.

Signed-off-by: Viresh Kumar <viresh.kumar@...aro.org>
---
 include/linux/clockchips.h   |  2 --
 kernel/time/clockevents.c    |  3 ++-
 kernel/time/tick-broadcast.c |  2 --
 kernel/time/tick-common.c    | 11 +++++------
 4 files changed, 7 insertions(+), 11 deletions(-)

diff --git a/include/linux/clockchips.h b/include/linux/clockchips.h
index 2e4cb67..7e492ad 100644
--- a/include/linux/clockchips.h
+++ b/include/linux/clockchips.h
@@ -165,8 +165,6 @@ extern void clockevents_set_mode(struct clock_event_device *dev,
 extern int clockevents_program_event(struct clock_event_device *dev,
 				     ktime_t expires, bool force);
 
-extern void clockevents_handle_noop(struct clock_event_device *dev);
-
 static inline void
 clockevents_calc_mult_shift(struct clock_event_device *ce, u32 freq, u32 minsec)
 {
diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c
index d80e891..757dae8 100644
--- a/kernel/time/clockevents.c
+++ b/kernel/time/clockevents.c
@@ -480,7 +480,7 @@ int clockevents_update_freq(struct clock_event_device *dev, u32 freq)
 /*
  * Noop handler when we shut down an event device
  */
-void clockevents_handle_noop(struct clock_event_device *dev)
+static void clockevents_handle_noop(struct clock_event_device *dev)
 {
 }
 
@@ -506,6 +506,7 @@ void clockevents_exchange_device(struct clock_event_device *old,
 		clockevents_set_mode(old, CLOCK_EVT_MODE_UNUSED);
 		list_del(&old->list);
 		list_add(&old->list, &clockevents_released);
+		old->event_handler = clockevents_handle_noop;
 	}
 
 	if (new) {
diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c
index 9d81a81..bb96da7 100644
--- a/kernel/time/tick-broadcast.c
+++ b/kernel/time/tick-broadcast.c
@@ -95,8 +95,6 @@ void tick_install_broadcast_device(struct clock_event_device *dev)
 		return;
 
 	clockevents_exchange_device(cur, dev);
-	if (cur)
-		cur->event_handler = clockevents_handle_noop;
 	tick_broadcast_device.evtdev = dev;
 	if (!cpumask_empty(tick_broadcast_mask))
 		tick_broadcast_start_periodic(dev);
diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c
index e1b2947..b0d14e3 100644
--- a/kernel/time/tick-common.c
+++ b/kernel/time/tick-common.c
@@ -145,11 +145,11 @@ void tick_setup_periodic(struct clock_event_device *dev, int broadcast)
  * Setup the tick device
  */
 static void tick_setup_device(struct tick_device *td,
-			      struct clock_event_device *newdev, int cpu)
+			      struct clock_event_device *newdev, int cpu,
+			      void (*handler)(struct clock_event_device *))
 {
 	const struct cpumask *cpumask = cpumask_of(cpu);
 	ktime_t next_event;
-	void (*handler)(struct clock_event_device *) = NULL;
 
 	/*
 	 * First device setup ?
@@ -173,9 +173,7 @@ static void tick_setup_device(struct tick_device *td,
 		 */
 		td->mode = TICKDEV_MODE_PERIODIC;
 	} else {
-		handler = td->evtdev->event_handler;
 		next_event = td->evtdev->next_event;
-		td->evtdev->event_handler = clockevents_handle_noop;
 	}
 
 	td->evtdev = newdev;
@@ -206,10 +204,12 @@ static void tick_setup_device(struct tick_device *td,
 void tick_install_replacement(struct clock_event_device *newdev)
 {
 	struct tick_device *td = tick_get_cpu_device();
+	void (*handler)(struct clock_event_device *) =
+		td->evtdev->event_handler;
 	int cpu = smp_processor_id();
 
 	clockevents_exchange_device(td->evtdev, newdev);
-	tick_setup_device(td, newdev, cpu);
+	tick_setup_device(td, newdev, cpu, handler);
 	if (newdev->features & CLOCK_EVT_FEAT_ONESHOT)
 		tick_oneshot_notify();
 }
@@ -335,7 +335,6 @@ void tick_shutdown(unsigned int *cpup)
 		 * the set mode function!
 		 */
 		clockevents_exchange_device(dev, NULL);
-		dev->event_handler = clockevents_handle_noop;
 		td->evtdev = NULL;
 	}
 }
-- 
1.7.12.rc2.18.g61b472e

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ