On 1/27/2020 6:57 PM, Andrey Smirnov wrote: > Leverage devres to get rid of code storing global context as well as > init_done flag. > > Original code also has a circular deallocation dependency where > unregister_algs() -> caam_rng_exit() -> caam_jr_free() chain would > only happen if all of JRs were freed. Fix this by moving I wouldn't call this a circular dependency. I think the discussion & patch here: https://patchwork.kernel.org/patch/11140741/ https://lore.kernel.org/linux-crypto/VI1PR0402MB34859D108C03F3AB0F64EE6598B10@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/ describes more accurately the problem: "The issue in caamrng is actually that caam/jr driver (jr.c) tries to call caam_rng_exit() on the last available jr device. Instead, caam_rng_exit() must be called on the same jr device that was used during caam_rng_init()." > caam_rng_exit() outside of unregister_algs() and doing it specifically > for JR that instantiated HWRNG. > > Signed-off-by: Andrey Smirnov <andrew.smirnov@xxxxxxxxx> > Cc: Chris Healy <cphealy@xxxxxxxxx> > Cc: Lucas Stach <l.stach@xxxxxxxxxxxxxx> > Cc: Horia Geantă <horia.geanta@xxxxxxx> > Cc: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> > Cc: Iuliana Prodan <iuliana.prodan@xxxxxxx> > Cc: linux-crypto@xxxxxxxxxxxxxxx > Cc: linux-kernel@xxxxxxxxxxxxxxx > Cc: linux-imx@xxxxxxx Current patch is similar with the one mentioned above and solves the problem. Thus, with rewording the commit message (and squashing patch 3/9) you can add my Reviewed-by: Horia Geantă <horia.geanta@xxxxxxx> Thanks, Horia