linux-laptop.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Schierl <schierlm-usenet@gmx.de>
To: fr@canb.auug.org.au, linux-laptop@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, mochel@digitalimplant.org
Subject: [PATCH] [APM] Is this the correct way to fix suspend bug introduced in 2.6.0-test4?
Date: Sun, 25 Jan 2004 20:50:38 +0100	[thread overview]
Message-ID: <13zy7qdcyz1q7$.50e5l3rpbsyx$.dlg@40tude.net> (raw)

Hi,

the patch below (against 2.6.1-mm5) fixes my APM problems (my laptop, Acer
TravelMate 210TEV (Celeron 700, 128 MB RAM), hangs after resuming from APM
since 2.6.0-test4).

I found the "fix" by trying to "reversely" backport the changes from
patch-2.6.0-test4.bz2 into 2.6.1-mm5 (the old device_suspend code calls
sysdev_suspend, the new one does not; so what do I lose if I call
sysdev_suspend myself?). This trial-and-error-approach finally led into the
patch below (which works great for me).

Most likely this is not the cleanest way to do this; but since I don't even
know what this sysdev_suspend does (except that it does something that
seems to be vital for making my laptop resume...), i don't know how to make
it better...

If you have any suggestions, tell me (or change it yourself and submit it),
if you think that's okay like that, please submit that to the guy who is
responsible for 2.6 (is it Linus or Andrew? did not follow lkml recently).

TIA,

Michael

PS: if possible, please CC me in yout replies

====== apm-bug-introduced-in-test4.patch ======
--- linux-2.6.1-mm5/arch/i386/kernel/apm.c.old	Sun Jan 25 14:48:27 2004
+++ linux-2.6.1-mm5/arch/i386/kernel/apm.c	Sun Jan 25 16:10:43 2004
@@ -234,6 +234,9 @@ extern spinlock_t i8253_lock;
 extern unsigned long get_cmos_time(void);
 extern void machine_real_restart(unsigned char *, int);
 
+extern int sysdev_resume(void);
+extern int sysdev_suspend(u32 state);
+
 #if defined(CONFIG_APM_DISPLAY_BLANK) && defined(CONFIG_VT)
 extern int (*console_blank_hook)(int);
 #endif
@@ -1199,6 +1202,7 @@ static int suspend(int vetoable)
 	}
 
 	device_suspend(3);
+	sysdev_suspend(3);
 
 	/* serialize with the timer interrupt */
 	write_seqlock_irq(&xtime_lock);
@@ -1232,6 +1236,7 @@ static int suspend(int vetoable)
 	if (err != APM_SUCCESS)
 		apm_error("suspend", err);
 	err = (err == APM_SUCCESS) ? 0 : -EIO;
+	sysdev_resume();
 	device_resume();
 	pm_send_all(PM_RESUME, (void *)0);
 	queue_event(APM_NORMAL_RESUME, NULL);
@@ -1250,6 +1255,7 @@ static void standby(void)
 {
 	int	err;
 
+	sysdev_suspend(3);
 	/* serialize with the timer interrupt */
 	write_seqlock_irq(&xtime_lock);
 	/* If needed, notify drivers here */
@@ -1259,6 +1265,7 @@ static void standby(void)
 	err = set_system_power_state(APM_STATE_STANDBY);
 	if ((err != APM_SUCCESS) && (err != APM_NO_ERROR))
 		apm_error("standby", err);
+	sysdev_resume();
 }
 
 static apm_event_t get_event(void)

             reply	other threads:[~2004-01-25 19:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-25 19:50 Michael Schierl [this message]
2004-01-28 17:46 ` [PATCH] [APM] Is this the correct way to fix suspend bug introduced in 2.6.0-test4? Pavel Machek
2004-01-29 19:10   ` Michael Schierl
2004-01-29 19:36     ` Michael Schierl
2004-01-29 19:55     ` Pavel Machek
2004-01-29 23:00 ` Axel Boldt

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='13zy7qdcyz1q7$.50e5l3rpbsyx$.dlg@40tude.net' \
    --to=schierlm-usenet@gmx.de \
    --cc=fr@canb.auug.org.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-laptop@vger.kernel.org \
    --cc=mochel@digitalimplant.org \
    --cc=schierlm@gmx.de \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).