During system suspend pm_genpd_suspend_noirq() checks if the givendevice is in a wakeup path (i.e. it appears to be needed for one ormore wakeup devices to work or is a wakeup device itself) and if itneeds to be "active" for wakeup to work. If that is the case, thefunction returns 0 without incrementing the device domain's counterof suspended devices and without executing genpd_stop_dev() for thedevice. In consequence, the device is not stopped (e.g. its clockisn't disabled) and power is always supplied to its domain in theresulting system sleep state.

However, pm_genpd_resume_noirq() doesn't repeat that check and itruns genpd_start_dev() and decrements the domain's counter ofsuspended devices even for the wakeup device that weren't stopped bypm_genpd_suspend_noirq(). As a result, the start callback may be rununnecessarily for them and their domains' counters of suspendeddevices may become negative. Both outcomes aren't desirable, so fixpm_genpd_resume_noirq() to look for wakeup devices that might not bestopped by during system suspend.