Re: [RFC] embedded struct device Re: [patch] IDE driver model update

Linus Torvalds
2002-10-08T22:04:44Z

On Tue, 8 Oct 2002, Alexander Viro wrote:
> That would be nice, if it worked that way. As it is we have
>
> driver allocates foo
> driver grabs a reference to foo->dev
> ....
> somebody else grabs/drops temporary references to foo->dev
> ....
> driver call put_device(&foo->dev)
> driver frees structures refered from foo.
> driver frees foo.
>
> _IF_ the last two steps were done by ->release(), your arguments would
> work. Actually they are done by driver right after the put_device() call.

Right. But that's a driver bug, and it's because this whole thing is
fairly new.

There aren't that many things that actually play with these things (mainly
the PCI and the USB layer, and individual drivers shouldn't care, it's
just the bus layer that does all of this), so we should be able to fix the
cases cleanly.

Linus