From owner-freebsd-hackers Fri Jan 3 12:31:11 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.4/8.8.4) id MAA12998 for hackers-outgoing; Fri, 3 Jan 1997 12:31:11 -0800 (PST) Received: from alpo.whistle.com (alpo.whistle.com [207.76.204.38]) by freefall.freebsd.org (8.8.4/8.8.4) with ESMTP id MAA12993 for ; Fri, 3 Jan 1997 12:31:08 -0800 (PST) Received: from current1.whistle.com (current1.whistle.com [207.76.205.22]) by alpo.whistle.com (8.8.2/8.8.2) with SMTP id MAA10622; Fri, 3 Jan 1997 12:26:39 -0800 (PST) Message-ID: <32CD6B36.6201DD56@whistle.com> Date: Fri, 03 Jan 1997 12:25:26 -0800 From: Julian Elischer Organization: Whistle Communications X-Mailer: Mozilla 3.0Gold (X11; I; FreeBSD 2.2-CURRENT i386) MIME-Version: 1.0 To: "Eric L. Hernes" CC: hackers@freebsd.org Subject: Re: device driver initialization References: <199701031942.NAA24546@jake.lodgenet.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk 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