Re: snd driver attach routine

[ Available lists | Index of freebsd-hackers | Month of Jul 1997 | Week of 18 Jul 1997 | Raw email | View thread | Wrap long lines | Reply | Tag ]
From
Bruce Evans <bde@zeta.org.au>
Date
18 Jul 1997 23:48:35
Subject
Re: snd driver attach routine
Message-ID
199707190643.QAA29949@godzilla.zeta.org.au


[ Hide this part ]
>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


Elapsed time: 0.070 seconds