From patchwork Tue Sep 6 21:04:04 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hartley Sweeten X-Patchwork-Id: 1127022 Received: from smtp1.linux-foundation.org (smtp1.linux-foundation.org [140.211.169.13]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p86LLDik023194 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Tue, 6 Sep 2011 21:21:34 GMT Received: from daredevil.linux-foundation.org (localhost [127.0.0.1]) by smtp1.linux-foundation.org (8.14.2/8.13.5/Debian-3ubuntu1.1) with ESMTP id p86LIPUB013183; Tue, 6 Sep 2011 14:18:25 -0700 Received: from mail127.messagelabs.com (mail127.messagelabs.com [216.82.250.115]) by smtp1.linux-foundation.org (8.14.2/8.13.5/Debian-3ubuntu1.1) with ESMTP id p86L5JIi006914 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL) for ; Tue, 6 Sep 2011 14:05:21 -0700 X-Env-Sender: hartleys@visionengravers.com X-Msg-Ref: server-2.tower-127.messagelabs.com!1315342899!30695338!299 X-Originating-IP: [216.166.12.32] X-StarScan-Version: 6.3.6; banners=-,-,- X-VirusChecked: Checked Received: (qmail 24281 invoked from network); 6 Sep 2011 21:05:19 -0000 Received: from out001.collaborationhost.net (HELO out001.collaborationhost.net) (216.166.12.32) by server-2.tower-127.messagelabs.com with RC4-SHA encrypted SMTP; 6 Sep 2011 21:05:19 -0000 Received: from etch.local (10.2.3.210) by smtp.collaborationhost.net (10.2.0.47) with Microsoft SMTP Server (TLS) id 8.3.137.0; Tue, 6 Sep 2011 16:04:42 -0500 From: H Hartley Sweeten To: Linux Kernel Date: Tue, 6 Sep 2011 14:04:04 -0700 User-Agent: KMail/1.9.9 MIME-Version: 1.0 Content-Disposition: inline Message-ID: <201109061404.10301.hartleys@visionengravers.com> Received-SPF: pass (localhost is always allowed.) X-Spam-Status: No, hits=-6.178 required=5 tests=AWL, BAYES_00, OSDL_HEADER_SUBJECT_BRACKETED, PATCH_SUBJECT_OSDL X-Spam-Checker-Version: SpamAssassin 3.2.4-osdl_revision__1.47__ X-MIMEDefang-Filter: lf-20110901g X-Scanned-By: MIMEDefang 2.63 on 140.211.169.21 X-Scanned-By: MIMEDefang 2.63 on 140.211.169.51 X-Mailman-Approved-At: Tue, 06 Sep 2011 14:18:24 -0700 Cc: len.brown@intel.com, art@ified.ca, arnd@arndb.de, gregkh@suse.de, linux-pm@lists.linux-foundation.org, jslaby@suse.cz, akpm@linux-foundation.org Subject: [linux-pm] [PATCH] vt/suspend: cleanup #if defined uglyness and fix compile error X-BeenThere: linux-pm@lists.linux-foundation.org X-Mailman-Version: 2.1.9 Precedence: list List-Id: Linux power management List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-pm-bounces@lists.linux-foundation.org Errors-To: linux-pm-bounces@lists.linux-foundation.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Tue, 06 Sep 2011 21:21:34 +0000 (UTC) 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. Signed-off-by: H Hartley Sweeten Cc: Arnd Bergmann Cc: Andrew Morton Cc: Greg Kroah-Hartman Cc: Pavel Machek Cc: "Rafael J. Wysocki" Cc: Len Brown Cc: Arthur Taylor Cc: Jiri Slaby Acked-by: Arnd Bergmann --- 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. diff --git a/drivers/tty/Kconfig b/drivers/tty/Kconfig index f1ea59b..565fe0f 100644 --- a/drivers/tty/Kconfig +++ b/drivers/tty/Kconfig @@ -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 diff --git a/include/linux/suspend.h b/include/linux/suspend.h index 46f3548..c3da030 100644 --- a/include/linux/suspend.h +++ b/include/linux/suspend.h @@ -8,15 +8,18 @@ #include #include -#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; diff --git a/kernel/power/Makefile b/kernel/power/Makefile index ad6bdd8..07e0e28 100644 --- a/kernel/power/Makefile +++ b/kernel/power/Makefile @@ -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 diff --git a/kernel/power/console.c b/kernel/power/console.c index 218e5af..b1dc456 100644 --- a/kernel/power/console.c +++ b/kernel/power/console.c @@ -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 #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