irqreturn_t uml_net_interrupt(int irq, void *dev_id) { struct net_device *dev = dev_id; struct uml_net_private *lp = dev->priv; int err; if(!netif_running(dev)) return(IRQ_NONE); spin_lock(&lp->lock); while((err = uml_net_rx(dev)) > 0) ; if(err < 0) { printk(KERN_ERR "Device '%s' read returned %d, shutting it down\n", dev->name, err); /* dev_close can't be called in interrupt context, and takes * again lp->lock. * And dev_close() can be safely called multiple times on the * same device, since it tests for (dev->flags & IFF_UP). So * there's no harm in delaying the device shutdown. * Furthermore, the workqueue will not re-enqueue an already * enqueued work item. */ schedule_work(&lp->work); goto out; } reactivate_fd(lp->fd, UM_ETH_IRQ); out: spin_unlock(&lp->lock); return IRQ_HANDLED; }
static irqreturn_t sigio_interrupt(int irq, void *data) { char c; os_read_file(sigio_irq_fd, &c, sizeof(c)); reactivate_fd(sigio_irq_fd, SIGIO_WRITE_IRQ); return IRQ_HANDLED; }
static irqreturn_t test_interrupt(int irq, void *data) { char buff[1024]; printk("Test Interrupt occurred!!!\n"); memset(buff, 0, 1024); os_read_file(fd, buff, 1023); printk("Test: read %s\n", buff); reactivate_fd(fd, MAPPER_IRQ); return IRQ_HANDLED; }