Re: [PATCH] PM / runtime: Add support for wake-up reason for wakeirqs

From: Alan Stern
Date: Wed Oct 09 2019 - 14:51:23 EST


On Wed, 9 Oct 2019, Tony Lindgren wrote:

> With generic wakeirqs we can wake a device, but do not know if the
> device woke to a wakeirq. Let's add pm_runtime_wakeup_is_wakeirq() so
> a device can check the wake-up reason.

People have tried many times over the years to do something like this.
It's never right.

The problem is simple: It's impossible to know for certain why the
system woke up from suspend. In fact, there may be many wakeup sources
all active at the same time, and any of them could be the one
responsible for actually waking the system.

All you can do is check to see whether a particular wakeup source is
active at the present moment. You can't tell whether it was active in
the past (while the system was suspended) or whether it caused the
system to resume.

Alan Stern