summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAhmad Fatoum <ahmad@a3f.at>2021-03-10 09:47:56 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2021-03-17 11:55:30 +0100
commit5f129c98629190827dcd387ac79e0076bbc0eb25 (patch)
treedecd99b692c7961bef370561eee842b3d24dabf7
parent10349680225215a4f809e597f67cc3260c68ea75 (diff)
downloadbarebox-5f129c98629190827dcd387ac79e0076bbc0eb25.tar.gz
barebox-5f129c98629190827dcd387ac79e0076bbc0eb25.tar.xz
common: poller: replace explicit calls to poller_call() with resched()
We won't replace pollers with bthreads completely over night. To make migration easier, replace explicit calls to poller_call with a new resched() function. This can be made to call bthread_reschedule() in future and eventually replaced with bthread_reschedule() once pollers are removed. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--common/clock.c4
-rw-r--r--common/console.c4
-rw-r--r--include/sched.h12
-rw-r--r--lib/readline.c4
4 files changed, 18 insertions, 6 deletions
diff --git a/common/clock.c b/common/clock.c
index 7eeba88317..fa90d1a457 100644
--- a/common/clock.c
+++ b/common/clock.c
@@ -13,7 +13,7 @@
#include <init.h>
#include <linux/math64.h>
#include <clock.h>
-#include <poller.h>
+#include <sched.h>
static uint64_t time_ns;
@@ -172,7 +172,7 @@ int is_timeout(uint64_t start_ns, uint64_t time_offset_ns)
int ret = is_timeout_non_interruptible(start_ns, time_offset_ns);
if (time_offset_ns >= 100 * USECOND)
- poller_call();
+ resched();
return ret;
}
diff --git a/common/console.c b/common/console.c
index 306149c99e..a436c37aa3 100644
--- a/common/console.c
+++ b/common/console.c
@@ -17,7 +17,7 @@
#include <clock.h>
#include <kfifo.h>
#include <module.h>
-#include <poller.h>
+#include <sched.h>
#include <ratp_bb.h>
#include <magicvar.h>
#include <globalvar.h>
@@ -585,7 +585,7 @@ int ctrlc(void)
if (ctrlc_abort)
return 1;
- poller_call();
+ resched();
#ifdef ARCH_HAS_CTRLC
ret = arch_ctrlc();
diff --git a/include/sched.h b/include/sched.h
new file mode 100644
index 0000000000..43d239c3ef
--- /dev/null
+++ b/include/sched.h
@@ -0,0 +1,12 @@
+/* SPDX License Identifier: GPL-2.0 */
+#ifndef __BAREBOX_SCHED_H_
+#define __BAREBOX_SCHED_H_
+
+#include <poller.h>
+
+static inline void resched(void)
+{
+ poller_call();
+}
+
+#endif
diff --git a/lib/readline.c b/lib/readline.c
index e5370f9c7b..25aa99b95e 100644
--- a/lib/readline.c
+++ b/lib/readline.c
@@ -2,7 +2,7 @@
#include <readkey.h>
#include <init.h>
#include <libbb.h>
-#include <poller.h>
+#include <sched.h>
#include <xfuncs.h>
#include <complete.h>
#include <linux/ctype.h>
@@ -200,7 +200,7 @@ int readline(const char *prompt, char *buf, int len)
while (1) {
while (!tstc())
- poller_call();
+ resched();
ichar = read_key();