mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-02 15:18:19 +00:00
clocksource: add unregister function to disable unusable clocksources
On x86 the PIT might become an unusable clocksource. Add an unregister function to provide a possibilty to remove the PIT from the list of available clock sources. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
parent
316da3b3fc
commit
4713e22ce8
3 changed files with 17 additions and 0 deletions
|
@ -13,6 +13,7 @@
|
||||||
#include <asm/delay.h>
|
#include <asm/delay.h>
|
||||||
#include <asm/i8253.h>
|
#include <asm/i8253.h>
|
||||||
#include <asm/io.h>
|
#include <asm/io.h>
|
||||||
|
#include <asm/hpet.h>
|
||||||
|
|
||||||
DEFINE_SPINLOCK(i8253_lock);
|
DEFINE_SPINLOCK(i8253_lock);
|
||||||
EXPORT_SYMBOL(i8253_lock);
|
EXPORT_SYMBOL(i8253_lock);
|
||||||
|
|
|
@ -215,6 +215,7 @@ static inline void clocksource_calculate_interval(struct clocksource *c,
|
||||||
|
|
||||||
/* used to install a new clocksource */
|
/* used to install a new clocksource */
|
||||||
extern int clocksource_register(struct clocksource*);
|
extern int clocksource_register(struct clocksource*);
|
||||||
|
extern void clocksource_unregister(struct clocksource*);
|
||||||
extern struct clocksource* clocksource_get_next(void);
|
extern struct clocksource* clocksource_get_next(void);
|
||||||
extern void clocksource_change_rating(struct clocksource *cs, int rating);
|
extern void clocksource_change_rating(struct clocksource *cs, int rating);
|
||||||
extern void clocksource_resume(void);
|
extern void clocksource_resume(void);
|
||||||
|
|
|
@ -337,6 +337,21 @@ void clocksource_change_rating(struct clocksource *cs, int rating)
|
||||||
spin_unlock_irqrestore(&clocksource_lock, flags);
|
spin_unlock_irqrestore(&clocksource_lock, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* clocksource_unregister - remove a registered clocksource
|
||||||
|
*/
|
||||||
|
void clocksource_unregister(struct clocksource *cs)
|
||||||
|
{
|
||||||
|
unsigned long flags;
|
||||||
|
|
||||||
|
spin_lock_irqsave(&clocksource_lock, flags);
|
||||||
|
list_del(&cs->list);
|
||||||
|
if (clocksource_override == cs)
|
||||||
|
clocksource_override = NULL;
|
||||||
|
next_clocksource = select_clocksource();
|
||||||
|
spin_unlock_irqrestore(&clocksource_lock, flags);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_SYSFS
|
#ifdef CONFIG_SYSFS
|
||||||
/**
|
/**
|
||||||
* sysfs_show_current_clocksources - sysfs interface for current clocksource
|
* sysfs_show_current_clocksources - sysfs interface for current clocksource
|
||||||
|
|
Loading…
Reference in a new issue