kthread.c (bbda86e988d4c124e4cfa816291cbd583ae8bfb1) kthread.c (cead18552660702a4a46f58e65188fe5f36e9dfe)
1// SPDX-License-Identifier: GPL-2.0-only
2/* Kernel thread helper functions.
3 * Copyright (C) 2004 IBM Corporation, Rusty Russell.
4 * Copyright (C) 2009 Red Hat, Inc.
5 *
6 * Creation is done via kthreadd, so that we get a clean environment
7 * even if we're invoked from userspace (think modprobe, hotplug cpu,
8 * etc.).

--- 269 unchanged lines hidden (view full) ---

278 *
279 * Does not return.
280 */
281void __noreturn kthread_exit(long result)
282{
283 do_exit(result);
284}
285
1// SPDX-License-Identifier: GPL-2.0-only
2/* Kernel thread helper functions.
3 * Copyright (C) 2004 IBM Corporation, Rusty Russell.
4 * Copyright (C) 2009 Red Hat, Inc.
5 *
6 * Creation is done via kthreadd, so that we get a clean environment
7 * even if we're invoked from userspace (think modprobe, hotplug cpu,
8 * etc.).

--- 269 unchanged lines hidden (view full) ---

278 *
279 * Does not return.
280 */
281void __noreturn kthread_exit(long result)
282{
283 do_exit(result);
284}
285
286/**
287 * kthread_complete_and exit - Exit the current kthread.
288 * @comp: Completion to complete
289 * @code: The integer value to return to kthread_stop().
290 *
291 * If present complete @comp and the reuturn code to kthread_stop().
292 *
293 * A kernel thread whose module may be removed after the completion of
294 * @comp can use this function exit safely.
295 *
296 * Does not return.
297 */
298void __noreturn kthread_complete_and_exit(struct completion *comp, long code)
299{
300 if (comp)
301 complete(comp);
302
303 kthread_exit(code);
304}
305EXPORT_SYMBOL(kthread_complete_and_exit);
306
286static int kthread(void *_create)
287{
288 static const struct sched_param param = { .sched_priority = 0 };
289 /* Copy data: it's on kthread's stack */
290 struct kthread_create_info *create = _create;
291 int (*threadfn)(void *data) = create->threadfn;
292 void *data = create->data;
293 struct completion *done;

--- 1192 unchanged lines hidden ---
307static int kthread(void *_create)
308{
309 static const struct sched_param param = { .sched_priority = 0 };
310 /* Copy data: it's on kthread's stack */
311 struct kthread_create_info *create = _create;
312 int (*threadfn)(void *data) = create->threadfn;
313 void *data = create->data;
314 struct completion *done;

--- 1192 unchanged lines hidden ---