[rtems commit] bsp/irq-server: Use proper chain API

Sebastian Huber sebh at rtems.org
Thu Nov 5 10:31:24 UTC 2015


Module:    rtems
Branch:    master
Commit:    8dbb14d58b36fc37a4f05d11505483d30f9e6a83
Changeset: http://git.rtems.org/rtems/commit/?id=8dbb14d58b36fc37a4f05d11505483d30f9e6a83

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Tue Nov  3 11:14:21 2015 +0100

bsp/irq-server: Use proper chain API

---

 c/src/lib/libbsp/shared/src/irq-server.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/c/src/lib/libbsp/shared/src/irq-server.c b/c/src/lib/libbsp/shared/src/irq-server.c
index 6cf22e1..5e5dbf1 100644
--- a/c/src/lib/libbsp/shared/src/irq-server.c
+++ b/c/src/lib/libbsp/shared/src/irq-server.c
@@ -63,7 +63,7 @@ static void bsp_interrupt_server_trigger(void *arg)
 
   bsp_interrupt_vector_disable(e->vector);
 
-  if (e->node.next == NULL) {
+  if (rtems_chain_is_node_off_chain(&e->node)) {
     rtems_interrupt_lock_context lock_context;
 
     rtems_interrupt_lock_acquire(&bsp_interrupt_server_lock, &lock_context);
@@ -80,13 +80,17 @@ static bsp_interrupt_server_entry *bsp_interrupt_server_get_entry(void)
 {
   rtems_interrupt_lock_context lock_context;
   bsp_interrupt_server_entry *e;
+  rtems_chain_control *chain;
 
   rtems_interrupt_lock_acquire(&bsp_interrupt_server_lock, &lock_context);
+  chain = &bsp_interrupt_server_chain;
 
-  e = (bsp_interrupt_server_entry *)
-    rtems_chain_get_unprotected(&bsp_interrupt_server_chain);
-  if (e != NULL) {
-    e->node.next = NULL;
+  if (!rtems_chain_is_empty(chain)) {
+    e = (bsp_interrupt_server_entry *)
+      rtems_chain_get_first_unprotected(chain);
+    rtems_chain_set_off_chain(&e->node);
+  } else {
+    e = NULL;
   }
 
   rtems_interrupt_lock_release(&bsp_interrupt_server_lock, &lock_context);




More information about the vc mailing list