From owner-freebsd-multimedia Fri Jul 18 23:48:33 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.5/8.8.5) id XAA10949 for multimedia-outgoing; Fri, 18 Jul 1997 23:48:33 -0700 (PDT) Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.19]) by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id XAA10942; Fri, 18 Jul 1997 23:48:25 -0700 (PDT) Received: (from bde@localhost) by godzilla.zeta.org.au (8.8.5/8.6.9) id QAA29949; Sat, 19 Jul 1997 16:43:32 +1000 Date: Sat, 19 Jul 1997 16:43:32 +1000 From: Bruce Evans Message-Id: <199707190643.QAA29949@godzilla.zeta.org.au> To: hasty@rah.star-gate.com, luigi@labinfo.iet.unipi.it Subject: Re: snd driver attach routine Cc: bde@zeta.org.au, hackers@FreeBSD.ORG, multimedia@FreeBSD.ORG, rhh@ct.picker.com, se@FreeBSD.ORG Sender: owner-multimedia@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk >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