diff -r 12122e34b96f linux-2.6-xen-sparse/arch/xen/kernel/evtchn.c --- a/linux-2.6-xen-sparse/arch/xen/kernel/evtchn.c Thu Jul 14 22:33:25 2005 +++ b/linux-2.6-xen-sparse/arch/xen/kernel/evtchn.c Thu Jul 14 16:51:46 2005 @@ -341,6 +341,20 @@ spin_unlock(&irq_mapping_update_lock); } +int request_evtchn(int evtchn, evtchn_handler handler, + unsigned long irqflags, const char * devname, void *dev_id) +{ + int irq = bind_evtchn_to_irq(evtchn); + return request_irq(irq, handler, irqflags, devname, dev_id); +} + +void free_evtchn(int evtchn, void *dev_id) +{ + int irq = evtchn_to_irq[evtchn]; + free_irq(irq, dev_id); + unbind_evtchn_from_irq(evtchn); +} + static void do_nothing_function(void *ign) { } diff -r 12122e34b96f linux-2.6-xen-sparse/drivers/xen/blkback/common.h --- a/linux-2.6-xen-sparse/drivers/xen/blkback/common.h Thu Jul 14 22:33:25 2005 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/common.h Thu Jul 14 16:51:46 2005 @@ -42,7 +42,6 @@ /* Physical parameters of the comms window. */ unsigned long shmem_frame; unsigned int evtchn; - int irq; /* Comms information. */ blkif_back_ring_t blk_ring; /* VBDs attached to this interface. */ diff -r 12122e34b96f linux-2.6-xen-sparse/drivers/xen/blkback/interface.c --- a/linux-2.6-xen-sparse/drivers/xen/blkback/interface.c Thu Jul 14 22:33:25 2005 +++ b/linux-2.6-xen-sparse/drivers/xen/blkback/interface.c Thu Jul 14 16:51:46 2005 @@ -38,7 +38,7 @@ * may be outstanding requests at the disc whose asynchronous responses * must still be notified to the remote driver. */ - unbind_evtchn_from_irq(blkif->evtchn); + free_evtchn(blkif->evtchn, blkif); #ifdef CONFIG_XEN_BLKDEV_GRANT { @@ -247,12 +247,11 @@ BACK_RING_INIT(&blkif->blk_ring, sring, PAGE_SIZE); blkif->evtchn = evtchn; - blkif->irq = bind_evtchn_to_irq(evtchn); blkif->shmem_frame = shmem_frame; blkif->status = CONNECTED; blkif_get(blkif); - request_irq(blkif->irq, blkif_be_int, 0, "blkif-backend", blkif); + request_evtchn(blkif->evtchn, blkif_be_int, 0, "blkif-backend", blkif); connect->status = BLKIF_BE_STATUS_OKAY; } @@ -277,7 +276,6 @@ blkif->status = DISCONNECTING; blkif->disconnect_rspid = rsp_id; wmb(); /* Let other CPUs see the status change. */ - free_irq(blkif->irq, blkif); blkif_deschedule(blkif); blkif_put(blkif); return 0; /* Caller should not send response message. */ diff -r 12122e34b96f linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c Thu Jul 14 22:33:25 2005 +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c Thu Jul 14 16:51:46 2005 @@ -78,7 +78,6 @@ static int blkif_handle = 0; static unsigned int blkif_state = BLKIF_STATE_CLOSED; static unsigned int blkif_evtchn = 0; -static unsigned int blkif_irq = 0; static int blkif_control_rsp_valid; static blkif_response_t blkif_control_rsp; @@ -1159,10 +1158,7 @@ free_page((unsigned long)blk_ring.sring); blk_ring.sring = NULL; } - free_irq(blkif_irq, NULL); - blkif_irq = 0; - - unbind_evtchn_from_irq(blkif_evtchn); + free_evtchn(blkif_evtchn, NULL); blkif_evtchn = 0; } @@ -1266,12 +1262,11 @@ int err = 0; blkif_evtchn = status->evtchn; - blkif_irq = bind_evtchn_to_irq(blkif_evtchn); - - err = request_irq(blkif_irq, blkif_int, SA_SAMPLE_RANDOM, "blkif", NULL); + + err = request_evtchn(blkif_evtchn, blkif_int, SA_SAMPLE_RANDOM, "blkif", NULL); if ( err ) { - WPRINTK("request_irq failed (err=%d)\n", err); + WPRINTK("request_evtchn failed (err=%d)\n", err); return; } diff -r 12122e34b96f linux-2.6-xen-sparse/include/asm-xen/evtchn.h --- a/linux-2.6-xen-sparse/include/asm-xen/evtchn.h Thu Jul 14 22:33:25 2005 +++ b/linux-2.6-xen-sparse/include/asm-xen/evtchn.h Thu Jul 14 16:51:46 2005 @@ -41,6 +41,11 @@ /* * LOW-LEVEL DEFINITIONS */ + +/* Binding to event channels */ +typedef int (*evtchn_handler)(int dummy, void *dev_id, struct pt_regs *regs); +int request_evtchn(int evtchn, evtchn_handler handler, unsigned long irqflags, const char *devname, void *dev_id); +void free_evtchn(int evtchn, void *dev_id); /* Entry point for notifications into Linux subsystems. */ asmlinkage void evtchn_do_upcall(struct pt_regs *regs);