summaryrefslogtreecommitdiffstats
path: root/kernel/time/clocksource.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2013-04-25 22:31:50 +0200
committerThomas Gleixner <tglx@linutronix.de>2013-05-16 11:09:18 +0200
commit03e13cf5ee60584fe0c831682c67212effb7fca4 (patch)
treeb40a9a0a88a675e4511ad6b6c0bf072b6a1ef9f4 /kernel/time/clocksource.c
parentclockevents: Split out selection logic (diff)
downloadlinux-03e13cf5ee60584fe0c831682c67212effb7fca4.tar.xz
linux-03e13cf5ee60584fe0c831682c67212effb7fca4.zip
clockevents: Implement unbind functionality
Provide a sysfs interface to allow unbinding of clockevent devices. The device is unbound if it is unused or if there is a replacement device available. Unbinding of broadcast devices is not supported as we don't want to foster that nonsense. If no replacement device is available the unbind returns -EBUSY. Unbind is available from the kernel and through sysfs, which is necessary to drop the module refcount. 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.499216659@linutronix.de Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel/time/clocksource.c')
-rw-r--r--kernel/time/clocksource.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index 31b90332f47b..6d05b00410cc 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -31,6 +31,8 @@
#include <linux/tick.h>
#include <linux/kthread.h>
+#include "tick-internal.h"
+
void timecounter_init(struct timecounter *tc,
const struct cyclecounter *cc,
u64 start_tstamp)
@@ -174,7 +176,6 @@ clocks_calc_mult_shift(u32 *mult, u32 *shift, u32 from, u32 to, u32 maxsec)
static struct clocksource *curr_clocksource;
static LIST_HEAD(clocksource_list);
static DEFINE_MUTEX(clocksource_mutex);
-#define CS_NAME_LEN 32
static char override_name[CS_NAME_LEN];
static int finished_booting;
@@ -864,7 +865,7 @@ sysfs_show_current_clocksources(struct device *dev,
return count;
}
-static size_t clocksource_get_uname(const char *buf, char *dst, size_t cnt)
+size_t sysfs_get_uname(const char *buf, char *dst, size_t cnt)
{
size_t ret = cnt;
@@ -899,7 +900,7 @@ static ssize_t sysfs_override_clocksource(struct device *dev,
mutex_lock(&clocksource_mutex);
- ret = clocksource_get_uname(buf, override_name, count);
+ ret = sysfs_get_uname(buf, override_name, count);
if (ret >= 0)
clocksource_select();
@@ -925,7 +926,7 @@ static ssize_t sysfs_unbind_clocksource(struct device *dev,
char name[CS_NAME_LEN];
size_t ret;
- ret = clocksource_get_uname(buf, name, count);
+ ret = sysfs_get_uname(buf, name, count);
if (ret < 0)
return ret;