Date: Thu, 4 Aug 2005 09:48:23 +0200 From: "Norbert Koch" <NKoch@demig.de> To: <Felix-KM@yandex.ru>, <freebsd-hackers@freebsd.org> Subject: RE: (no subject) Message-ID: <000001c598c8$e4045ee0$4801a8c0@ws-ew-3.W2KDEMIG> In-Reply-To: <42F1C1F9.000001.17496@ariel.yandex.ru>
next in thread | previous in thread | raw e-mail | index | archive | help
> #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" >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?000001c598c8$e4045ee0$4801a8c0>