Skip to content

Commit 8ce3648

Browse files
committed
Merge tag 'timers-urgent-2021-05-16' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull timer fixes from Thomas Gleixner: "Two fixes for timers: - Use the ALARM feature check in the alarmtimer core code insted of the old method of checking for the set_alarm() callback. Drivers can have that callback set but the feature bit cleared. If such a RTC device is selected then alarms wont work. - Use a proper define to let the preprocessor check whether Hyper-V VDSO clocksource should be active. The code used a constant in an enum with #ifdef, which evaluates to always false and disabled the clocksource for VDSO" * tag 'timers-urgent-2021-05-16' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: clocksource/drivers/hyper-v: Re-enable VDSO_CLOCKMODE_HVCLOCK on X86 alarmtimer: Check RTC features instead of ops
2 parents f44e58b + 3486d2c commit 8ce3648

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

arch/x86/include/asm/vdso/clocksource.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,6 @@
77
VDSO_CLOCKMODE_PVCLOCK, \
88
VDSO_CLOCKMODE_HVCLOCK
99

10+
#define HAVE_VDSO_CLOCKMODE_HVCLOCK
11+
1012
#endif /* __ASM_VDSO_CLOCKSOURCE_H */

drivers/clocksource/hyperv_timer.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ static void resume_hv_clock_tsc(struct clocksource *arg)
419419
hv_set_register(HV_REGISTER_REFERENCE_TSC, tsc_msr);
420420
}
421421

422-
#ifdef VDSO_CLOCKMODE_HVCLOCK
422+
#ifdef HAVE_VDSO_CLOCKMODE_HVCLOCK
423423
static int hv_cs_enable(struct clocksource *cs)
424424
{
425425
vclocks_set_used(VDSO_CLOCKMODE_HVCLOCK);
@@ -435,7 +435,7 @@ static struct clocksource hyperv_cs_tsc = {
435435
.flags = CLOCK_SOURCE_IS_CONTINUOUS,
436436
.suspend= suspend_hv_clock_tsc,
437437
.resume = resume_hv_clock_tsc,
438-
#ifdef VDSO_CLOCKMODE_HVCLOCK
438+
#ifdef HAVE_VDSO_CLOCKMODE_HVCLOCK
439439
.enable = hv_cs_enable,
440440
.vdso_clock_mode = VDSO_CLOCKMODE_HVCLOCK,
441441
#else

kernel/time/alarmtimer.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ static int alarmtimer_rtc_add_device(struct device *dev,
9292
if (rtcdev)
9393
return -EBUSY;
9494

95-
if (!rtc->ops->set_alarm)
95+
if (!test_bit(RTC_FEATURE_ALARM, rtc->features))
9696
return -1;
9797
if (!device_may_wakeup(rtc->dev.parent))
9898
return -1;

0 commit comments

Comments
 (0)