hwrng: mtk - Force runtime pm ops for sleep ops
authorMarkus Schneider-Pargmann <msp@baylibre.com>
Thu, 30 Sep 2021 19:12:42 +0000 (21:12 +0200)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 8 Oct 2021 12:02:47 +0000 (20:02 +0800)
commitb6f5f0c8f72d348b2d07b20d7b680ef13a7ffe98
treec52d93c8504163e350e0520fbff724244bd18bf0
parent82e269ad8afe1c73aa6c28dca3c23fecc6c8b616
hwrng: mtk - Force runtime pm ops for sleep ops

Currently mtk_rng_runtime_suspend/resume is called for both runtime pm
and system sleep operations.

This is wrong as these should only be runtime ops as the name already
suggests. Currently freezing the system will lead to a call to
mtk_rng_runtime_suspend even if the device currently isn't active. This
leads to a clock warning because it is disabled/unprepared although it
isn't enabled/prepared currently.

This patch fixes this by only setting the runtime pm ops and forces to
call the runtime pm ops from the system sleep ops as well if active but
not otherwise.

Fixes: 81d2b34508c6 ("hwrng: mtk - add runtime PM support")
Signed-off-by: Markus Schneider-Pargmann <msp@baylibre.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/char/hw_random/mtk-rng.c