PM: Make it possible to avoid races between wakeup and system sleep