hwrng: rockchip - store dev pointer in driver struct
authorNicolas Frattaroli <nicolas.frattaroli@collabora.com>
Tue, 4 Feb 2025 15:35:48 +0000 (16:35 +0100)
committerHerbert Xu <herbert@gondor.apana.org.au>
Sat, 22 Feb 2025 07:56:02 +0000 (15:56 +0800)
commit8bb8609293ff3d8998d75c8db605c0529e83bcd9
treee8203da0ec3f2cccd749e46937dc2c3fac10934f
parente00fc3d6e7c2d0b2ab5cf03a576df39cd94479aa
hwrng: rockchip - store dev pointer in driver struct

The rockchip rng driver does a dance to store the dev pointer in the
hwrng's unsigned long "priv" member. However, since the struct hwrng
member of rk_rng is not a pointer, we can use container_of to get the
struct rk_rng instance from just the struct hwrng*, which means we don't
have to subvert what little there is in C of a type system and can
instead store a pointer to the device struct in the rk_rng itself.

Signed-off-by: Nicolas Frattaroli <nicolas.frattaroli@collabora.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/char/hw_random/rockchip-rng.c