Re: [RFC][PATCH -mm] swsusp userland interface: additional ioctl

Rafael J. Wysocki
2006-01-30T21:15:09Z

Hi,

On Monday 30 January 2006 00:06, Pavel Machek wrote:
> > > > The appended patch provides an additional ioctl() for the swsusp userland
> > > > interface that will allow the suspending and/or resuming utilities to change
> > > > the kernel log level at the time of suspend/resume (or even set it to 0 if
> > > > they are going to use some frame buffer graphics etc.).
> > >
> > > klogd can already change loglevel... It should be possible to use that
> > > to silence suspend, no?
> >
> > Well, no. Currently the kernel changes the log level to 10 unconditionally
> > in pm_prepare_console() (that's the reason for the patch, BTW).
>
> Can we just kill that log-level setting? It may have been useful in
> the past, but I do not think it has right to live any more.

Sure, we can:

Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>

kernel/power/console.c | 12 +-----------
kernel/power/power.h | 5 +++++
2 files changed, 6 insertions(+), 11 deletions(-)

Index: linux-2.6.16-rc1-mm4/kernel/power/console.c
===================================================================
--- linux-2.6.16-rc1-mm4.orig/kernel/power/console.c 2006-01-30 21:17:53.000000000 +0100
+++ linux-2.6.16-rc1-mm4/kernel/power/console.c 2006-01-30 21:32:24.000000000 +0100
@@ -9,18 +9,11 @@
#include <linux/console.h>
#include "power.h"

-static int new_loglevel = 10;
-static int orig_loglevel;
#ifdef SUSPEND_CONSOLE
static int orig_fgconsole, orig_kmsg;
-#endif

int pm_prepare_console(void)
{
- orig_loglevel = console_loglevel;
- console_loglevel = new_loglevel;
-
-#ifdef SUSPEND_CONSOLE
acquire_console_sem();

orig_fgconsole = fg_console;
@@ -41,18 +34,15 @@ int pm_prepare_console(void)
}
orig_kmsg = kmsg_redirect;
kmsg_redirect = SUSPEND_CONSOLE;
-#endif
return 0;
}

void pm_restore_console(void)
{
- console_loglevel = orig_loglevel;
-#ifdef SUSPEND_CONSOLE
acquire_console_sem();
set_console(orig_fgconsole);
release_console_sem();
kmsg_redirect = orig_kmsg;
-#endif
return;
}
+#endif
Index: linux-2.6.16-rc1-mm4/kernel/power/power.h
===================================================================
--- linux-2.6.16-rc1-mm4.orig/kernel/power/power.h 2006-01-30 21:19:43.000000000 +0100
+++ linux-2.6.16-rc1-mm4/kernel/power/power.h 2006-01-30 21:33:19.000000000 +0100
@@ -43,8 +43,13 @@ static struct subsys_attribute _name##_a

extern struct subsystem power_subsys;

+#ifdef SUSPEND_CONSOLE
extern int pm_prepare_console(void);
extern void pm_restore_console(void);
+#else
+static int pm_prepare_console(void) { return 0; }
+static void pm_restore_console(void) {}
+#endif

/* References to section boundaries */
extern const void __nosave_begin, __nosave_end;