From owner-freebsd-hackers Fri Jan 3 10:49:52 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.4/8.8.4) id KAA07515 for hackers-outgoing; Fri, 3 Jan 1997 10:49:52 -0800 (PST) Received: from who.cdrom.com (who.cdrom.com [204.216.27.3]) by freefall.freebsd.org (8.8.4/8.8.4) with ESMTP id KAA07510 for ; Fri, 3 Jan 1997 10:49:49 -0800 (PST) Received: from alpo.whistle.com (alpo.whistle.com [207.76.204.38]) by who.cdrom.com (8.7.5/8.6.11) with ESMTP id KAA02501 for ; Fri, 3 Jan 1997 10:49:47 -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 KAA08397; Fri, 3 Jan 1997 10:41:42 -0800 (PST) Message-ID: <32CD529D.167EB0E7@whistle.com> Date: Fri, 03 Jan 1997 10:40:29 -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: <199701031536.JAA16890@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: > > Howdy, > > It looks like most of the ISA drivers now days have a frag like: > > SYSINIT(foo,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,foo_drvinit,NULL) > > foo_drvinit(void *nothing){ > static int foo_devsw_installed=0; > dev_t dev; > > if (! foo_devsw_installed ) { > dev = makedev(CDEV_MAJOR, 0); > cdevsw_add(&dev, &foo_cdevsw, NULL); > foo_devsw_installed = 1; > } > } > > Is there any reason that this can't be absorbed in the attach function, > somewhere around where the devfs stuff is done? What's the reason for > adding yet another entry point during re-boot. Isn't probe/attach enough? > > The addition of a devsw entry is done ONCE PER DRIVER the probe/attach is done ONCE PER INSTANCE so the usages are slightly different. other than that, yes it could be done.... remember also that the eventual aim is to make drivers LKMable in which case the SYSINIT part would be done by the LKM installation. 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.. julian