mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-11-01 01:03:52 +00:00
Merge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull timer fixes from Thomas Gleixner:
"A small set of fixes for time(r) related issues:
- Fix a long standing conversion issue in jiffies_to_msecs() for odd
HZ values like 1024 or 1200 which resulted in returning 0 for small
jiffies values due to rounding down.
- Use the proper CONFIG symbol in the new Y2038 safe compat code for
posix-timers. Not yet a visible breakage, but this will immediately
trigger when the architecture support for the new interfaces is
merged.
- Return an error code in the STM32 clocksource driver on failure
instead of success.
- Remove the redundant and stale irq disabled check in the posix cpu
timer code. The check is at the wrong place anyway and lockdep
already covers it via the sighand lock locking coverage"
* 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
time: Make sure jiffies_to_msecs() preserves non-zero time periods
posix-timers: Fix nanosleep_copyout() for CONFIG_COMPAT_32BIT_TIME
clocksource/drivers/stm32: Fix error return code
posix-cpu-timers: Remove lockdep_assert_irqs_disabled()
This commit is contained in:
commit
6242258b6b
4 changed files with 8 additions and 6 deletions
|
|
@ -304,8 +304,10 @@ static int __init stm32_timer_init(struct device_node *node)
|
||||||
|
|
||||||
to->private_data = kzalloc(sizeof(struct stm32_timer_private),
|
to->private_data = kzalloc(sizeof(struct stm32_timer_private),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
if (!to->private_data)
|
if (!to->private_data) {
|
||||||
|
ret = -ENOMEM;
|
||||||
goto deinit;
|
goto deinit;
|
||||||
|
}
|
||||||
|
|
||||||
rstc = of_reset_control_get(node, NULL);
|
rstc = of_reset_control_get(node, NULL);
|
||||||
if (!IS_ERR(rstc)) {
|
if (!IS_ERR(rstc)) {
|
||||||
|
|
|
||||||
|
|
@ -1659,7 +1659,7 @@ EXPORT_SYMBOL_GPL(hrtimer_init_sleeper);
|
||||||
int nanosleep_copyout(struct restart_block *restart, struct timespec64 *ts)
|
int nanosleep_copyout(struct restart_block *restart, struct timespec64 *ts)
|
||||||
{
|
{
|
||||||
switch(restart->nanosleep.type) {
|
switch(restart->nanosleep.type) {
|
||||||
#ifdef CONFIG_COMPAT
|
#ifdef CONFIG_COMPAT_32BIT_TIME
|
||||||
case TT_COMPAT:
|
case TT_COMPAT:
|
||||||
if (compat_put_timespec64(ts, restart->nanosleep.compat_rmtp))
|
if (compat_put_timespec64(ts, restart->nanosleep.compat_rmtp))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
|
||||||
|
|
@ -604,7 +604,6 @@ static int posix_cpu_timer_set(struct k_itimer *timer, int timer_flags,
|
||||||
/*
|
/*
|
||||||
* Disarm any old timer after extracting its expiry time.
|
* Disarm any old timer after extracting its expiry time.
|
||||||
*/
|
*/
|
||||||
lockdep_assert_irqs_disabled();
|
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
old_incr = timer->it.cpu.incr;
|
old_incr = timer->it.cpu.incr;
|
||||||
|
|
@ -1049,7 +1048,6 @@ static void posix_cpu_timer_rearm(struct k_itimer *timer)
|
||||||
/*
|
/*
|
||||||
* Now re-arm for the new expiry time.
|
* Now re-arm for the new expiry time.
|
||||||
*/
|
*/
|
||||||
lockdep_assert_irqs_disabled();
|
|
||||||
arm_timer(timer);
|
arm_timer(timer);
|
||||||
unlock:
|
unlock:
|
||||||
unlock_task_sighand(p, &flags);
|
unlock_task_sighand(p, &flags);
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/export.h>
|
#include <linux/export.h>
|
||||||
|
#include <linux/kernel.h>
|
||||||
#include <linux/timex.h>
|
#include <linux/timex.h>
|
||||||
#include <linux/capability.h>
|
#include <linux/capability.h>
|
||||||
#include <linux/timekeeper_internal.h>
|
#include <linux/timekeeper_internal.h>
|
||||||
|
|
@ -314,9 +315,10 @@ unsigned int jiffies_to_msecs(const unsigned long j)
|
||||||
return (j + (HZ / MSEC_PER_SEC) - 1)/(HZ / MSEC_PER_SEC);
|
return (j + (HZ / MSEC_PER_SEC) - 1)/(HZ / MSEC_PER_SEC);
|
||||||
#else
|
#else
|
||||||
# if BITS_PER_LONG == 32
|
# if BITS_PER_LONG == 32
|
||||||
return (HZ_TO_MSEC_MUL32 * j) >> HZ_TO_MSEC_SHR32;
|
return (HZ_TO_MSEC_MUL32 * j + (1ULL << HZ_TO_MSEC_SHR32) - 1) >>
|
||||||
|
HZ_TO_MSEC_SHR32;
|
||||||
# else
|
# else
|
||||||
return (j * HZ_TO_MSEC_NUM) / HZ_TO_MSEC_DEN;
|
return DIV_ROUND_UP(j * HZ_TO_MSEC_NUM, HZ_TO_MSEC_DEN);
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue