mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: bunk@stusta.de, pavel@suse.cz, linux-kernel@vger.kernel.org
Subject: Re: -mm: PM=y, VT=n doesn't compile
Date: Sat, 18 Mar 2006 11:48:25 -0800	[thread overview]
Message-ID: <20060318114825.75dba55a.akpm@osdl.org> (raw)
In-Reply-To: <200603181704.44873.rjw@sisk.pl>

"Rafael J. Wysocki" <rjw@sisk.pl> wrote:
>
> --- linux-2.6.16-rc6-mm2.orig/drivers/base/power/suspend.c
>  +++ linux-2.6.16-rc6-mm2/drivers/base/power/suspend.c
>  @@ -8,6 +8,9 @@
>    *
>    */
>   
>  +#include <linux/vt_kern.h>
>  +#include <linux/kbd_kern.h>
>  +#include <linux/console.h>
>   #include <linux/device.h>
>   #include <linux/kallsyms.h>
>   #include <linux/pm.h>
>  @@ -65,6 +68,17 @@ int suspend_device(struct device * dev, 
>   	return error;
>   }
>   
>  +#ifdef CONFIG_VT
>  +static inline int is_suspend_console_safe(void)
>  +{
>  +	/* It is unsafe to suspend devices while X has control of the
>  +	 * hardware. Make sure we are running on a kernel-controlled console.
>  +	 */
>  +	return vc_cons[fg_console].d->vc_mode == KD_TEXT;
>  +}

Please implement this inside the vt subsystem, not the pm subsystem.  That way

a) It gets to be called "console_is_in_text_mode()", or
   "vt_not_running_X()" or something, which is something someone else might
   want to know.  

b) People who work on vt code don't need to keep an eye on a hunk of pm
   code at the same time.

c) You won't need all those includes.

>  +#else
>  +#define is_suspend_console_safe()	1

And this can go in console.h

>  +#endif

  reply	other threads:[~2006-03-18 19:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-17 17:18 Adrian Bunk
2006-03-18  1:50 ` Andrew Morton
2006-03-18 19:34   ` Rafael J. Wysocki
2006-03-18 16:04 ` Rafael J. Wysocki
2006-03-18 19:48   ` Andrew Morton [this message]
2006-03-18 19:58     ` Rafael J. Wysocki
2006-03-18 20:28       ` Rafael J. Wysocki
2006-03-19 18:47         ` 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=20060318114825.75dba55a.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=bunk@stusta.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pavel@suse.cz \
    --cc=rjw@sisk.pl \
    /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

all inboxes | Powered by JetHome®