From owner-freebsd-hackers@FreeBSD.ORG Thu Aug 4 07:51:57 2005 Return-Path: X-Original-To: freebsd-hackers@freebsd.org Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2261D16A41F for ; Thu, 4 Aug 2005 07:51:57 +0000 (GMT) (envelope-from NKoch@demig.de) Received: from server.absolute-media.de (server.absolute-media.de [213.239.231.9]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9EB9443D46 for ; Thu, 4 Aug 2005 07:51:56 +0000 (GMT) (envelope-from NKoch@demig.de) Received: from localhost (unknown [127.0.0.1]) by server.absolute-media.de (Postfix) with ESMTP id 2FE4A8D722; Thu, 4 Aug 2005 09:51:51 +0200 (CEST) Received: from server.absolute-media.de ([127.0.0.1]) by localhost (server [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 17512-05; Thu, 4 Aug 2005 09:51:46 +0200 (CEST) Received: from firewall.demig (p5083A50A.dip0.t-ipconnect.de [80.131.165.10]) by server.absolute-media.de (Postfix) with ESMTP id 449628DF2E; Thu, 4 Aug 2005 09:51:46 +0200 (CEST) Received: from ws-ew-3 (ws-ew-3.w2kdemig [192.168.1.72]) by firewall.demig (8.13.4/8.13.1) with SMTP id j747mOGl051496; Thu, 4 Aug 2005 09:48:24 +0200 (CEST) (envelope-from NKoch@demig.de) From: "Norbert Koch" To: , Date: Thu, 4 Aug 2005 09:48:23 +0200 Message-ID: <000001c598c8$e4045ee0$4801a8c0@ws-ew-3.W2KDEMIG> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook 8.5, Build 4.71.2173.0 Importance: Normal In-Reply-To: <42F1C1F9.000001.17496@ariel.yandex.ru> X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2120.0 X-Virus-Scanned: by amavisd-new X-Virus-Scanned: by amavisd-new at absolute-media.de Cc: Subject: RE: (no subject) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Aug 2005 07:51:57 -0000 > #define DEVICE2SOFTC(device) ((struct dev_softc > *)device_get_softc(device)) > > static void dev_intr(void *arg); > > struct dev_softc { > ... > int rid_irq; > struct resource* res_irq; > void *intr_cookie; > ... > }; > > static int > dev_attach(device_t device) > { > ... > > dev_sc->rid_irq = 0; > dev_sc->res_irq = bus_alloc_resource_any(device, SYS_RES_IRQ, > &(dev_sc->rid_irq), > RF_SHAREABLE|RF_ACTIVE); > if (dev_sc->res_irq == NULL) > { > uprintf("!!! Could not map interrupt !!!\n"); > goto fail; > } > > if (bus_setup_intr(device, dev_sc->res_irq, INTR_TYPE_TTY, > dev_intr, dev_sc, &dev_sc->intr_cookie)) > { > uprintf("!!! Could not setup irq !!!\n"); > goto fail; > } > > ... > > fail: > return ENXIO; > } > > static int > dev_detach(device_t device) > { > struct dev_softc *dev_sc = DEVICE2SOFTC(device); > > destroy_dev(dev_sc->device); > > if (bus_teardown_intr(device, dev_sc->res_irq, > dev_sc->intr_cookie) != 0); !!!! Do you see that semicolon? !!!! Norbert > printf("bus_teardown_intr ERROR !!!\n"); > > bus_release_resource(device, SYS_RES_IRQ, dev_sc->rid_irq, > > dev_sc->res_irq); > ... > > return 0; > } > > static void > dev_intr(void *arg) > { > struct dev_softc *dev_sc = (struct dev_softc *)arg; > > ... > } > > When the driver is loaded the following message is shown: > > dev0 port 0x9800-0x980f,0x9400-0x947f irq 16 at device 10.0 on pci1 > > i.e., as I understand, resourses are allocated normally. > > But when the driver is being unloaded the following message appear: > > bus_teardown_intr ERROR !!! > > What have I done wrong? Hint me please how to use bus_teardown_intr() > function correctly? > _______________________________________________ > freebsd-hackers@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-hackers > To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" >