X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=linux_module%2Fiface-host-dev.c;h=23a3a09dc9c795b1f71017622a3bc7a9e4caaf54;hb=2cce318d177c66ebf6eb5bb2cd156df46f8aca85;hp=6edc26bb3dc4dc92f124d68ab49a253e98a4ed69;hpb=5c2a2684778fa080c41a0f04518721ebe476efb1;p=palacios.git diff --git a/linux_module/iface-host-dev.c b/linux_module/iface-host-dev.c index 6edc26b..23a3a09 100644 --- a/linux_module/iface-host-dev.c +++ b/linux_module/iface-host-dev.c @@ -301,6 +301,10 @@ static unsigned int host_dev_poll(struct file * filp, palacios_spinlock_lock_irqsave(&(dev->lock),f); + + // register ourselves on the user wait queue + poll_wait(filp, &(dev->user_wait_queue), poll_tb); + if (dev->waiting) { // Yes, we have a request if you want it! palacios_spinlock_unlock_irqrestore(&(dev->lock),f); @@ -310,9 +314,6 @@ static unsigned int host_dev_poll(struct file * filp, // No request yet, so we need to wait for one to show up. - // register ourselves on the user wait queue - poll_wait(filp, &(dev->user_wait_queue), poll_tb); - palacios_spinlock_unlock_irqrestore(&(dev->lock),f); DEEP_DEBUG_PRINT("palacios: hostdev: poll delayed\n"); @@ -839,6 +840,8 @@ static int palacios_host_dev_close(v3_host_dev_t hostdev) palacios_spinlock_unlock_irqrestore(&(dev->lock),f2); palacios_spinlock_unlock_irqrestore(&(host_dev->lock),f1); + palacios_spinlock_deinit(&(dev->lock)); + palacios_host_dev_user_free(dev); return 0; @@ -1320,6 +1323,11 @@ static int host_dev_init( void ) { } +static int host_dev_deinit(void) { + // nothing to do + return 0; +} + static int host_dev_guest_init(struct v3_guest * guest, void ** vm_data ) { struct palacios_host_dev * host_dev = palacios_alloc(sizeof(struct palacios_host_dev)); @@ -1343,7 +1351,9 @@ static int host_dev_guest_init(struct v3_guest * guest, void ** vm_data ) { static int host_dev_guest_deinit(struct v3_guest * guest, void * vm_data) { - palacios_free(vm_data); + struct palacios_host_dev * host_dev = (struct palacios_host_dev *) vm_data; + palacios_spinlock_deinit(&(host_dev->lock)); + palacios_free(host_dev); return 0; } @@ -1353,7 +1363,7 @@ static int host_dev_guest_deinit(struct v3_guest * guest, void * vm_data) { static struct linux_ext host_dev_ext = { .name = "HOST_DEVICE_INTERFACE", .init = host_dev_init, - .deinit = NULL, + .deinit = host_dev_deinit, .guest_init = host_dev_guest_init, .guest_deinit = host_dev_guest_deinit };