(no subject)
Felix-KM
Felix-KM at yandex.ru
Thu Aug 4 10:18:54 GMT 2005
>> #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
>
>
Oops... I am ashamed for my inattention...
Thank you very much...
More information about the freebsd-hackers
mailing list