* [PATCH] vt_ioctl.c: fix compile error with pm_set_vt_switch()
@ 2011-09-02 21:02 H Hartley Sweeten
2011-09-03 10:46 ` Alan Cox
0 siblings, 1 reply; 6+ messages in thread
From: H Hartley Sweeten @ 2011-09-02 21:02 UTC (permalink / raw)
To: Linux Kernel; +Cc: gregkh, akpm, art, arnd, jslaby
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.
Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Arthur Taylor <art@ified.ca>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Jiri Slaby <jslaby@suse.cz>
---
diff --git a/drivers/tty/vt/vt_ioctl.c b/drivers/tty/vt/vt_ioctl.c
index 5e096f4..7bb1b4d 100644
--- a/drivers/tty/vt/vt_ioctl.c
+++ b/drivers/tty/vt/vt_ioctl.c
@@ -1784,6 +1784,8 @@ int vt_move_to_console(unsigned int vt, int alloc)
return prev;
}
+#if defined(CONFIG_PM_SLEEP) && defined(CONFIG_VT_CONSOLE)
+
/*
* Normally during a suspend, we allocate a new console and switch to it.
* When we resume, we switch back to the original console. This switch
@@ -1798,3 +1800,5 @@ void pm_set_vt_switch(int do_switch)
console_unlock();
}
EXPORT_SYMBOL(pm_set_vt_switch);
+
+#endif
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] vt_ioctl.c: fix compile error with pm_set_vt_switch()
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
0 siblings, 1 reply; 6+ messages in thread
From: Alan Cox @ 2011-09-03 10:46 UTC (permalink / raw)
To: H Hartley Sweeten; +Cc: Linux Kernel, gregkh, akpm, art, arnd, jslaby
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.
Alan
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] vt_ioctl.c: fix compile error with pm_set_vt_switch()
2011-09-03 10:46 ` Alan Cox
@ 2011-09-05 14:54 ` Arnd Bergmann
2011-09-06 18:26 ` H Hartley Sweeten
0 siblings, 1 reply; 6+ messages in thread
From: Arnd Bergmann @ 2011-09-05 14:54 UTC (permalink / raw)
To: Alan Cox; +Cc: H Hartley Sweeten, Linux Kernel, gregkh, akpm, art, jslaby
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;
^ permalink raw reply related [flat|nested] 6+ messages in thread
* RE: [PATCH] vt_ioctl.c: fix compile error with pm_set_vt_switch()
2011-09-05 14:54 ` Arnd Bergmann
@ 2011-09-06 18:26 ` H Hartley Sweeten
2011-09-06 19:29 ` Arnd Bergmann
0 siblings, 1 reply; 6+ messages in thread
From: H Hartley Sweeten @ 2011-09-06 18:26 UTC (permalink / raw)
To: Arnd Bergmann, Alan Cox; +Cc: Linux Kernel, gregkh, akpm, art, jslaby
On Monday, September 05, 2011 7:54 AM, Arnd Bergmann wrote:
> 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,
Your patch below does appear to fix the problem.
Tested-by: H Hartley Sweeten <hsweeten@visionengravers.com>
There is still a bit of #if ugliness with the pm_{prepare,restore}_console.
The source file kernel/power/console.c is compiled when CONFIG_PM_SLEEP is
enabled. But that file ends up empty if CONFIG_VT and CONFIG_VT_CONSOLE are
not defined.
I wonder if it would be cleaner to make a new entry in kernel/power/Kconfig:
config PM_SLEEP_CONSOLE
def_bool y
depends on PM_SLEEP && VT && VT_CONSOLE
Then use that config option in the Makefile and in suspend.h.
Regards,
Hartley
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;
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] vt_ioctl.c: fix compile error with pm_set_vt_switch()
2011-09-06 18:26 ` H Hartley Sweeten
@ 2011-09-06 19:29 ` Arnd Bergmann
2011-09-06 20:23 ` H Hartley Sweeten
0 siblings, 1 reply; 6+ messages in thread
From: Arnd Bergmann @ 2011-09-06 19:29 UTC (permalink / raw)
To: H Hartley Sweeten; +Cc: Alan Cox, Linux Kernel, gregkh, akpm, art, jslaby
On Tuesday 06 September 2011 13:26:12 H Hartley Sweeten wrote:
> Your patch below does appear to fix the problem.
>
> Tested-by: H Hartley Sweeten <hsweeten@visionengravers.com>
>
>
> There is still a bit of #if ugliness with the pm_{prepare,restore}_console.
>
> The source file kernel/power/console.c is compiled when CONFIG_PM_SLEEP is
> enabled. But that file ends up empty if CONFIG_VT and CONFIG_VT_CONSOLE are
> not defined.
>
> I wonder if it would be cleaner to make a new entry in kernel/power/Kconfig:
>
> config PM_SLEEP_CONSOLE
> def_bool y
> depends on PM_SLEEP && VT && VT_CONSOLE
>
> Then use that config option in the Makefile and in suspend.h.
Yes, that would be cleaner. I would probably move it to drivers/tty/vt
in the same step and name the option VT_CONSOLE_SLEEP.
Do you want to send a patch?
Thanks for testing!
Arnd
^ permalink raw reply [flat|nested] 6+ messages in thread
* RE: [PATCH] vt_ioctl.c: fix compile error with pm_set_vt_switch()
2011-09-06 19:29 ` Arnd Bergmann
@ 2011-09-06 20:23 ` H Hartley Sweeten
0 siblings, 0 replies; 6+ messages in thread
From: H Hartley Sweeten @ 2011-09-06 20:23 UTC (permalink / raw)
To: Arnd Bergmann; +Cc: Alan Cox, Linux Kernel, gregkh, akpm, art, jslaby
On Tuesday, September 06, 2011 12:29 PM, Arnd Bergmann wrote:
> On Tuesday 06 September 2011 13:26:12 H Hartley Sweeten wrote:
>> Your patch below does appear to fix the problem.
>>
>> Tested-by: H Hartley Sweeten <hsweeten@visionengravers.com>
>>
>>
>> There is still a bit of #if ugliness with the pm_{prepare,restore}_console.
>>
>> The source file kernel/power/console.c is compiled when CONFIG_PM_SLEEP is
>> enabled. But that file ends up empty if CONFIG_VT and CONFIG_VT_CONSOLE are
>> not defined.
>>
>> I wonder if it would be cleaner to make a new entry in kernel/power/Kconfig:
>>
>> config PM_SLEEP_CONSOLE
>> def_bool y
>> depends on PM_SLEEP && VT && VT_CONSOLE
>>
>> Then use that config option in the Makefile and in suspend.h.
>
> Yes, that would be cleaner. I would probably move it to drivers/tty/vt
> in the same step and name the option VT_CONSOLE_SLEEP.
Ok.
> Do you want to send a patch?
Will do in just a minute.
> Thanks for testing!
Not a problem!
Regards,
Hartley
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-09-06 20:25 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2011-09-06 18:26 ` H Hartley Sweeten
2011-09-06 19:29 ` Arnd Bergmann
2011-09-06 20:23 ` H Hartley Sweeten
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.