summaryrefslogtreecommitdiff
path: root/linux
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2018-05-17 01:38:57 -0400
committerKent Overstreet <kent.overstreet@gmail.com>2018-05-17 02:36:19 -0400
commitff86d4722124c300c40b85b6eb8ef2d410ab303c (patch)
tree05e54b0bf6397ecbb5e7717a7925ac6ed2645a68 /linux
parent800408be11898f6d53ceecfd894cce8860fda26a (diff)
Update bcachefs sources to 0906b1fb49 bcachefs: fixes for 32 bit/big endian machines
Diffstat (limited to 'linux')
-rw-r--r--linux/sched.c21
-rw-r--r--linux/timer.c2
-rw-r--r--linux/workqueue.c8
3 files changed, 20 insertions, 11 deletions
diff --git a/linux/sched.c b/linux/sched.c
index 2d61c480..de6eb142 100644
--- a/linux/sched.c
+++ b/linux/sched.c
@@ -40,14 +40,22 @@ void schedule(void)
v, NULL, NULL, 0);
}
-static void process_timeout(unsigned long __data)
+struct process_timer {
+ struct timer_list timer;
+ struct task_struct *task;
+};
+
+static void process_timeout(struct timer_list *t)
{
- wake_up_process((struct task_struct *)__data);
+ struct process_timer *timeout =
+ container_of(t, struct process_timer, timer);
+
+ wake_up_process(timeout->task);
}
long schedule_timeout(long timeout)
{
- struct timer_list timer;
+ struct process_timer timer;
unsigned long expire;
switch (timeout)
@@ -80,10 +88,11 @@ long schedule_timeout(long timeout)
expire = timeout + jiffies;
- setup_timer(&timer, process_timeout, (unsigned long)current);
- mod_timer(&timer, expire);
+ timer.task = current;
+ timer_setup_on_stack(&timer.timer, process_timeout, 0);
+ mod_timer(&timer.timer, expire);
schedule();
- del_timer_sync(&timer);
+ del_timer_sync(&timer.timer);
timeout = expire - jiffies;
out:
diff --git a/linux/timer.c b/linux/timer.c
index b67a54ac..dd5aba18 100644
--- a/linux/timer.c
+++ b/linux/timer.c
@@ -273,7 +273,7 @@ static int timer_thread(void *arg)
BUG_ON(!timer_running());
pthread_mutex_unlock(&timer_lock);
- timer->function(timer->data);
+ timer->function(timer);
pthread_mutex_lock(&timer_lock);
timer_seq++;
diff --git a/linux/workqueue.c b/linux/workqueue.c
index f5942772..4dfd6cd9 100644
--- a/linux/workqueue.c
+++ b/linux/workqueue.c
@@ -55,9 +55,10 @@ bool queue_work(struct workqueue_struct *wq, struct work_struct *work)
return ret;
}
-void delayed_work_timer_fn(unsigned long __data)
+void delayed_work_timer_fn(struct timer_list *timer)
{
- struct delayed_work *dwork = (struct delayed_work *) __data;
+ struct delayed_work *dwork =
+ container_of(timer, struct delayed_work, timer);
pthread_mutex_lock(&wq_lock);
__queue_work(dwork->wq, &dwork->work);
@@ -71,8 +72,7 @@ static void __queue_delayed_work(struct workqueue_struct *wq,
struct timer_list *timer = &dwork->timer;
struct work_struct *work = &dwork->work;
- BUG_ON(timer->function != delayed_work_timer_fn ||
- timer->data != (unsigned long)dwork);
+ BUG_ON(timer->function != delayed_work_timer_fn);
BUG_ON(timer_pending(timer));
BUG_ON(!list_empty(&work->entry));