FreeBSD/sys/dev/mrsas/mrsas.c
/*
 * mrsas_setup_irq:	Set up interrupt
 * input:			Adapter instance soft state
 *
 * This function sets up interrupts as a bus resource, with flags indicating
 * resource permitting contemporaneous sharing and for resource to activate
 * atomically.
 */
Set up interrupt
input:                       Adapter instance soft state

This function sets up interrupts as a bus resource, with flags indicating
resource permitting contemporaneous sharing and for resource to activate
atomically.
Set up interrupt input : Adapter instance soft state This function sets up interrupts as a bus resource with flags indicating resource permitting contemporaneous sharing and for resource to activate atomically .
static int
mrsas_setup_irq(struct mrsas_softc *sc)
{
	if (sc->msix_enable && (mrsas_setup_msix(sc) == SUCCESS))
		device_printf(sc->mrsas_dev, "MSI-x interrupts setup success\n");
	else {
		device_printf(sc->mrsas_dev, "Fall back to legacy interrupt\n");
		sc->irq_context[0].sc = sc;
		sc->irq_context[0].MSIxIndex = 0;
		sc->irq_id[0] = 0;
		sc->mrsas_irq[0] = bus_alloc_resource_any(sc->mrsas_dev,
		    SYS_RES_IRQ, &sc->irq_id[0], RF_SHAREABLE | RF_ACTIVE);
		if (sc->mrsas_irq[0] == NULL) {
			device_printf(sc->mrsas_dev, "Cannot allocate legcay"
			    "interrupt\n");
			return (FAIL);
		}
		if (bus_setup_intr(sc->mrsas_dev, sc->mrsas_irq[0],
		    INTR_MPSAFE | INTR_TYPE_CAM, NULL, mrsas_isr,
		    &sc->irq_context[0], &sc->intr_handle[0])) {
			device_printf(sc->mrsas_dev, "Cannot set up legacy"
			    "interrupt\n");
			return (FAIL);
		}
	}
	return (0);
}
static int mrsas_setup_irq ( struct mrsas_softc * sc ) { if ( sc -> msix_enable && ( mrsas_setup_msix ( sc ) == SUCCESS ) ) device_printf ( sc -> mrsas_dev , " \n " ) ; else { device_printf ( sc -> mrsas_dev , " \n " ) ; sc -> irq_context [ 0 ] . sc = sc ; sc -> irq_context [ 0 ] . MSIxIndex = 0 ; sc -> irq_id [ 0 ] = 0 ; sc -> mrsas_irq [ 0 ] = bus_alloc_resource_any ( sc -> mrsas_dev , SYS_RES_IRQ , & sc -> irq_id [ 0 ] , RF_SHAREABLE | RF_ACTIVE ) ; if ( sc -> mrsas_irq [ 0 ] == NULL ) { device_printf ( sc -> mrsas_dev , " " " \n " ) ; return ( FAIL ) ; } if ( bus_setup_intr ( sc -> mrsas_dev , sc -> mrsas_irq [ 0 ] , INTR_MPSAFE | INTR_TYPE_CAM , NULL , mrsas_isr , & sc -> irq_context [ 0 ] , & sc -> intr_handle [ 0 ] ) ) { device_printf ( sc -> mrsas_dev , " " " \n " ) ; return ( FAIL ) ; } } return ( 0 ) ; }
mrsas_setup_irq:     Set up interrupt
 input:                       Adapter instance soft state
mrsas_setup_irq : Set up interrupt input : Adapter instance soft state