From 8165f3131c6515fd7375dce7e2ee5759f237e011 Mon Sep 17 00:00:00 2001 From: Peter Mamonov Date: Thu, 24 Sep 2015 19:20:24 +0300 Subject: common: clock: introduce mdelay_non_interruptible() Signed-off-by: Peter Mamonov Signed-off-by: Sascha Hauer --- common/clock.c | 9 +++++++++ include/clock.h | 1 + include/common.h | 1 + 3 files changed, 11 insertions(+) diff --git a/common/clock.c b/common/clock.c index 35c9e6cbb8..2c5dd91ccd 100644 --- a/common/clock.c +++ b/common/clock.c @@ -202,6 +202,15 @@ void mdelay(unsigned long msecs) } EXPORT_SYMBOL(mdelay); +void mdelay_non_interruptible(unsigned long msecs) +{ + uint64_t start = get_time_ns(); + + while (!is_timeout_non_interruptible(start, msecs * MSECOND)) + ; +} +EXPORT_SYMBOL(mdelay_non_interruptible); + int init_clock(struct clocksource *cs) { current_clock = cs; diff --git a/include/clock.h b/include/clock.h index 691befc2e2..c3f4c5381f 100644 --- a/include/clock.h +++ b/include/clock.h @@ -38,6 +38,7 @@ int is_timeout_non_interruptible(uint64_t start_ns, uint64_t time_offset_ns); void ndelay(unsigned long nsecs); void mdelay(unsigned long msecs); +void mdelay_non_interruptible(unsigned long msecs); #define SECOND ((uint64_t)(1000 * 1000 * 1000)) #define MSECOND ((uint64_t)(1000 * 1000)) diff --git a/include/common.h b/include/common.h index 553a7f4f44..c57690812a 100644 --- a/include/common.h +++ b/include/common.h @@ -72,6 +72,7 @@ void __noreturn poweroff(void); /* lib_$(ARCH)/time.c */ void udelay (unsigned long); void mdelay (unsigned long); +void mdelay_non_interruptible (unsigned long); /* lib_generic/crc32.c */ uint32_t crc32(uint32_t, const void*, unsigned int); -- cgit v1.2.3