From owner-freebsd-hackers Fri Jul 18 22:20:00 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id WAA07745 for hackers-outgoing; Fri, 18 Jul 1997 22:20:00 -0700 (PDT) Received: from labinfo.iet.unipi.it (labinfo.iet.unipi.it [131.114.9.5]) by hub.freebsd.org (8.8.5/8.8.5) with SMTP id WAA07723; Fri, 18 Jul 1997 22:19:48 -0700 (PDT) Received: from localhost (luigi@localhost) by labinfo.iet.unipi.it (8.6.5/8.6.5) id GAA18529; Sat, 19 Jul 1997 06:16:45 +0200 From: Luigi Rizzo Message-Id: <199707190416.GAA18529@labinfo.iet.unipi.it> Subject: Re: snd driver attach routine To: hasty@rah.star-gate.com (Amancio Hasty) Date: Sat, 19 Jul 1997 06:16:45 +0200 (MET DST) Cc: se@FreeBSD.ORG, bde@zeta.org.au, hackers@FreeBSD.ORG, multimedia@FreeBSD.ORG, rhh@ct.picker.com In-Reply-To: <199707190018.RAA07293@rah.star-gate.com> from "Amancio Hasty" at Jul 18, 97 05:18:00 pm X-Mailer: ELM [version 2.4 PL23] Content-Type: text Sender: owner-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk > Well, we should be able to detect device specific failure and > not allow access to the device driver that way our drivers don't > have to handle a fatal low level device configuration . I think I get the rationale for not testing return value in the attach routine. After the probe you (should) know that the peripheral is there. A failure to attach should then depend only on os problems (typically, failure to allocate resources such as memory, dma, irq, or a device descriptor). Since no resource allocation was in the probe, the routine calling the attach has nothing to do on failure -- all deallocations should be done in the attach routine being device specific. Secondly, if I am not mistaken, once you create a device entry in the fs with a major number corresponding to an existing device, the routines for the devices are always invoked and they have to check the minor dev anyways to see if it corresponds to a configured device. So basically I think that it is ok to have the attach routine to return void for all buses (which means that, if something has to be changed, is the attach for isa drivers). Cheers Luigi > >From The Desk Of Stefan Esser : > > On Jul 14, Bruce Evans wrote: > > > >Problem: what should be the return type of *attach() routines ? > > > > > > Perhaps it should be void to match reality, but it currently must be > > > int for isa drivers to match the prototype in `struct isa_driver'. > > > > > > >The drivers in /sys/pci all return void for the attach routine. > > > > > > They have to, to match the prototype in `strcuct pci_driver'. > > > > I could easily change the return type of > > the PCI attach function. Should I ??? > > > > Regards, STefan -----------------------------+-------------------------------------- Luigi Rizzo | Dip. di Ingegneria dell'Informazione email: luigi@iet.unipi.it | Universita' di Pisa tel: +39-50-568533 | via Diotisalvi 2, 56126 PISA (Italy) fax: +39-50-568522 | http://www.iet.unipi.it/~luigi/ _____________________________|______________________________________