fs/ncpfs: Convert timers to use timer_setup()
authorKees Cook <keescook@chromium.org>
Wed, 30 Aug 2017 04:00:21 +0000 (21:00 -0700)
committerKees Cook <keescook@chromium.org>
Thu, 2 Nov 2017 22:44:09 +0000 (15:44 -0700)
In preparation for unconditionally passing the struct timer_list pointer to
all timer callbacks, switch to using the new timer_setup() and from_timer()
to pass the timer pointer explicitly.

Cc: Petr Vandrovec <petr@vandrovec.name>
Cc: Jan Kara <jack@suse.cz>
Cc: Jens Axboe <axboe@fb.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Jan Kara <jack@suse.cz>
fs/ncpfs/inode.c
fs/ncpfs/ncp_fs_sb.h
fs/ncpfs/sock.c

index 6d0f14c8609971378ee75104380873a6da67a4be..129f1937fa2c11527633c98a8840c2aae011fa0e 100644 (file)
@@ -618,7 +618,7 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
        server->tx.creq         = NULL;
        server->rcv.creq        = NULL;
 
-       init_timer(&server->timeout_tm);
+       timer_setup(&server->timeout_tm, ncpdgram_timeout_call, 0);
 #undef NCP_PACKET_SIZE
 #define NCP_PACKET_SIZE 131072
        error = -ENOMEM;
@@ -650,8 +650,6 @@ static int ncp_fill_super(struct super_block *sb, void *raw_data, int silent)
        } else {
                INIT_WORK(&server->rcv.tq, ncpdgram_rcv_proc);
                INIT_WORK(&server->timeout_tq, ncpdgram_timeout_proc);
-               server->timeout_tm.data = (unsigned long)server;
-               server->timeout_tm.function = ncpdgram_timeout_call;
        }
        release_sock(sock->sk);
 
index 366fd63cc506fc3e61be93877349ef6032cf5734..2088d94ead93390b02a7facb4d961269534b1ac5 100644 (file)
@@ -149,7 +149,7 @@ extern void ncp_tcp_rcv_proc(struct work_struct *work);
 extern void ncp_tcp_tx_proc(struct work_struct *work);
 extern void ncpdgram_rcv_proc(struct work_struct *work);
 extern void ncpdgram_timeout_proc(struct work_struct *work);
-extern void ncpdgram_timeout_call(unsigned long server);
+extern void ncpdgram_timeout_call(struct timer_list *t);
 extern void ncp_tcp_data_ready(struct sock* sk);
 extern void ncp_tcp_write_space(struct sock* sk);
 extern void ncp_tcp_error_report(struct sock* sk);
index 98b6db0ed63e0323477be82768f9c3c08a06de5d..56c45c78b0b84647a6d8285500df1bec3ba95d88 100644 (file)
@@ -116,10 +116,10 @@ void ncp_tcp_write_space(struct sock *sk)
                schedule_work(&server->tx.tq);
 }
 
-void ncpdgram_timeout_call(unsigned long v)
+void ncpdgram_timeout_call(struct timer_list *t)
 {
-       struct ncp_server *server = (void*)v;
-       
+       struct ncp_server *server = from_timer(server, t, timeout_tm);
+
        schedule_work(&server->timeout_tq);
 }