On Wed, 18 Nov 2026 at 18:58, Bernhard Beschow <[email protected]> wrote:
> Am 14. November 2026 10:37:09 UTC schrieb Peter Maydell 
> <[email protected]>:
> >One thing I'm not sure about is what unrealize is actually for.
> >Is there ever anything that a device needs to do in unrealize that
> >it could not postpone to deinit?
>
> I think this question boils down to what the difference between init() and 
> realize() is. deinit() and unrealize() should be their respective duals, i.e. 
> undo what has been done there.

The main reason IMHO that we have split init and realize is:
 (1) init can't fail, so operations that can fail go in realize
 (2) operations that depend on properties set on the device
     need to go in realize, which runs after properties are set

But neither of those apply to unrealize:
 * unrealize can't fail
 * there's no equivalent of setting properties that happens
   during the unrealize-and-destroy sequence

"Undo in unrealize what you did in realize, and undo in
deinit what you did in init" sounds like a nice rule, except
for the fact that we have no reference counting for "keep
this device realized', so there's no way for users of the
device to make sure that things they're relying on don't
go away if you clean them up in unrealize.

thanks
-- PMM

Reply via email to