Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 19 Jul 1997 06:16:45 +0200 (MET DST)
From:      Luigi Rizzo <luigi@labinfo.iet.unipi.it>
To:        hasty@rah.star-gate.com (Amancio Hasty)
Cc:        se@FreeBSD.ORG, bde@zeta.org.au, hackers@FreeBSD.ORG, multimedia@FreeBSD.ORG, rhh@ct.picker.com
Subject:   Re: snd driver attach routine
Message-ID:  <199707190416.GAA18529@labinfo.iet.unipi.it>
In-Reply-To: <199707190018.RAA07293@rah.star-gate.com> from "Amancio Hasty" at Jul 18, 97 05:18:00 pm

next in thread | previous in thread | raw e-mail | index | archive | help
> 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 <bde@zeta.org.au> 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/
_____________________________|______________________________________



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199707190416.GAA18529>