]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/xen.git/commitdiff
evtchn: factor out freeing an event channel
authorDavid Vrabel <david.vrabel@citrix.com>
Tue, 16 Jun 2015 10:30:16 +0000 (12:30 +0200)
committerJan Beulich <jbeulich@suse.com>
Tue, 16 Jun 2015 10:30:16 +0000 (12:30 +0200)
We're going to want to free an event channel from two places.  Factor out
the code into a free_evtchn() function.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
xen/common/event_channel.c

index bf9b2f8ecd6016c27a1151954fd042a64ac875e7..947880f8ffcbb0ef5345f8a73cf1b761f0ba84cc 100644 (file)
@@ -192,6 +192,17 @@ static int get_free_port(struct domain *d)
     return port;
 }
 
+static void free_evtchn(struct domain *d, struct evtchn *chn)
+{
+    /* Clear pending event to avoid unexpected behavior on re-bind. */
+    evtchn_port_clear_pending(d, chn);
+
+    /* Reset binding to vcpu0 when the channel is freed. */
+    chn->state          = ECS_FREE;
+    chn->notify_vcpu_id = 0;
+
+    xsm_evtchn_close_post(chn);
+}
 
 static long evtchn_alloc_unbound(evtchn_alloc_unbound_t *alloc)
 {
@@ -569,14 +580,7 @@ static long __evtchn_close(struct domain *d1, int port1)
         BUG();
     }
 
-    /* Clear pending event to avoid unexpected behavior on re-bind. */
-    evtchn_port_clear_pending(d1, chn1);
-
-    /* Reset binding to vcpu0 when the channel is freed. */
-    chn1->state          = ECS_FREE;
-    chn1->notify_vcpu_id = 0;
-
-    xsm_evtchn_close_post(chn1);
+    free_evtchn(d1, chn1);
 
  out:
     if ( d2 != NULL )