Date: Fri, 03 Jan 1997 12:25:26 -0800 From: Julian Elischer <julian@whistle.com> To: "Eric L. Hernes" <erich@lodgenet.com> Cc: hackers@freebsd.org Subject: Re: device driver initialization Message-ID: <32CD6B36.6201DD56@whistle.com> References: <199701031942.NAA24546@jake.lodgenet.com>
next in thread | previous in thread | raw e-mail | index | archive | help
Eric L. Hernes wrote:
> yea, but the `if (!devsw_installed) {}' clause should take care
> of that.
>
> I'm guessing now that the order in which devsw entries
> are installed is important, maybe sequential? Since the SYSINIT()
> macro has the SI_ORDER_MIDDLE+CDEV_MAJOR, does cdevsw_add,
> simply tack the devsw on the end of the list; so that the seemingly
> random probe/attach order will break things?
no order is not important
the CDEV_MAJOR could be left out of the above...
> >It was easier to add this to every driver in a 'boilerplate' manner
> >(in fact I used a combination of scripts and manual editing
> >to add it), than to add more specialist code to each attach routine..
> >
>
> That I understand, should a new driver use SYSINIT to be like most
> of the others, or stick it in attach? If order is important, there is
> no choice.
no you could do it your way...
I would keep the different logical parts in separate functions and
call them rater than mergre the code..
remember some devices have cdevsw entries but are not probed..
e.g. /dev/mem, /dev/ptyxx etc.etc.
it makes it more consistent to have a special time for initialising
the driver, so that having an 'attach' is not 'required'.
>
> >julian
>
> thanks,
> eric.
> --
> erich@lodgenet.com
> http://rrnet.com/~erich erich@rrnet.com
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?32CD6B36.6201DD56>
