From 8fcfcbce0e9b985be0c06568b1e8e5f4216baa7a Mon Sep 17 00:00:00 2001 From: Christian Prochaska Date: Thu, 26 Jan 2017 17:20:17 +0100 Subject: [PATCH] lxip: implement 'mod_delayed_work()' Fixes #2258 --- repos/dde_linux/src/lib/lxip/dummies.cc | 1 - repos/dde_linux/src/lib/lxip/lxcc_emul.cc | 28 +++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/repos/dde_linux/src/lib/lxip/dummies.cc b/repos/dde_linux/src/lib/lxip/dummies.cc index 809bfdb03e..da598d13c1 100644 --- a/repos/dde_linux/src/lib/lxip/dummies.cc +++ b/repos/dde_linux/src/lib/lxip/dummies.cc @@ -335,7 +335,6 @@ DUMMY(-1, linkwatch_run_queue) DUMMY(-1, local_softirq_pending) DUMMY(-1, lockdep_rtnl_is_held) DUMMY(-1, min) -DUMMY_STOP(-1, mod_delayed_work) DUMMY(-1, module_put) DUMMY(-1, move_addr_to_kernel) DUMMY(-1, mq_qdisc_ops) diff --git a/repos/dde_linux/src/lib/lxip/lxcc_emul.cc b/repos/dde_linux/src/lib/lxip/lxcc_emul.cc index 1145fa0756..01beac15f5 100644 --- a/repos/dde_linux/src/lib/lxip/lxcc_emul.cc +++ b/repos/dde_linux/src/lib/lxip/lxcc_emul.cc @@ -690,3 +690,31 @@ size_t csum_and_copy_to_iter(void *addr, size_t bytes, __wsum *csum, struct iov_ ******************/ void __wake_up(wait_queue_head_t *q, bool all) { } + + +/*********************** + ** linux/workqueue.h ** + ***********************/ + +static void execute_delayed_work(unsigned long dwork) +{ + delayed_work *d = (delayed_work *)dwork; + d->work.func(&d->work); +} + + +bool mod_delayed_work(struct workqueue_struct *wq, struct delayed_work *dwork, + unsigned long delay) +{ + /* treat delayed work without delay like any other work */ + if (delay == 0) { + execute_delayed_work((unsigned long)dwork); + } else { + if (!dwork->timer.function) { + setup_timer(&dwork->timer, execute_delayed_work, + (unsigned long)dwork); + } + mod_timer(&dwork->timer, delay); + } + return true; +}