Subject: Re: LKM & autoconf ?
To: Quentin Garnier <netbsd@quatriemek.com>
From: Bill Studenmund <wrstuden@netbsd.org>
List: tech-kern
Date: 09/23/2003 09:19:36
On Tue, 23 Sep 2003, Quentin Garnier wrote:

> Le Mon, 22 Sep 2003 19:52:58 -0700
> collver1@comcast.net a ecrit :
> > I am thinking about writing a NetBSD driver, and the manual pages on the
> > subject look very promising.  Since I have never written one before, I
> > have some questions.
> >
> > Is the autoconfiguration framework readily used from an LKM?  Would
> > someone point me to a good example of a character device LKM that uses
> > autoconf?
>
> I don't really understand your question. autoconf(9) is mainly about
> managing device drivers in a tree. Being a character device is an
> unrelated issue.
>
> Our LKM subsystem provides a way to write character device drivers which
> is quite independent from autoconf(9): the LKM receives a major device
> number that can be used by userland to access the device.
>
> For a single driver that works quite well, and you don't need autoconf(9),
> you just call the probe and attach routines in one shot in the module init
> function. Of course there will be no real autoconf(9) attachment.

In general, we'd like to be able to let LKMs tie into autoconf as full-
class drivers. Among other things, with hot-swap slots, if the driver is
hooked into autoconf, the right thing will happen when a card is inserted.

> It is possible, though, to use autoconf(9) although it is a bit
> complicated for a single device IMO. I have an example of how autoconf(9)
> can be used by LKMs, but it requires ksyms.
>
> (Well, it's not entirely true. They can be linked together as a single LKM
> and then loaded. But it means two copies of all that code if you have,
> like me, two sound cards. Though the code could be changed to allow
> linking on all of them, including every driver for every device, and
> adding all the autoconf(9) entries in one step in the LKM init function.)

Something got missed in there. You changed subjects...

Take care,

Bill