Re: sys/pci/if* fixes

2003-02-16 Thread M. Warner Losh
One thing: you don't need to move the allocation of the interrupt, just the turning it on. However, if you move the location that you turn it on be careful that the driver doesn't do something silly in its attach routine. I was wrong a while ago when I said that the attach routines typically turn

Re: sys/pci/if* fixes

2003-02-16 Thread M. Warner Losh
In message: <[EMAIL PROTECTED]> Nate Lawson <[EMAIL PROTECTED]> writes: : * Does each device that uses miibus need to explicitly call : device_delete_child when it is detaching? Should it do it also in its : attach routine if it encounters an error? I assume all drivers need to do : t

Re: sys/pci/if* fixes

2003-02-16 Thread M. Warner Losh
In message: <[EMAIL PROTECTED]> "Matthew N. Dodd" <[EMAIL PROTECTED]> writes: : On Fri, 14 Feb 2003, Nate Lawson wrote: : > Also, except for xl, all drivers have a common cleanup on error in : > attach that backs out allocated resources with no assumptions about the : > order they were

Re: sys/pci/if* fixes

2003-02-15 Thread Nate Lawson
On Sun, 16 Feb 2003, Matthew N. Dodd wrote: > On Sat, 15 Feb 2003, Nate Lawson wrote: > > The 'if' is a matter of coding style. Which is preferred: multiple > > returns from the same function (one which is only reachable from a goto) > > or one linear path with an 'if' to see if this is an error e

Re: sys/pci/if* fixes

2003-02-15 Thread Matthew N. Dodd
On Sat, 15 Feb 2003, Nate Lawson wrote: > The 'if' is a matter of coding style. Which is preferred: multiple > returns from the same function (one which is only reachable from a goto) > or one linear path with an 'if' to see if this is an error exit? In this case a single return is harder to read

Re: sys/pci/if* fixes

2003-02-15 Thread Nate Lawson
On Sat, 15 Feb 2003, Matthew N. Dodd wrote: > On Fri, 14 Feb 2003, Nate Lawson wrote: > > Also, except for xl, all drivers have a common cleanup on error in > > attach that backs out allocated resources with no assumptions about the > > order they were allocated in. > > Please see if_pcn.c for the

Re: sys/pci/if* fixes

2003-02-15 Thread Matthew N. Dodd
On Fri, 14 Feb 2003, Nate Lawson wrote: > Also, except for xl, all drivers have a common cleanup on error in > attach that backs out allocated resources with no assumptions about the > order they were allocated in. Please see if_pcn.c for the correct approach to freeing resources; its not necessar

sys/pci/if* fixes

2003-02-14 Thread Nate Lawson
I have been working on a set of patches to fix locking in attach as well as fix memory leaks on failure/detach. The general approach is to remove all locking in attach and instead defer interrupt allocation to right before ifattach. Also, except for xl, all drivers have a common cleanup on error