Re: [PATCH] devexit fixes in i82092.c

Patrick Mochel
2002-03-25T19:06:07Z

(Sorry, been on vacation...)

On Fri, 15 Mar 2002, Jeff Garzik wrote:

> Linus Torvalds wrote:
>
> >
> >On Sat, 16 Mar 2002, Anders Gustafsson wrote:
> >
> >>this patch fixes "undefined reference to `local symbols in discarded
> >>section .text.exit'" linking error.
> >>
> >
> >Looking more at this, I actually think that the _real_ fix is to call all
> >drivers exit functions at kernel shutdown, and not discard the exit
> >section when linking into the tree.
> >
> >That, together with the device tree, automatically gives us the
> >_correct_ shutdown sequence, soemthing we don't have right now.
> >
> >Anybody willing to look into this, and get rid of that __devexit_p()
> >thing?
> >
>
> (thinking vaguely long-term)
>
> I wonder if mochel already code for this, or has thought about this...
> Just like suspend, IMO we ideally should use the device tree to
> shutdown the system, agreed?

Yes, I have thought about this, and we should be doing it. Not necessarily
for the case of shutdown, but for the case of reboot, and things like
linux-linux booting.

The code is simply a depth-first walk of the device tree. I had code to do
it once upon a time, for the purpose of suspending devices; it's
straightforward.

> Further, I wonder if the reboot/shutdown notifiers can be replaced with
> device tree control over those events...

Yes, I think so. And the old PM code can also be replaced with the generic
interface, with similar walks of the tree. I've been procrastinating, but
now is a good time to start making the change.

What I'm thinking for the reboot case is that we just use the remove()
callback. This would queisce the device and put it in a low power state.
This would be different that module_exit, though. Perhaps it would only
decrement the module usage count. Maybe it already does that; I haven't
looked.

-pat