From 6024e3974b24192524112c5ad894c8fec902eb3a Mon Sep 17 00:00:00 2001 From: Shreyas K K Date: Thu, 11 Nov 2021 09:55:35 +0530 Subject: [PATCH] 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 --- drivers/devfreq/devfreq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index fe0bb7a79dee..b48f465ea19b 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -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);