]> git.baikalelectronics.ru Git - kernel.git/commit
PM / devfreq: Fix devfreq_add_device() when drivers are built as modules.
authorEnric Balletbo i Serra <enric.balletbo@collabora.com>
Wed, 4 Jul 2018 08:45:50 +0000 (10:45 +0200)
committerMyungJoo Ham <myungjoo.ham@samsung.com>
Tue, 2 Oct 2018 01:16:41 +0000 (10:16 +0900)
commitf620cad696fbb9574698f2b54151a140dc65cf75
treec04d424c2507228ea6cffb310f9b50b6b738296e
parent5dfa044c3a3b9125da254b1d9969551d27523c1c
PM / devfreq: Fix devfreq_add_device() when drivers are built as modules.

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: 5cf07588e334 (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>
drivers/devfreq/devfreq.c