aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2013-04-25 16:31:49 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-12-08 10:29:27 -0500
commit409d4ffaf0c8b29693243918217cec0044979395 (patch)
tree6d9f0a5026f0cbac46802e5f9caf22fd1dc5fd89 /kernel
parente8d630331dfe32c63438a4558eeda6f79c712485 (diff)
clockevents: Add module refcount
commit ccf33d6880f39a35158fff66db13000ae4943fac upstream. We want to be able to remove clockevent modules as well. Add a refcount so we don't remove a module with an active clock event device. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: John Stultz <john.stultz@linaro.org> Cc: Magnus Damm <magnus.damm@gmail.com> Link: http://lkml.kernel.org/r/20130425143436.307435149@linutronix.de Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: Kim Phillips <kim.phillips@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/time/clockevents.c1
-rw-r--r--kernel/time/tick-broadcast.c3
-rw-r--r--kernel/time/tick-common.c4
3 files changed, 8 insertions, 0 deletions
diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c
index ae7d9141f0b6..9df0e3b19f09 100644
--- a/kernel/time/clockevents.c
+++ b/kernel/time/clockevents.c
@@ -392,6 +392,7 @@ void clockevents_exchange_device(struct clock_event_device *old,
392 * released list and do a notify add later. 392 * released list and do a notify add later.
393 */ 393 */
394 if (old) { 394 if (old) {
395 module_put(old->owner);
395 clockevents_set_mode(old, CLOCK_EVT_MODE_UNUSED); 396 clockevents_set_mode(old, CLOCK_EVT_MODE_UNUSED);
396 list_del(&old->list); 397 list_del(&old->list);
397 list_add(&old->list, &clockevents_released); 398 list_add(&old->list, &clockevents_released);
diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c
index 753e910b647b..c15921f88f14 100644
--- a/kernel/time/tick-broadcast.c
+++ b/kernel/time/tick-broadcast.c
@@ -19,6 +19,7 @@
19#include <linux/profile.h> 19#include <linux/profile.h>
20#include <linux/sched.h> 20#include <linux/sched.h>
21#include <linux/smp.h> 21#include <linux/smp.h>
22#include <linux/module.h>
22 23
23#include "tick-internal.h" 24#include "tick-internal.h"
24 25
@@ -74,6 +75,8 @@ void tick_install_broadcast_device(struct clock_event_device *dev)
74 tick_broadcast_device.evtdev->rating >= dev->rating) || 75 tick_broadcast_device.evtdev->rating >= dev->rating) ||
75 (dev->features & CLOCK_EVT_FEAT_C3STOP)) 76 (dev->features & CLOCK_EVT_FEAT_C3STOP))
76 return; 77 return;
78 if (!try_module_get(dev->owner))
79 return;
77 80
78 clockevents_exchange_device(tick_broadcast_device.evtdev, dev); 81 clockevents_exchange_device(tick_broadcast_device.evtdev, dev);
79 if (cur) 82 if (cur)
diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c
index d8e328cf481e..e93af50726e2 100644
--- a/kernel/time/tick-common.c
+++ b/kernel/time/tick-common.c
@@ -18,6 +18,7 @@
18#include <linux/percpu.h> 18#include <linux/percpu.h>
19#include <linux/profile.h> 19#include <linux/profile.h>
20#include <linux/sched.h> 20#include <linux/sched.h>
21#include <linux/module.h>
21 22
22#include <asm/irq_regs.h> 23#include <asm/irq_regs.h>
23 24
@@ -261,6 +262,9 @@ void tick_check_new_device(struct clock_event_device *newdev)
261 goto out_bc; 262 goto out_bc;
262 } 263 }
263 264
265 if (!try_module_get(newdev->owner))
266 return;
267
264 /* 268 /*
265 * Replace the eventually existing device by the new 269 * Replace the eventually existing device by the new
266 * device. If the current device is the broadcast device, do 270 * device. If the current device is the broadcast device, do