lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20161213143957.30708-1-xieqr16@lzu.edu.cn>
Date:   Tue, 13 Dec 2016 22:39:57 +0800
From:   Xie Qirong <xieqr16@....edu.cn>
To:     Bryan O'Donoghue <pure.logic@...us-software.ie>
Cc:     Johan Hovold <johan@...nel.org>, Alex Elder <elder@...nel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        devel@...verdev.osuosl.org, linux-kernel@...r.kernel.org,
        Bryan O'Donoghue <bryan.odonoghue@...aro.org>,
        Xie Qirong <xieqr16@....edu.cn>
Subject: [PATCH] greybus: timesync: replace init_timer with setup_timer

The combination of init_timer and setting up the data and function field
manually is equivalent to calling setup_timer(). This is an api 
consolidation only and improves readability.

Signed-off-by: Xie Qirong <xieqr16@....edu.cn>
---

 setup_timer.cocci suggested the following improvement:
 drivers/staging/greybus/timesync.c:1058:1-11: Use setup_timer function 
 for function on line 1059.

 Patch was compile checked with: x86_64_defconfig + CONFIG_STAGING=y, 
 CONFIG_GREYBUS=m

 Kernel version: 4.9.0 (localversion-next is next-20161213)

 drivers/staging/greybus/timesync.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/greybus/timesync.c b/drivers/staging/greybus/timesync.c
index 29e6c1c..af83e12 100644
--- a/drivers/staging/greybus/timesync.c
+++ b/drivers/staging/greybus/timesync.c
@@ -1055,10 +1055,9 @@ int gb_timesync_svc_add(struct gb_svc *svc)
 		goto done;
 	}
 
-	init_timer(&timesync_svc->ktime_timer);
-	timesync_svc->ktime_timer.function = gb_timesync_ktime_timer_fn;
+	setup_timer(&timesync_svc->ktime_timer, gb_timesync_ktime_timer_fn,
+		(unsigned long)timesync_svc);
 	timesync_svc->ktime_timer.expires = jiffies + GB_TIMESYNC_KTIME_UPDATE;
-	timesync_svc->ktime_timer.data = (unsigned long)timesync_svc;
 	add_timer(&timesync_svc->ktime_timer);
 done:
 	mutex_unlock(&gb_timesync_svc_list_mutex);
-- 
2.10.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ