All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jesper Juhl <jesper.juhl@gmail.com>
To: Thomas Hood <jdthood@aglu.demon.nl>
Cc: linux-kernel@vger.kernel.org,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	Andrew Morton <akpm@osdl.org>
Subject: Re: [FIX] apm.c: ignore_normal_resume is set to 1 a bit too late
Date: Mon, 13 Jun 2005 23:38:17 +0200	[thread overview]
Message-ID: <9a8748490506131438923fbf3@mail.gmail.com> (raw)
In-Reply-To: <1118655939.7066.37.camel@thanatos>

[-- Attachment #1: Type: text/plain, Size: 2692 bytes --]

On 6/13/05, Thomas Hood <jdthood@aglu.demon.nl> wrote:
> This message contains a fix for a bug in the apm driver.
> 
> A bug report was submitted to the Debian BTS saying that on the
> submitter's system the apmd proxy script was being run twice on resume.
> 
> Having seen exactly the same problem some years ago and knowing that the
> solution then was to ensure that the ignore_normal_resume flag got set
> before there was any chance of an APM RESUME event being processed, I
> checked the current apm.c and I found that ignore_normal_resume was once
> again being set too late.  I asked the submitter to move the line where
> the flag was set and he reported that this change solved the problem.  I
> append the message in question.  The line numbers I mention there are
> for Linux 2.6.11.
> 
> Please make the indicated change to the apm driver.
> 
> -------- Forwarded Message --------
> jdthood@aglu.demon.nl wrote to the submitter of Debian bug #310865:
> > In arch/i386/kernel/apm.c there is at approximately line 1229:
> >
> >         ignore_normal_resume = 1;
> >
> > Move this up so that it occurs right after line 1222:
> >
> >         err = set_system_power_state(APM_STATE_SUSPEND);
> >
> > Let us know if that helps.
> 
> 
> It does. Very nice.
> I don't understand what I did and how it works. Will you try to
> push that into kernel sources or is this no permanent fix?
> --
> Thomas Hood <jdthood@aglu.demon.nl>
> 

Here it is in the form of a patch against 2.6.12-rc6-mm1 for easier
merging - Stephen, Andrew, is this a valid fix? I don't know the apm
code well enough to properly judge.
(also attached since gmail tends to mangle inline patches)


Prevent double resume in apm.

Signed-off-by: Jesper juhl <jesper.juhl@gmail.com>
---

 arch/i386/kernel/apm.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

--- linux-2.6.12-rc6-mm1-orig/arch/i386/kernel/apm.c	2005-06-12
15:58:34.000000000 +0200
+++ linux-2.6.12-rc6-mm1/arch/i386/kernel/apm.c	2005-06-13
23:39:57.000000000 +0200
@@ -1222,6 +1222,7 @@ static int suspend(int vetoable)
 
 	save_processor_state();
 	err = set_system_power_state(APM_STATE_SUSPEND);
+	ignore_normal_resume = 1;
 	restore_processor_state();
 
 	local_irq_disable();
@@ -1229,7 +1230,6 @@ static int suspend(int vetoable)
 	spin_lock(&i8253_lock);
 	reinit_timer();
 	set_time();
-	ignore_normal_resume = 1;
 
 	spin_unlock(&i8253_lock);
 	write_sequnlock(&xtime_lock);



-- 
Jesper Juhl <jesper.juhl@gmail.com>
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please      http://www.expita.com/nomime.html

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: prevent-double-resume-in-apm.patch --]
[-- Type: text/x-patch; name="prevent-double-resume-in-apm.patch", Size: 592 bytes --]

--- linux-2.6.12-rc6-mm1-orig/arch/i386/kernel/apm.c	2005-06-12 15:58:34.000000000 +0200
+++ linux-2.6.12-rc6-mm1/arch/i386/kernel/apm.c	2005-06-13 23:39:57.000000000 +0200
@@ -1222,6 +1222,7 @@ static int suspend(int vetoable)
 
 	save_processor_state();
 	err = set_system_power_state(APM_STATE_SUSPEND);
+	ignore_normal_resume = 1;
 	restore_processor_state();
 
 	local_irq_disable();
@@ -1229,7 +1230,6 @@ static int suspend(int vetoable)
 	spin_lock(&i8253_lock);
 	reinit_timer();
 	set_time();
-	ignore_normal_resume = 1;
 
 	spin_unlock(&i8253_lock);
 	write_sequnlock(&xtime_lock);

  parent reply	other threads:[~2005-06-13 21:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-13  9:45 [FIX] apm.c: ignore_normal_resume is set to 1 a bit too late Thomas Hood
     [not found] ` <20050613222003.2895ac2c.sfr@canb.auug.org.au>
2005-06-13 13:50   ` [PATCH] apm.c: ignore_normal_resume is set " Thomas Hood
2005-06-13 21:38 ` Jesper Juhl [this message]
  -- strict thread matches above, loose matches on Subject: below --
2005-06-05 21:24 [FIX] apm.c: ignore_normal_resume is set to 1 " Thomas Hood
2005-05-27 22:45 Thomas Hood

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=9a8748490506131438923fbf3@mail.gmail.com \
    --to=jesper.juhl@gmail.com \
    --cc=akpm@osdl.org \
    --cc=jdthood@aglu.demon.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sfr@canb.auug.org.au \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.