]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
pwm: lpss: Release runtime-pm reference from the driver's remove callback
authorHans de Goede <hdegoede@redhat.com>
Fri, 12 Oct 2018 10:12:28 +0000 (12:12 +0200)
committerKhalid Elmously <khalid.elmously@canonical.com>
Fri, 14 Feb 2020 05:29:37 +0000 (00:29 -0500)
BugLink: https://bugs.launchpad.net/bugs/1863019
[ Upstream commit 42885551cedb45961879d2fc3dc3c4dc545cc23e ]

For each pwm output which gets enabled through pwm_lpss_apply(), we do a
pm_runtime_get_sync().

This commit adds pm_runtime_put() calls to pwm_lpss_remove() to balance
these when the driver gets removed with some of the outputs still enabled.

Fixes: f080be27d7d9 ("pwm: lpss: Add support for runtime PM")
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Thierry Reding <thierry.reding@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/pwm/pwm-lpss.c

index 1e69c1c9ec09635c9dffbb6b4d9cfd157f0c9108..7a4a6406cf69adc945d8290df016954ca1c4a323 100644 (file)
@@ -216,6 +216,12 @@ EXPORT_SYMBOL_GPL(pwm_lpss_probe);
 
 int pwm_lpss_remove(struct pwm_lpss_chip *lpwm)
 {
+       int i;
+
+       for (i = 0; i < lpwm->info->npwm; i++) {
+               if (pwm_is_enabled(&lpwm->chip.pwms[i]))
+                       pm_runtime_put(lpwm->chip.dev);
+       }
        return pwmchip_remove(&lpwm->chip);
 }
 EXPORT_SYMBOL_GPL(pwm_lpss_remove);