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-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon,  5 Mar 2012 14:51:57 +0100
From:	Jiri Slaby <jslaby@...e.cz>
To:	gregkh@...uxfoundation.org
Cc:	alan@...ux.intel.com, linux-serial@...r.kernel.org,
	linux-kernel@...r.kernel.org, jirislaby@...il.com,
	Richard Henderson <rth@...ddle.net>,
	Ivan Kokshaysky <ink@...assic.park.msu.ru>,
	Matt Turner <mattst88@...il.com>
Subject: [PATCH 10/68] ALPHA: srmcons, use timer functions

It makes the code more readable. We move the setup to the allocation
location because we need to initialize timers only once.

Signed-off-by: Jiri Slaby <jslaby@...e.cz>
Cc: Richard Henderson <rth@...ddle.net>
Cc: Ivan Kokshaysky <ink@...assic.park.msu.ru>
Cc: Matt Turner <mattst88@...il.com>
---
 arch/alpha/kernel/srmcons.c |   14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/arch/alpha/kernel/srmcons.c b/arch/alpha/kernel/srmcons.c
index 783f4e5..f1fdf17 100644
--- a/arch/alpha/kernel/srmcons.c
+++ b/arch/alpha/kernel/srmcons.c
@@ -79,10 +79,8 @@ srmcons_receive_chars(unsigned long data)
 	} 
 
 	spin_lock(&srmconsp->lock);
-	if (srmconsp->tty) {
-		srmconsp->timer.expires = jiffies + incr;
-		add_timer(&srmconsp->timer);
-	}
+	if (srmconsp->tty)
+		mod_timer(&srmconsp->timer, jiffies + incr);
 	spin_unlock(&srmconsp->lock);
 
 	local_irq_restore(flags);
@@ -172,7 +170,8 @@ srmcons_get_private_struct(struct srmcons_private **ps)
 		else {
 			srmconsp->tty = NULL;
 			spin_lock_init(&srmconsp->lock);
-			init_timer(&srmconsp->timer);
+			setup_timer(&srmconsp->timer, srmcons_receive_chars,
+					(unsigned long)srmconsp);
 		}
 
 		spin_unlock_irqrestore(&srmconsp_lock, flags);
@@ -199,10 +198,7 @@ srmcons_open(struct tty_struct *tty, struct file *filp)
 		tty->driver_data = srmconsp;
 
 		srmconsp->tty = tty;
-		srmconsp->timer.function = srmcons_receive_chars;
-		srmconsp->timer.data = (unsigned long)srmconsp;
-		srmconsp->timer.expires = jiffies + 10;
-		add_timer(&srmconsp->timer);
+		mod_timer(&srmconsp->timer, jiffies + 10);
 	}
 
 	spin_unlock_irqrestore(&srmconsp->lock, flags);
-- 
1.7.9.2


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ