On Mon, Feb 15, 2021 at 11:37:02AM +0100, Ahmad Fatoum wrote: > With the new fancy yielding poller support, we can properly represent > kernel threads in barebox. Do so. > > Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx> > --- > include/linux/kthread.h | 72 +++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 72 insertions(+) > create mode 100644 include/linux/kthread.h > > diff --git a/include/linux/kthread.h b/include/linux/kthread.h > new file mode 100644 > index 000000000000..17b6de9cf168 > --- /dev/null > +++ b/include/linux/kthread.h > @@ -0,0 +1,72 @@ > +/* SPDX-License-Identifier: GPL-2.0 */ > +#ifndef _LINUX_KTHREAD_H > +#define _LINUX_KTHREAD_H > +/* Wrapper around pollers to ease porting from Linux */ > + > +#include <linux/kernel.h> > +#include <linux/err.h> > +#include <linux/string.h> > +#include <poller.h> > + > +struct task_struct { > + struct poller_struct poller; > + int (*threadfn)(void *data); > + void *data; > +}; > + > +static inline void kthread_poller(struct poller_struct *poller) > +{ > + struct task_struct *task = container_of(poller, struct task_struct, poller); > + task->threadfn(task->data); > +} kthreads behave differently. When you return from a kthread then the thread is stopped. We should either behave the same way or use a different name. Sascha -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox