Skip to content

Commit

Permalink
powersuspend: add power_suspended boolean for global access
Browse files Browse the repository at this point in the history
Some routines just need the boolean for whether powersuspend is active or not.

Rather than hooking to the powersuspend on every occasions,
add power_suspended boolean for global access.

Signed-off-by: arter97 <qkrwngud825@gmail.com>
  • Loading branch information
arter97 authored and javilonas committed Jun 13, 2015
1 parent df2e4b7 commit d1b302a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/linux/powersuspend.h
Expand Up @@ -47,5 +47,7 @@ void unregister_power_suspend(struct power_suspend *handler);

void set_power_suspend_state_panel_hook(int new_state);

extern bool power_suspended;

#endif

4 changes: 4 additions & 0 deletions kernel/power/powersuspend.c
Expand Up @@ -140,6 +140,8 @@ static void power_resume(struct work_struct *work)
mutex_unlock(&power_suspend_lock);
}

bool power_suspended = false;

void set_power_suspend_state(int new_state)
{
unsigned long irqflags;
Expand All @@ -151,12 +153,14 @@ void set_power_suspend_state(int new_state)
pr_info("[POWERSUSPEND] state activated.\n");
#endif
state = new_state;
power_suspended = true;
queue_work(suspend_work_queue, &power_suspend_work);
} else if (state == POWER_SUSPEND_ACTIVE && new_state == POWER_SUSPEND_INACTIVE) {
#ifdef CONFIG_POWERSUSPEND_DEBUG
pr_info("[POWERSUSPEND] state deactivated.\n");
#endif
state = new_state;
power_suspended = false;
queue_work(suspend_work_queue, &power_resume_work);
}
spin_unlock_irqrestore(&state_lock, irqflags);
Expand Down

0 comments on commit d1b302a

Please sign in to comment.