power: Add function to show active wakelocks
tlmm: Add a function to dump the active wakelocks Change-Id: I05f4d477ff9e096efe8e0fcdb3a8d5d76c7028ac Signed-off-by: haojl2 <haojl2@motorola.com> Reviewed-on: https://gerrit.mot.com/1453711 SLTApproved: Slta Waiver SME-Granted: SME Approvals Granted Tested-by: Jira Key Reviewed-by: Jianqi Yang <yangj@motorola.com> Submit-Approved: Jira Key Reviewed-on: https://gerrit.mot.com/1509728 Reviewed-by: Wang Wang <wangwang1@lenovo.com>
This commit is contained in:
1 parent
f62b4fa286
commit
19d39dcea7
2 files changed
+28
No files matched your search
@@ -1158,6 +1158,33 @@ static const struct seq_operations wakeup_sources_stats_seq_ops = {
|
|||||||
.show = wakeup_sources_stats_seq_show,
|
.show = wakeup_sources_stats_seq_show,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
int wakelock_dump_active_info(char *buf, int size)
|
||||||
|
{
|
||||||
|
struct wakeup_source *ws;
|
||||||
|
unsigned long flags;
|
||||||
|
char *p = buf;
|
||||||
|
|
||||||
|
rcu_read_lock();
|
||||||
|
list_for_each_entry_rcu(ws, &wakeup_sources, entry) {
|
||||||
|
spin_lock_irqsave(&ws->lock, flags);
|
||||||
|
if (ws->active) {
|
||||||
|
if (time_after(ws->timer_expires, jiffies)) {
|
||||||
|
long timeout = ws->timer_expires - jiffies;
|
||||||
|
|
||||||
|
p += snprintf(p, size - (p - buf),
|
||||||
|
" (active)[%s], time left %d (msecs)\n",
|
||||||
|
ws->name, jiffies_to_msecs(timeout));
|
||||||
|
} else /* active */
|
||||||
|
p += snprintf(p, size - (p - buf),
|
||||||
|
" (active)[%s]\n", ws->name);
|
||||||
|
}
|
||||||
|
spin_unlock_irqrestore(&ws->lock, flags);
|
||||||
|
}
|
||||||
|
rcu_read_unlock();
|
||||||
|
|
||||||
|
return p - buf;
|
||||||
|
}
|
||||||
|
|
||||||
static int wakeup_sources_stats_open(struct inode *inode, struct file *file)
|
static int wakeup_sources_stats_open(struct inode *inode, struct file *file)
|
||||||
{
|
{
|
||||||
return seq_open_private(file, &wakeup_sources_stats_seq_ops, sizeof(int));
|
return seq_open_private(file, &wakeup_sources_stats_seq_ops, sizeof(int));
|
||||||
|
|||||||
@@ -118,6 +118,7 @@ extern void __pm_relax(struct wakeup_source *ws);
|
|||||||
extern void pm_relax(struct device *dev);
|
extern void pm_relax(struct device *dev);
|
||||||
extern void pm_wakeup_ws_event(struct wakeup_source *ws, unsigned int msec, bool hard);
|
extern void pm_wakeup_ws_event(struct wakeup_source *ws, unsigned int msec, bool hard);
|
||||||
extern void pm_wakeup_dev_event(struct device *dev, unsigned int msec, bool hard);
|
extern void pm_wakeup_dev_event(struct device *dev, unsigned int msec, bool hard);
|
||||||
|
extern int wakelock_dump_active_info(char *buf, int size);
|
||||||
|
|
||||||
#else /* !CONFIG_PM_SLEEP */
|
#else /* !CONFIG_PM_SLEEP */
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user