[linux-yocto] [PATCH linux-yocto v4.15] yaffs2: Adjust the timer callback and init functions

Kevin Hao kexin.hao at windriver.com
Thu Feb 22 21:32:51 PST 2018


The timer callback argument type has been changed by commit 354b46b1a0ad
("timer: Switch callback prototype to take struct timer_list *
argument") and init_timer_on_stack() is also removed by commit
9c6c273aa424 ("timer: Remove init_timer_on_stack() in favor of
timer_setup_on_stack()"). Adjust the codes in yaffs2 according to
these changes.

Signed-off-by: Kevin Hao <kexin.hao at windriver.com>
---
 fs/yaffs2/yaffs_vfs.c | 26 ++++++++++++++++----------
 1 file changed, 16 insertions(+), 10 deletions(-)

diff --git a/fs/yaffs2/yaffs_vfs.c b/fs/yaffs2/yaffs_vfs.c
index c7be4cddd1de..c99acf08a0d8 100644
--- a/fs/yaffs2/yaffs_vfs.c
+++ b/fs/yaffs2/yaffs_vfs.c
@@ -136,7 +136,7 @@
 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 26))
 #define Y_INIT_TIMER(a)	init_timer(a)
 #else
-#define Y_INIT_TIMER(a)	init_timer_on_stack(a)
+#define Y_INIT_TIMER(a)	timer_setup_on_stack(a, NULL, 0)
 #endif
 
 #if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 27))
@@ -2065,10 +2065,16 @@ static unsigned yaffs_bg_gc_urgency(struct yaffs_dev *dev)
 }
 
 #ifdef YAFFS_COMPILE_BACKGROUND
+struct yaffs_timer {
+	struct timer_list timer;
+	struct task_struct *tsk;
+};
 
-void yaffs_background_waker(unsigned long data)
+void yaffs_background_waker(struct timer_list *t)
 {
-	wake_up_process((struct task_struct *)data);
+	struct yaffs_timer *yt = from_timer(yt, t, timer);
+
+	wake_up_process(yt->tsk);
 }
 
 static int yaffs_bg_thread_fn(void *data)
@@ -2082,7 +2088,7 @@ static int yaffs_bg_thread_fn(void *data)
 	unsigned int urgency;
 
 	int gc_result;
-	struct timer_list timer;
+	struct yaffs_timer yt;
 
 	yaffs_trace(YAFFS_TRACE_BACKGROUND,
 		"yaffs_background starting for dev %p", (void *)dev);
@@ -2135,15 +2141,15 @@ static int yaffs_bg_thread_fn(void *data)
 		if (time_before(expires, now))
 			expires = now + HZ;
 
-		Y_INIT_TIMER(&timer);
-		timer.expires = expires + 1;
-		timer.data = (unsigned long)current;
-		timer.function = yaffs_background_waker;
+		Y_INIT_TIMER(&yt.timer);
+		yt.timer.function = yaffs_background_waker;
+		yt.timer.expires = expires + 1;
+		yt.tsk = current;
 
 		set_current_state(TASK_INTERRUPTIBLE);
-		add_timer(&timer);
+		add_timer(&yt.timer);
 		schedule();
-		del_timer_sync(&timer);
+		del_timer_sync(&yt.timer);
 #else
 		msleep(10);
 #endif
-- 
2.9.3



More information about the linux-yocto mailing list