Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935966AbdCXORy (ORCPT ); Fri, 24 Mar 2017 10:17:54 -0400 Received: from mail-pf0-f195.google.com ([209.85.192.195]:33504 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965711AbdCXOQP (ORCPT ); Fri, 24 Mar 2017 10:16:15 -0400 From: Geliang Tang To: Philipp Reisner , Lars Ellenberg Cc: Geliang Tang , drbd-dev@lists.linbit.com, linux-kernel@vger.kernel.org Subject: [PATCH] drbd: use setup_timer Date: Fri, 24 Mar 2017 22:15:11 +0800 Message-Id: <88d743591c2bd5e0c46009f7ec33fa326bf2db5e.1490341364.git.geliangtang@gmail.com> X-Mailer: git-send-email 2.9.3 In-Reply-To: <4841d2c2936addc27a2e774041d04ec16885ba03.1490341208.git.geliangtang@gmail.com> References: <4841d2c2936addc27a2e774041d04ec16885ba03.1490341208.git.geliangtang@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1636 Lines: 40 Use setup_timer() instead of init_timer() to simplify the code. Signed-off-by: Geliang Tang --- drivers/block/drbd/drbd_main.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/drivers/block/drbd/drbd_main.c b/drivers/block/drbd/drbd_main.c index 92c60cb..09846fc 100644 --- a/drivers/block/drbd/drbd_main.c +++ b/drivers/block/drbd/drbd_main.c @@ -2011,18 +2011,14 @@ void drbd_init_set_defaults(struct drbd_device *device) device->unplug_work.cb = w_send_write_hint; device->bm_io_work.w.cb = w_bitmap_io; - init_timer(&device->resync_timer); - init_timer(&device->md_sync_timer); - init_timer(&device->start_resync_timer); - init_timer(&device->request_timer); - device->resync_timer.function = resync_timer_fn; - device->resync_timer.data = (unsigned long) device; - device->md_sync_timer.function = md_sync_timer_fn; - device->md_sync_timer.data = (unsigned long) device; - device->start_resync_timer.function = start_resync_timer_fn; - device->start_resync_timer.data = (unsigned long) device; - device->request_timer.function = request_timer_fn; - device->request_timer.data = (unsigned long) device; + setup_timer(&device->resync_timer, resync_timer_fn, + (unsigned long)device); + setup_timer(&device->md_sync_timer, md_sync_timer_fn, + (unsigned long)device); + setup_timer(&device->start_resync_timer, start_resync_timer_fn, + (unsigned long)device); + setup_timer(&device->request_timer, request_timer_fn, + (unsigned long)device); init_waitqueue_head(&device->misc_wait); init_waitqueue_head(&device->state_wait); -- 2.9.3