• Uwe Kleine-König's avatar
    hwrng: xgene - Simplify using devm_clk_get_optional_enabled() · 67fb1e29
    Uwe Kleine-König authored
    Instead of ignoring errors returned by devm_clk_get() and manually
    enabling the clk for the whole lifetime of the bound device, use
    devm_clk_get_optional_enabled(). This is simpler and also more correct
    as it doesn't ignore errors. This is also more correct because now the
    call to clk_disable_unprepare() can be dropped from xgene_rng_remove()
    which happened while the hwrn device was still registered. With the devm
    callback disabling the clk happens correctly only after
    devm_hwrng_register() is undone.
    
    As a result struct xgene_rng_dev::clk is only used in xgene_rng_probe, and
    so the struct member can be replaced by a local variable.
    Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
    Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
    67fb1e29
xgene-rng.c 10.6 KB