# Bus_teardown_intr



## srivarun (Jun 5, 2013)

I was trying to look at the bus_teardown_intr() method in file sys/kern/subr_bus.c. This method is accessing BUS_TEARDOWN_INTR. I am not able to find the code defining BUS_TEARDOWN_INTR. Can anyone please help me out with this.

Thank you.


----------



## cpm@ (Jun 5, 2013)

/usr/src/sys/kern/subr_bus.c

```
/**
 * @brief Helper function for implementing BUS_TEARDOWN_INTR().
 *
 * This simple implementation of BUS_TEARDOWN_INTR() simply calls the
 * BUS_TEARDOWN_INTR() method of the parent of @p dev.
 */
int
bus_generic_teardown_intr(device_t dev, device_t child, struct resource *irq,
    void *cookie)
{
        /* Propagate up the bus hierarchy until someone handles it. */
        if (dev->parent)
                return (BUS_TEARDOWN_INTR(dev->parent, child, irq, cookie));
        return (EINVAL);
}
```

See bus_setup_intr(9)() man page.


----------



## fluca1978 (Jun 5, 2013)

I suspect it is something generated during the kernel compilation (machine code), but this is just a guess.


----------



## srivarun (Jun 5, 2013)

cpu82 said:
			
		

> See bus_setup_intr(9)() man page.
> 
> /usr/src/sys/kern/subr_bus.c:3682:3696
> 
> ...



Thank you for replying. Is the code for BUS_TEARDOWN_INTR available? I want to know how BUS_TEARDOWN_INTR has been implemented.

Thank you*.*


----------



## cpm@ (Jun 5, 2013)

In /usr/include/sys/bus.h:398 is declared bus_teardown_intr() function to tear down an interrupt handler.

```
int     bus_teardown_intr(device_t dev, struct resource *r, void *cookie);
```

Also is declared for register:

```
int     bus_setup_intr(device_t dev, struct resource *r, int flags,
                       driver_filter_t filter, driver_intr_t handler, 
                       void *arg, void **cookiep);
```


----------

