forked from luck/tmp_suning_uos_patched
91989c7078
A previous commit changed the notification mode from true/false to an
int, allowing notify-no, notify-yes, or signal-notify. This was
backwards compatible in the sense that any existing true/false user
would translate to either 0 (on notification sent) or 1, the latter
which mapped to TWA_RESUME. TWA_SIGNAL was assigned a value of 2.
Clean this up properly, and define a proper enum for the notification
mode. Now we have:
- TWA_NONE. This is 0, same as before the original change, meaning no
notification requested.
- TWA_RESUME. This is 1, same as before the original change, meaning
that we use TIF_NOTIFY_RESUME.
- TWA_SIGNAL. This uses TIF_SIGPENDING/JOBCTL_TASK_WORK for the
notification.
Clean up all the callers, switching their 0/1/false/true to using the
appropriate TWA_* mode for notifications.
Fixes: e91b481623
("task_work: teach task_work_add() to do signal_wake_up()")
Reviewed-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
34 lines
718 B
C
34 lines
718 B
C
/* SPDX-License-Identifier: GPL-2.0 */
|
|
#ifndef _LINUX_TASK_WORK_H
|
|
#define _LINUX_TASK_WORK_H
|
|
|
|
#include <linux/list.h>
|
|
#include <linux/sched.h>
|
|
|
|
typedef void (*task_work_func_t)(struct callback_head *);
|
|
|
|
static inline void
|
|
init_task_work(struct callback_head *twork, task_work_func_t func)
|
|
{
|
|
twork->func = func;
|
|
}
|
|
|
|
enum task_work_notify_mode {
|
|
TWA_NONE,
|
|
TWA_RESUME,
|
|
TWA_SIGNAL,
|
|
};
|
|
|
|
int task_work_add(struct task_struct *task, struct callback_head *twork,
|
|
enum task_work_notify_mode mode);
|
|
|
|
struct callback_head *task_work_cancel(struct task_struct *, task_work_func_t);
|
|
void task_work_run(void);
|
|
|
|
static inline void exit_task_work(struct task_struct *task)
|
|
{
|
|
task_work_run();
|
|
}
|
|
|
|
#endif /* _LINUX_TASK_WORK_H */
|