linux/drivers/devfreq
Enric Balletbo i Serra 8c349ad127 PM / devfreq: Fix devfreq_add_device() when drivers are built as modules.
commit 23c7b54ca1 upstream.

When the devfreq driver and the governor driver are built as modules,
the call to devfreq_add_device() or governor_store() fails because the
governor driver is not loaded at the time the devfreq driver loads. The
devfreq driver has a build dependency on the governor but also should
have a runtime dependency. We need to make sure that the governor driver
is loaded before the devfreq driver.

This patch fixes this bug by adding a try_then_request_governor()
function. First tries to find the governor, and then, if it is not found,
it requests the module and tries again.

Fixes: 1b5c1be2c8 (PM / devfreq: map devfreq drivers to governor using name)
Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Reviewed-by: Chanwoo Choi <cw00.choi@samsung.com>
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
[bwh: Backported to 3.16:
 - Use string literal instead of DEVFREQ_GOV_SIMPLE_ONDEMAND
 - Adjust context]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
History 2019-02-11 17:53:24 +00:00
..
exynos PM / devfreq: remove checks for CONFIG_EXYNOS_ASV 2014-05-24 22:33:51 +09:00
devfreq.c PM / devfreq: Fix devfreq_add_device() when drivers are built as modules. 2019-02-11 17:53:24 +00:00
governor.h PM / devfreq: provide hooks for governors to be registered 2012-11-20 18:46:12 +09:00
governor_performance.c PM / devfreq: governors: add GPL module license and allow module build 2012-11-20 18:46:23 +09:00
governor_powersave.c PM / devfreq: governors: add GPL module license and allow module build 2012-11-20 18:46:23 +09:00
governor_simpleondemand.c PM / devfreq: governors: add GPL module license and allow module build 2012-11-20 18:46:23 +09:00
governor_userspace.c PM / devfreq: governors: add GPL module license and allow module build 2012-11-20 18:46:23 +09:00
Kconfig PM / devfreq: remove checks for CONFIG_EXYNOS_ASV 2014-05-24 22:33:51 +09:00
Makefile PM / devfreq: Add Exynos5-bus devfreq driver for Exynos5250 2013-06-03 20:20:29 +09:00