From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753990AbbGTJlI (ORCPT ); Mon, 20 Jul 2015 05:41:08 -0400 Received: from terminus.zytor.com ([198.137.202.10]:54351 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753449AbbGTJlG (ORCPT ); Mon, 20 Jul 2015 05:41:06 -0400 Date: Mon, 20 Jul 2015 02:40:23 -0700 From: tip-bot for Thomas Gleixner Message-ID: Cc: gregkh@linuxfoundation.org, mingo@kernel.org, linux-kernel@vger.kernel.org, peterz@infradead.org, tglx@linutronix.de, hpa@zytor.com, shigekatsu.tateno@atmel.com Reply-To: peterz@infradead.org, linux-kernel@vger.kernel.org, mingo@kernel.org, gregkh@linuxfoundation.org, shigekatsu.tateno@atmel.com, hpa@zytor.com, tglx@linutronix.de In-Reply-To: <20150413210035.357448657@linutronix.de> References: <20150413210035.357448657@linutronix.de> To: linux-tip-commits@vger.kernel.org Subject: [tip:timers/core] staging: ozwpan: Fix hrtimer wreckage Git-Commit-ID: 5a447f09a8dffc0dd7569aec614ad3613a050098 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 5a447f09a8dffc0dd7569aec614ad3613a050098 Gitweb: http://git.kernel.org/tip/5a447f09a8dffc0dd7569aec614ad3613a050098 Author: Thomas Gleixner AuthorDate: Mon, 13 Apr 2015 21:02:25 +0000 Committer: Thomas Gleixner CommitDate: Mon, 20 Jul 2015 11:37:46 +0200 staging: ozwpan: Fix hrtimer wreckage oz_timer_add() modifies the expiry value of an active timer, which results in data corruption. Use hrtimer_start() and remove the silly conditional. While at it use the proper helper function to convert milliseconds to ktime. Signed-off-by: Thomas Gleixner Cc: Peter Zijlstra Cc: Shigekatsu Tateno Acked-by: Greg Kroah-Hartman Cc: devel@driverdev.osuosl.org Link: http://lkml.kernel.org/r/20150413210035.357448657@linutronix.de --- drivers/staging/ozwpan/ozproto.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/drivers/staging/ozwpan/ozproto.c b/drivers/staging/ozwpan/ozproto.c index 1ba24a2..23aa817 100644 --- a/drivers/staging/ozwpan/ozproto.c +++ b/drivers/staging/ozwpan/ozproto.c @@ -566,23 +566,14 @@ void oz_timer_add(struct oz_pd *pd, int type, unsigned long due_time) switch (type) { case OZ_TIMER_TOUT: case OZ_TIMER_STOP: - if (hrtimer_active(&pd->timeout)) { - hrtimer_set_expires(&pd->timeout, ktime_set(due_time / - MSEC_PER_SEC, (due_time % MSEC_PER_SEC) * - NSEC_PER_MSEC)); - hrtimer_start_expires(&pd->timeout, HRTIMER_MODE_REL); - } else { - hrtimer_start(&pd->timeout, ktime_set(due_time / - MSEC_PER_SEC, (due_time % MSEC_PER_SEC) * - NSEC_PER_MSEC), HRTIMER_MODE_REL); - } + hrtimer_start(&pd->timeout, ms_to_ktime(due_time), + HRTIMER_MODE_REL); pd->timeout_type = type; break; case OZ_TIMER_HEARTBEAT: if (!hrtimer_active(&pd->heartbeat)) - hrtimer_start(&pd->heartbeat, ktime_set(due_time / - MSEC_PER_SEC, (due_time % MSEC_PER_SEC) * - NSEC_PER_MSEC), HRTIMER_MODE_REL); + hrtimer_start(&pd->heartbeat, ms_to_ktime(due_time), + HRTIMER_MODE_REL); break; } spin_unlock_bh(&g_polling_lock);