vt/suspend: cleanup #if defined uglyness and fix compile error
Subsystems (3)
PATCH 1/1 vt/suspend: 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.
---
This is a revised version of the patch "vt_ioctl.c: fix compile error with pm_set_vt_switch()" that I sent last week. Alan Cox asked if the #if uglies could be moved into the header to keep the code clean. Arnd Bergmann then submitted a revised patch that did this. This now includes Arnd's fix and along with the addition of CONFIG_VT_CONSOLE_SLEEP.
drivers/tty/Kconfig +4 -0
@@ -60,6 +60,10 @@ config VT_CONSOLE If unsure, say Y. +config VT_CONSOLE_SLEEP + def_bool y + depends on VT_CONSOLE && PM_SLEEP + config HW_CONSOLE bool depends on VT && !S390 && !UML
include/linux/suspend.h +6 -3
@@ -8,15 +8,18 @@#include <linux/mm.h> #include <asm/errno.h> -#if defined(CONFIG_PM_SLEEP ) && defined(CONFIG_VT ) && defined(CONFIG_VT_CONSOLE ) +#if defined(CONFIG_VT )extern void pm_set_vt_switch (int ); -extern int pm_prepare_console (void ); -extern void pm_restore_console (void );#else static inline void pm_set_vt_switch (int do_switch) { } +#endif +#if defined(CONFIG_VT_CONSOLE_SLEEP ) +extern int pm_prepare_console (void ); +extern void pm_restore_console (void ); +#else static inline int pm_prepare_console (void ) {return 0 ;
kernel/power/Makefile +1 -1
@@ -2,7 +2,7 @@ ccflags-$(CONFIG_PM_DEBUG) := -DDEBUG obj-$(CONFIG_PM) += main.o qos.o -obj-$(CONFIG_PM_SLEEP) += console.o +obj-$(CONFIG_VT_CONSOLE_SLEEP) += console.o obj-$(CONFIG_FREEZER) += process.o obj-$(CONFIG_SUSPEND) += suspend.o obj-$(CONFIG_PM_TEST_SUSPEND) += suspend_test.o
kernel/power/console.c +1 -3
@@ -1,5 +1,5 @@/* -* drivers/power/process.c - Functions for saving/restoring console. +* Functions for saving/restoring console. * * Originally from swsusp. */
@@ -10,7 +10,6 @@#include <linux/module.h> #include "power.h" -#if defined(CONFIG_VT ) && defined(CONFIG_VT_CONSOLE )#define SUSPEND_CONSOLE (MAX_NR_CONSOLES-1)static int orig_fgconsole, orig_kmsg;
@@ -32,4 +31,3 @@ void pm_restore_console(void)vt_kmsg_redirect (orig_kmsg); } } -#endif
Quoted 13 lines · H Hartley Sweeten
rder to cleanup
the #if defined ugliness for the vt suspend support functions. Note thatCONFIG_VT_CONSOLEis already dependant onCONFIG_VT.The function
pm_set_vt_switchis actually dependant onCONFIG_VTand notCONFIG_PM_SLEEP. This fixes a compile error whenCONFIG_PM_SLEEPis 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 hereAlso, remove the incorrect path from the comment in
console.c.
Quoted 9 lines
Signed-off-by H Hartley Sweeten <[email protected]>Cc Arnd Bergmann <[email protected]>Cc Andrew Morton <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Cc Pavel Machek <[email protected]>Cc "Rafael J. Wysocki" <[email protected]>Cc Len Brown <[email protected]>Cc Arthur Taylor <[email protected]>Cc Jiri Slaby <[email protected]>
Quoted 13 lines · H Hartley Sweeten
rder to cleanup
the #if defined ugliness for the vt suspend support functions. Note thatCONFIG_VT_CONSOLEis already dependant onCONFIG_VT.The function
pm_set_vt_switchis actually dependant onCONFIG_VTand notCONFIG_PM_SLEEP. This fixes a compile error whenCONFIG_PM_SLEEPis 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 hereAlso, remove the incorrect path from the comment in
console.c.
Quoted 9 lines
Signed-off-by H Hartley Sweeten <[email protected]>Cc Arnd Bergmann <[email protected]>Cc Andrew Morton <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Cc Pavel Machek <[email protected]>Cc "Rafael J. Wysocki" <[email protected]>Cc Len Brown <[email protected]>Cc Arthur Taylor <[email protected]>Cc Jiri Slaby <[email protected]>
Rafael J. Wysocki
AppliedQuoted 24 lines · Arnd Bergmann
Quoted 13 lines · H Hartley Sweeten
rder to cleanup
the #if defined ugliness for the vt suspend support functions. Note thatCONFIG_VT_CONSOLEis already dependant onCONFIG_VT.The function
pm_set_vt_switchis actually dependant onCONFIG_VTand notCONFIG_PM_SLEEP. This fixes a compile error whenCONFIG_PM_SLEEPis 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 hereAlso, remove the incorrect path from the comment in
console.c.Quoted 9 lines
Signed-off-by H Hartley Sweeten <[email protected]>Cc Arnd Bergmann <[email protected]>Cc Andrew Morton <[email protected]>Cc Greg Kroah-Hartman <[email protected]>Cc Pavel Machek <[email protected]>Cc "Rafael J. Wysocki" <[email protected]>Cc Len Brown <[email protected]>Cc Arthur Taylor <[email protected]>Cc Jiri Slaby <[email protected]>
Quoted 1 line
Acked-by Arnd Bergmann <[email protected]>
Applied to linux-pm/linux-next, will be pushed for 3.2.
Thanks (and sorry for the delay),
Rafael