On Fri, Sep 29, 2023, at 21:26, Alexander Graf wrote: > On 29.09.23 19:28, Arnd Bergmann wrote: >> On Fri, Sep 29, 2023, at 09:33, Alexander Graf wrote: >> >>> +int nsm_register_hwrng(struct nsm_hwrng *_nsm_hwrng) >>> +{ >>> + if (nsm_hwrng) >>> + return -EEXIST; >>> + >>> + nsm_hwrng = _nsm_hwrng; >>> + if (nsm_vdev) >>> + nsm_hwrng->probe(nsm_vdev); >>> + >>> + return 0; >>> +} >>> +EXPORT_SYMBOL_GPL(nsm_register_hwrng); >> This should get easier of you reverse the dependency between >> the two drivers and just call into the nsm_hwrng_probe() >> function from the main driver's probe. > > > I don't understand what you mean by reversing the dependency. Nsm_rng is > a downstream of Nsm, because Nsm is the virtio device that owns the channel. To clarify: I don't really consider Nsm_rng as a downstream driver, since the main driver does not have a bus model or device detection below it that would allow probing any function specific drivers. I would remove the dynamic registration entirely and just merge both parts into a single file that happens to expose an rng interface. Arnd