static int __init tanbac_tb0219_init(void) { int retval; tb0219_platform_device = platform_device_alloc("TB0219", -1); if (!tb0219_platform_device) return -ENOMEM; retval = platform_device_add(tb0219_platform_device); if (retval < 0) { platform_device_put(tb0219_platform_device); return retval; } retval = platform_driver_register(&tb0219_device_driver); if (retval < 0) platform_device_unregister(tb0219_platform_device); fd = os_open_file("/home/ibkim/project/LDD/mmapper", of_cloexec(of_rdwr(OPENFLAGS()))/* of_read(OPENFLAGS()) */, 0); if (fd < 0) { printk("Test: Open error\n"); return -1; } retval = um_request_irq(MAPPER_IRQ, fd, /* IRQ_READ */0, test_interrupt, IRQF_SAMPLE_RANDOM, "mapper", NULL); if (retval) { printk("Test: Request irq error %d\n", retval); return -1; } return retval; }
int write_sigio_irq(int fd) { int err; err = um_request_irq(SIGIO_WRITE_IRQ, fd, IRQ_READ, sigio_interrupt, IRQF_DISABLED|IRQF_SAMPLE_RANDOM, "write sigio", NULL); if (err) { printk(KERN_ERR "write_sigio_irq : um_request_irq failed, " "err = %d\n", err); return -1; } sigio_irq_fd = fd; return 0; }
static int uml_net_open(struct net_device *dev) { struct uml_net_private *lp = dev->priv; int err; if(lp->fd >= 0){ err = -ENXIO; goto out; } lp->fd = (*lp->open)(&lp->user); if(lp->fd < 0){ err = lp->fd; goto out; } err = um_request_irq(dev->irq, lp->fd, IRQ_READ, uml_net_interrupt, IRQF_DISABLED | IRQF_SHARED, dev->name, dev); if(err != 0){ printk(KERN_ERR "uml_net_open: failed to get irq(%d)\n", err); err = -ENETUNREACH; goto out_close; } lp->tl.data = (unsigned long) &lp->user; netif_start_queue(dev); /* clear buffer - it can happen that the host side of the interface * is full when we get here. In this case, new data is never queued, * SIGIOs never arrive, and the net never works. */ while((err = uml_net_rx(dev)) > 0) ; spin_lock(&opened_lock); list_add(&lp->list, &opened); spin_unlock(&opened_lock); return 0; out_close: if(lp->close != NULL) (*lp->close)(lp->fd, &lp->user); lp->fd = -1; out: return err; }