devfreq: Fix PM callbacks to support zero frequency

It is perfectly valid for a device to have a zero frequency, usually
it denotes a power collapse. To support this, fix the PM suspend
callback to allow the suspend_freq to be zero.

Change-Id: Id10f95b59b219e82e0695f80361aa6b35cdc5137
Signed-off-by: Shreyas K K <shrekk@codeaurora.org>
This commit is contained in:
Shreyas K K 2021-11-11 09:55:35 +05:30 • committed by Alexander Winkowski
commit 6024e3974b
No known key found for this signature in database
GPG key ID: 72762A66704CDE44

View file

@ -318,7 +318,7 @@ static int devfreq_set_target(struct devfreq *devfreq, unsigned long new_freq,
devfreq->previous_freq = new_freq;
if (devfreq->suspend_freq)
if (devfreq->suspend_freq >= 0)
devfreq->resume_freq = new_freq;
return err;
@ -912,7 +912,7 @@ int devfreq_suspend_device(struct devfreq *devfreq)
return ret;
}
if (devfreq->suspend_freq) {
if (devfreq->suspend_freq >= 0) {
mutex_lock(&devfreq->lock);
ret = devfreq_set_target(devfreq, devfreq->suspend_freq, 0);
mutex_unlock(&devfreq->lock);