Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 19 Jul 1997 16:43:32 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        hasty@rah.star-gate.com, luigi@labinfo.iet.unipi.it
Cc:        bde@zeta.org.au, hackers@FreeBSD.ORG, multimedia@FreeBSD.ORG, rhh@ct.picker.com, se@FreeBSD.ORG
Subject:   Re: snd driver attach routine
Message-ID:  <199707190643.QAA29949@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>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.

In practice, for isa devices the IRQ allocation is done in generic code,
so the probe status is necessary (but not used).

>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.

This is a bug.  Drivers whose probe or attach can fail should not use
SYSINIT() to register their device switches.

Bruce



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