Commit 86098bcd authored by Petr Mladek's avatar Petr Mladek

Merge branch 'rework/misc-cleanups' into for-linus

parents adb982ad 29fda1ad
...@@ -3727,7 +3727,8 @@ late_initcall(printk_late_init); ...@@ -3727,7 +3727,8 @@ late_initcall(printk_late_init);
/* If @con is specified, only wait for that console. Otherwise wait for all. */ /* If @con is specified, only wait for that console. Otherwise wait for all. */
static bool __pr_flush(struct console *con, int timeout_ms, bool reset_on_progress) static bool __pr_flush(struct console *con, int timeout_ms, bool reset_on_progress)
{ {
int remaining = timeout_ms; unsigned long timeout_jiffies = msecs_to_jiffies(timeout_ms);
unsigned long remaining_jiffies = timeout_jiffies;
struct console *c; struct console *c;
u64 last_diff = 0; u64 last_diff = 0;
u64 printk_seq; u64 printk_seq;
...@@ -3744,6 +3745,9 @@ static bool __pr_flush(struct console *con, int timeout_ms, bool reset_on_progre ...@@ -3744,6 +3745,9 @@ static bool __pr_flush(struct console *con, int timeout_ms, bool reset_on_progre
console_unlock(); console_unlock();
for (;;) { for (;;) {
unsigned long begin_jiffies;
unsigned long slept_jiffies;
diff = 0; diff = 0;
/* /*
...@@ -3772,24 +3776,20 @@ static bool __pr_flush(struct console *con, int timeout_ms, bool reset_on_progre ...@@ -3772,24 +3776,20 @@ static bool __pr_flush(struct console *con, int timeout_ms, bool reset_on_progre
console_srcu_read_unlock(cookie); console_srcu_read_unlock(cookie);
if (diff != last_diff && reset_on_progress) if (diff != last_diff && reset_on_progress)
remaining = timeout_ms; remaining_jiffies = timeout_jiffies;
console_unlock(); console_unlock();
/* Note: @diff is 0 if there are no usable consoles. */ /* Note: @diff is 0 if there are no usable consoles. */
if (diff == 0 || remaining == 0) if (diff == 0 || remaining_jiffies == 0)
break; break;
if (remaining < 0) { /* msleep(1) might sleep much longer. Check time by jiffies. */
/* no timeout limit */ begin_jiffies = jiffies;
msleep(100); msleep(1);
} else if (remaining < 100) { slept_jiffies = jiffies - begin_jiffies;
msleep(remaining);
remaining = 0; remaining_jiffies -= min(slept_jiffies, remaining_jiffies);
} else {
msleep(100);
remaining -= 100;
}
last_diff = diff; last_diff = diff;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment