public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nigel Cunningham <ncunningham@linuxmail.org>
To: Andrew Morton <akpm@digeo.com>
Cc: Pavel Machek <pavel@ucw.cz>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: [PATCH 1/3] Fix sysdev time support
Date: Fri, 12 Nov 2004 09:58:57 +1100	[thread overview]
Message-ID: <1100213785.6031.29.camel@desktop.cunninghams> (raw)
In-Reply-To: <1100213485.6031.18.camel@desktop.cunninghams>

Make time_suspend and time_resume call get_cmos_time once only, so as to
eliminate unnecessary 1 second delays in suspending and resuming.

diff -ruN 990-old/arch/i386/kernel/time.c 990-new/arch/i386/kernel/time.c
--- 990-old/arch/i386/kernel/time.c	2004-11-12 08:12:58.275103280 +1100
+++ 990-new/arch/i386/kernel/time.c	2004-11-12 07:16:41.000000000 +1100
@@ -323,20 +323,22 @@
 
 static int time_suspend(struct sys_device *dev, u32 state)
 {
+	long cmos_time = get_cmos_time();
 	/*
 	 * Estimate time zone so that set_time can update the clock
 	 */
-	clock_cmos_diff = -get_cmos_time();
+	clock_cmos_diff = -cmos_time;
 	clock_cmos_diff += get_seconds();
-	sleep_start = get_cmos_time();
+	sleep_start = cmos_time;
 	return 0;
 }
 
 static int time_resume(struct sys_device *dev)
 {
 	unsigned long flags;
-	unsigned long sec = get_cmos_time() + clock_cmos_diff;
-	unsigned long sleep_length = get_cmos_time() - sleep_start;
+	unsigned long cmos_time = get_cmos_time();
+	unsigned long sec = cmos_time + clock_cmos_diff;
+	unsigned long sleep_length = cmos_time - sleep_start;
 
 	write_seqlock_irqsave(&xtime_lock, flags);
 	xtime.tv_sec = sec;

-- 
Nigel Cunningham
Pastoral Worker
Christian Reformed Church of Tuggeranong
PO Box 1004, Tuggeranong, ACT 2901

You see, at just the right time, when we were still powerless, Christ
died for the ungodly.		-- Romans 5:6


  reply	other threads:[~2004-11-11 23:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-11-11 22:58 [PATCH 0/3] Fix sysdev time support Nigel Cunningham
2004-11-11 22:58 ` Nigel Cunningham [this message]
2004-11-12  7:58   ` [PATCH 1/3] " Pavel Machek
2004-11-11 22:59 ` [PATCH 2/3] " Nigel Cunningham
2004-11-12  8:03   ` Pavel Machek
2004-11-11 22:59 ` [PATCH 3/3] " Nigel Cunningham
2004-11-12  8:00   ` Pavel Machek
2004-11-12 20:33     ` Nigel Cunningham
2004-11-12 21:15       ` Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1100213785.6031.29.camel@desktop.cunninghams \
    --to=ncunningham@linuxmail.org \
    --cc=akpm@digeo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pavel@ucw.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox