Subject: Re: about autoconf
To: ycchang <ycchang@cirx.org>
From: Jachym Holecek <freza@psi.cz>
List: tech-kern
Date: 09/09/2003 09:02:43
> > > >config_found_sm also invokes config_attach, which leads to the call of
> > > >the attach function of the device driver, where config_search only uses
> > > >match.
> > > I assume that attach functions are called only when there is a succesful
> > > match for a particular device even in the case of config_found_sm.
> >
> > Actually, config_attach is called for the best match (the cfattch match
> > function that returned the highest value).
> >
>    what does best match mean? if the we find several children hava the same
> parent
> , why we just call the attach function for the best math, and the
> others?what does the
> routine match for?is it relative tothe bus properties, say, PCI or ISA?

The bus driver has some way to walk/enumerate all devices attached to
the bus (well behaved busses do). Each device is 'offered' to the
autoconfiguration system, which looks at its tables and calls match functions
of all possible child drivers. The one that returns highest value wins the
device (its attach function gets called). With this scheme, you can have
a generic driver for some class of devices, but you can still assign the
device to a more specific driver.

	Regards,
		-- Jachym Holecek