public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: H Hartley Sweeten <hartleys@visionengravers.com>,
	Linux Kernel <linux-kernel@vger.kernel.org>,
	gregkh@suse.de, akpm@linux-foundation.org, art@ified.ca,
	jslaby@suse.cz
Subject: Re: [PATCH] vt_ioctl.c: fix compile error with pm_set_vt_switch()
Date: Mon, 5 Sep 2011 16:54:28 +0200	[thread overview]
Message-ID: <201109051654.28682.arnd@arndb.de> (raw)
In-Reply-To: <20110903114641.53170fef@lxorguk.ukuu.org.uk>

On Saturday 03 September 2011, Alan Cox wrote:
> On Fri, 2 Sep 2011 14:02:42 -0700
> H Hartley Sweeten <hartleys@visionengravers.com> wrote:
> 
> > When CONFIG_PM_SLEEP, CONFIG_VT, and CONFIG_VT_CONSOLE are not enabled
> > the function pm_set_vt_switch() is defined as an inline in linux/suspend.h. This causes
> > a compile error if CONFIG_VT is enabled.
> > 
> > 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
> > 
> > Fix this with an #if defined guard around the function in vt_ioctl.c.
> 
> Can you put the #if uglies into the buggy suspend.h header instead so the
> code proper is kept clean of ifdefs.

I had discovered the same problem earlier but did not get to submit a
fix yet. I think the patch below should do it. Hartley, can you confirm that?

	Arnd
---
vt/suspend: pm_set_vt_switch does not depend on CONFIG_PM_SLEEP

This avoid having multiple conflicting definitions of pm_set_vt_switch
when CONFIG_VT is set but CONFIG_PM_SLEEP or CONFIG_VT_CONSOLE are not.

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

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
diff --git a/include/linux/suspend.h b/include/linux/suspend.h
index 6bbcef2..69f3b39 100644
--- a/include/linux/suspend.h
+++ b/include/linux/suspend.h
@@ -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_PM_SLEEP) && defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE)
+extern int pm_prepare_console(void);
+extern void pm_restore_console(void);
+#else
 static inline int pm_prepare_console(void)
 {
 	return 0;

  reply	other threads:[~2011-09-05 14:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-02 21:02 [PATCH] vt_ioctl.c: fix compile error with pm_set_vt_switch() H Hartley Sweeten
2011-09-03 10:46 ` Alan Cox
2011-09-05 14:54   ` Arnd Bergmann [this message]
2011-09-06 18:26     ` H Hartley Sweeten
2011-09-06 19:29       ` Arnd Bergmann
2011-09-06 20:23         ` H Hartley Sweeten

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=201109051654.28682.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=art@ified.ca \
    --cc=gregkh@suse.de \
    --cc=hartleys@visionengravers.com \
    --cc=jslaby@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    /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