diff mbox

acpi: fix pwr_btn_event_pending build error

Message ID 20120721214156.GA2515@linux.vnet.ibm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Paul E. McKenney July 21, 2012, 9:41 p.m. UTC
Hello!

A recent build for KVM on x86 resulted in the following build error:

drivers/acpi/sleep.c:60:13: warning: ‘pwr_btn_event_pending’ defined but not
+used [-Wunused-variable]

This patch silences this error.

Signed-off-by: Paul E. McKenney <paul.mckenney@linaro.org>


--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Kirill A. Shutemov July 21, 2012, 9:52 p.m. UTC | #1
On Sat, Jul 21, 2012 at 02:41:56PM -0700, Paul E. McKenney wrote:
> Hello!
> 
> A recent build for KVM on x86 resulted in the following build error:
> 
> drivers/acpi/sleep.c:60:13: warning: ‘pwr_btn_event_pending’ defined but not
> +used [-Wunused-variable]
> 
> This patch silences this error.
> 
> Signed-off-by: Paul E. McKenney <paul.mckenney@linaro.org>
> 
> diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
> index 8856102..18347aa 100644
> --- a/drivers/acpi/sleep.c
> +++ b/drivers/acpi/sleep.c
> @@ -57,7 +57,9 @@ MODULE_PARM_DESC(gts, "Enable evaluation of _GTS on suspend.");
>  MODULE_PARM_DESC(bfs, "Enable evaluation of _BFS on resume".);
>  
>  static u8 sleep_states[ACPI_S_STATE_COUNT];
> +#ifdef CONFIG_ACPI_SLEEP
>  static bool pwr_btn_event_pending;
> +#endif /* #ifdef CONFIG_ACPI_SLEEP */

__maybe_unused ?
Paul E. McKenney July 21, 2012, 11:37 p.m. UTC | #2
On Sun, Jul 22, 2012 at 12:52:43AM +0300, Kirill A. Shutemov wrote:
> On Sat, Jul 21, 2012 at 02:41:56PM -0700, Paul E. McKenney wrote:
> > Hello!
> > 
> > A recent build for KVM on x86 resulted in the following build error:
> > 
> > drivers/acpi/sleep.c:60:13: warning: ‘pwr_btn_event_pending’ defined but not
> > +used [-Wunused-variable]
> > 
> > This patch silences this error.
> > 
> > Signed-off-by: Paul E. McKenney <paul.mckenney@linaro.org>
> > 
> > diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
> > index 8856102..18347aa 100644
> > --- a/drivers/acpi/sleep.c
> > +++ b/drivers/acpi/sleep.c
> > @@ -57,7 +57,9 @@ MODULE_PARM_DESC(gts, "Enable evaluation of _GTS on suspend.");
> >  MODULE_PARM_DESC(bfs, "Enable evaluation of _BFS on resume".);
> >  
> >  static u8 sleep_states[ACPI_S_STATE_COUNT];
> > +#ifdef CONFIG_ACPI_SLEEP
> >  static bool pwr_btn_event_pending;
> > +#endif /* #ifdef CONFIG_ACPI_SLEEP */
> 
> __maybe_unused ?

Are the compiler and linker smart enough to get rid of the storage in
case it really isn't used?  (Not that the storage for a bool is worth
worrying about, but...)

							Thanx, Paul

--
To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Kirill A. Shutemov July 22, 2012, 12:08 a.m. UTC | #3
On Sat, Jul 21, 2012 at 04:37:14PM -0700, Paul E. McKenney wrote:
> On Sun, Jul 22, 2012 at 12:52:43AM +0300, Kirill A. Shutemov wrote:
> > On Sat, Jul 21, 2012 at 02:41:56PM -0700, Paul E. McKenney wrote:
> > > Hello!
> > > 
> > > A recent build for KVM on x86 resulted in the following build error:
> > > 
> > > drivers/acpi/sleep.c:60:13: warning: ‘pwr_btn_event_pending’ defined but not
> > > +used [-Wunused-variable]
> > > 
> > > This patch silences this error.
> > > 
> > > Signed-off-by: Paul E. McKenney <paul.mckenney@linaro.org>
> > > 
> > > diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
> > > index 8856102..18347aa 100644
> > > --- a/drivers/acpi/sleep.c
> > > +++ b/drivers/acpi/sleep.c
> > > @@ -57,7 +57,9 @@ MODULE_PARM_DESC(gts, "Enable evaluation of _GTS on suspend.");
> > >  MODULE_PARM_DESC(bfs, "Enable evaluation of _BFS on resume".);
> > >  
> > >  static u8 sleep_states[ACPI_S_STATE_COUNT];
> > > +#ifdef CONFIG_ACPI_SLEEP
> > >  static bool pwr_btn_event_pending;
> > > +#endif /* #ifdef CONFIG_ACPI_SLEEP */
> > 
> > __maybe_unused ?
> 
> Are the compiler and linker smart enough to get rid of the storage in
> case it really isn't used?  (Not that the storage for a bool is worth
> worrying about, but...)

GCC with optimization enabled will get rid of the storage even without
__maybe_unused.
diff mbox

Patch

diff --git a/drivers/acpi/sleep.c b/drivers/acpi/sleep.c
index 8856102..18347aa 100644
--- a/drivers/acpi/sleep.c
+++ b/drivers/acpi/sleep.c
@@ -57,7 +57,9 @@  MODULE_PARM_DESC(gts, "Enable evaluation of _GTS on suspend.");
 MODULE_PARM_DESC(bfs, "Enable evaluation of _BFS on resume".);
 
 static u8 sleep_states[ACPI_S_STATE_COUNT];
+#ifdef CONFIG_ACPI_SLEEP
 static bool pwr_btn_event_pending;
+#endif /* #ifdef CONFIG_ACPI_SLEEP */
 
 static void acpi_sleep_tts_switch(u32 acpi_state)
 {