diff mbox

power: collie_battery: hide unused variable

Message ID 1453736756-1959377-2-git-send-email-arnd@arndb.de (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Arnd Bergmann Jan. 25, 2016, 3:45 p.m. UTC
The 'wakeup_enabled' variable in this driver is only accessed
by the optional power management functions and we get a warning
when they are disabled:

drivers/power/collie_battery.c:29:12: error: 'wakeup_enabled' defined but not used [-Werror=unused-variable]

This moves the definition next to the users inside the same #ifdef,
which avoids the warning.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/power/collie_battery.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Pavel Machek Jan. 30, 2016, 4:16 p.m. UTC | #1
On Mon 2016-01-25 16:45:49, Arnd Bergmann wrote:
> The 'wakeup_enabled' variable in this driver is only accessed
> by the optional power management functions and we get a warning
> when they are disabled:
> 
> drivers/power/collie_battery.c:29:12: error: 'wakeup_enabled' defined but not used [-Werror=unused-variable]
> 
> This moves the definition next to the users inside the same #ifdef,
> which avoids the warning.
> 
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

Acked-by: Pavel Machek <pavel@ucw.cz>
Sebastian Reichel Feb. 15, 2016, 5:03 a.m. UTC | #2
Hi,

On Mon, Jan 25, 2016 at 04:45:49PM +0100, Arnd Bergmann wrote:
> The 'wakeup_enabled' variable in this driver is only accessed
> by the optional power management functions and we get a warning
> when they are disabled:
> 
> drivers/power/collie_battery.c:29:12: error: 'wakeup_enabled' defined but not used [-Werror=unused-variable]
> 
> This moves the definition next to the users inside the same #ifdef,
> which avoids the warning.

Thanks, queued.

-- Sebastian
diff mbox

Patch

diff --git a/drivers/power/collie_battery.c b/drivers/power/collie_battery.c
index 8a971b3dbe58..3a0bc608d4b5 100644
--- a/drivers/power/collie_battery.c
+++ b/drivers/power/collie_battery.c
@@ -26,7 +26,6 @@ 
 static DEFINE_MUTEX(bat_lock); /* protects gpio pins */
 static struct work_struct bat_work;
 static struct ucb1x00 *ucb;
-static int wakeup_enabled;
 
 struct collie_bat {
 	int status;
@@ -291,6 +290,8 @@  static struct gpio collie_batt_gpios[] = {
 };
 
 #ifdef CONFIG_PM
+static int wakeup_enabled;
+
 static int collie_bat_suspend(struct ucb1x00_dev *dev)
 {
 	/* flush all pending status updates */