From 8f368d485de0d1fb7d686beb4e4e26685410869e Mon Sep 17 00:00:00 2001 From: Hans Petter Selasky Date: Sun, 4 Mar 2018 18:51:43 +0000 Subject: [PATCH] Implement DEFINE_WAIT_FUNC() function macro and default_wake_function() in the LinuxKPI. MFC after: 1 week Submitted by: Johannes Lundberg Sponsored by: Mellanox Technologies Sponsored by: Limelight Networks --- sys/compat/linuxkpi/common/include/linux/wait.h | 8 ++++++-- sys/compat/linuxkpi/common/src/linux_schedule.c | 7 +++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/wait.h b/sys/compat/linuxkpi/common/include/linux/wait.h index 7edebf2e588..f162c5dd5e5 100644 --- a/sys/compat/linuxkpi/common/include/linux/wait.h +++ b/sys/compat/linuxkpi/common/include/linux/wait.h @@ -76,14 +76,18 @@ struct wait_queue_head { * renamed and furthermore must be the default wait queue callback. */ extern wait_queue_func_t autoremove_wake_function; +extern wait_queue_func_t default_wake_function; -#define DEFINE_WAIT(name) \ +#define DEFINE_WAIT_FUNC(name, function) \ wait_queue_t name = { \ .private = current, \ - .func = autoremove_wake_function, \ + .func = function, \ .task_list = LINUX_LIST_HEAD_INIT(name.task_list) \ } +#define DEFINE_WAIT(name) \ + DEFINE_WAIT_FUNC(name, autoremove_wake_function) + #define DECLARE_WAITQUEUE(name, task) \ wait_queue_t name = { \ .private = task, \ diff --git a/sys/compat/linuxkpi/common/src/linux_schedule.c b/sys/compat/linuxkpi/common/src/linux_schedule.c index 601f41c2c26..2557ea75d3a 100644 --- a/sys/compat/linuxkpi/common/src/linux_schedule.c +++ b/sys/compat/linuxkpi/common/src/linux_schedule.c @@ -176,6 +176,13 @@ autoremove_wake_function(wait_queue_t *wq, unsigned int state, int flags, return (ret); } +int +default_wake_function(wait_queue_t *wq, unsigned int state, int flags, + void *key __unused) +{ + return (wake_up_task(wq->private, state)); +} + void linux_wake_up(wait_queue_head_t *wqh, unsigned int state, int nr, bool locked) {