Skip to content

Commit 37cce26

Browse files
H Hartley Sweetenrjwysocki
authored andcommitted
PM / VT: Cleanup #if defined uglyness and fix compile error
Introduce the config option CONFIG_VT_CONSOLE_SLEEP in order to cleanup the #if defined ugliness for the vt suspend support functions. Note that CONFIG_VT_CONSOLE is already dependant on CONFIG_VT. The function pm_set_vt_switch is actually dependant on CONFIG_VT and not CONFIG_PM_SLEEP. This fixes a compile error when CONFIG_PM_SLEEP is not set: drivers/tty/vt/vt_ioctl.c:1794: error: redefinition of 'pm_set_vt_switch' include/linux/suspend.h:17: error: previous definition of 'pm_set_vt_switch' was here Also, remove the incorrect path from the comment in console.c. [rjw: Replaced #if defined() with #ifdef in suspend.h.] Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com> Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
1 parent 528f7ce commit 37cce26

4 files changed

Lines changed: 12 additions & 7 deletions

File tree

‎drivers/tty/Kconfig‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ config VT_CONSOLE
6060

6161
If unsure, say Y.
6262

63+
config VT_CONSOLE_SLEEP
64+
def_bool y
65+
depends on VT_CONSOLE && PM_SLEEP
66+
6367
config HW_CONSOLE
6468
bool
6569
depends on VT && !S390 && !UML

‎include/linux/suspend.h‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,18 @@
88
#include <linux/mm.h>
99
#include <asm/errno.h>
1010

11-
#if defined(CONFIG_PM_SLEEP) && defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE)
11+
#ifdef CONFIG_VT
1212
extern void pm_set_vt_switch(int);
13-
extern int pm_prepare_console(void);
14-
extern void pm_restore_console(void);
1513
#else
1614
static inline void pm_set_vt_switch(int do_switch)
1715
{
1816
}
17+
#endif
1918

19+
#ifdef CONFIG_VT_CONSOLE_SLEEP
20+
extern int pm_prepare_console(void);
21+
extern void pm_restore_console(void);
22+
#else
2023
static inline int pm_prepare_console(void)
2124
{
2225
return 0;

‎kernel/power/Makefile‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
ccflags-$(CONFIG_PM_DEBUG) := -DDEBUG
33

44
obj-$(CONFIG_PM) += main.o qos.o
5-
obj-$(CONFIG_PM_SLEEP) += console.o
5+
obj-$(CONFIG_VT_CONSOLE_SLEEP) += console.o
66
obj-$(CONFIG_FREEZER) += process.o
77
obj-$(CONFIG_SUSPEND) += suspend.o
88
obj-$(CONFIG_PM_TEST_SUSPEND) += suspend_test.o

‎kernel/power/console.c‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* drivers/power/process.c - Functions for saving/restoring console.
2+
* Functions for saving/restoring console.
33
*
44
* Originally from swsusp.
55
*/
@@ -10,7 +10,6 @@
1010
#include <linux/module.h>
1111
#include "power.h"
1212

13-
#if defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE)
1413
#define SUSPEND_CONSOLE (MAX_NR_CONSOLES-1)
1514

1615
static int orig_fgconsole, orig_kmsg;
@@ -32,4 +31,3 @@ void pm_restore_console(void)
3231
vt_kmsg_redirect(orig_kmsg);
3332
}
3433
}
35-
#endif

0 commit comments

Comments
 (0)