in carriers/tpci200.c [189:237]
static int tpci200_request_irq(struct ipack_device *dev,
irqreturn_t (*handler)(void *), void *arg)
{
int res = 0;
struct slot_irq *slot_irq;
struct tpci200_board *tpci200;
tpci200 = check_slot(dev);
if (tpci200 == NULL)
return -EINVAL;
if (mutex_lock_interruptible(&tpci200->mutex))
return -ERESTARTSYS;
if (tpci200->slots[dev->slot].irq != NULL) {
dev_err(&dev->dev,
"Slot [%d:%d] IRQ already registered !\n",
dev->bus->bus_nr,
dev->slot);
res = -EINVAL;
goto out_unlock;
}
slot_irq = kzalloc(sizeof(struct slot_irq), GFP_KERNEL);
if (slot_irq == NULL) {
dev_err(&dev->dev,
"Slot [%d:%d] unable to allocate memory for IRQ !\n",
dev->bus->bus_nr, dev->slot);
res = -ENOMEM;
goto out_unlock;
}
/*
* WARNING: Setup Interrupt Vector in the IndustryPack device
* before an IRQ request.
* Read the User Manual of your IndustryPack device to know
* where to write the vector in memory.
*/
slot_irq->handler = handler;
slot_irq->arg = arg;
slot_irq->holder = dev;
rcu_assign_pointer(tpci200->slots[dev->slot].irq, slot_irq);
tpci200_enable_irq(tpci200, dev->slot);
out_unlock:
mutex_unlock(&tpci200->mutex);
return res;
}