Module: xenomai-forge
Branch: next
Commit: 2d9042c298493a2f5b76d1edd5a67f85081cf076
URL:    
http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=2d9042c298493a2f5b76d1edd5a67f85081cf076

Author: Philippe Gerum <r...@xenomai.org>
Date:   Thu Apr 10 11:41:22 2014 +0200

drivers/testing: move to new-style atomic sections

---

 kernel/drivers/testing/timerbench.c |   33 +++++++++++++++------------------
 1 file changed, 15 insertions(+), 18 deletions(-)

diff --git a/kernel/drivers/testing/timerbench.c 
b/kernel/drivers/testing/timerbench.c
index 7d056d4..af75d56 100644
--- a/kernel/drivers/testing/timerbench.c
+++ b/kernel/drivers/testing/timerbench.c
@@ -141,22 +141,19 @@ static void eval_outer_loop(struct rt_tmbench_context 
*ctx)
 static void timer_task_proc(void *arg)
 {
        struct rt_tmbench_context *ctx = arg;
-       int count;
+       int count, err;
+       spl_t s;
 
        /* first event: one millisecond from now. */
        ctx->date = rtdm_clock_read_monotonic() + 1000000;
 
        while (1) {
-               int err;
-
                for (count = 0; count < ctx->samples_per_sec; count++) {
-                       RTDM_EXECUTE_ATOMICALLY(
-                               ctx->start_time = rtdm_clock_read_monotonic();
-                               err =
-                                   rtdm_task_sleep_abs(ctx->date,
-                                                       
RTDM_TIMERMODE_ABSOLUTE);
-                       );
-
+                       cobalt_atomic_enter(s);
+                       ctx->start_time = rtdm_clock_read_monotonic();
+                       err = rtdm_task_sleep_abs(ctx->date,
+                                                 RTDM_TIMERMODE_ABSOLUTE);
+                       cobalt_atomic_leave(s);
                        if (err)
                                return;
 
@@ -237,6 +234,7 @@ static int rt_tmbench_start(struct rtdm_dev_context 
*context,
                            struct rttst_tmbench_config __user *user_config)
 {
        int err = 0;
+       spl_t s;
 
        struct rttst_tmbench_config config_buf;
        struct rttst_tmbench_config *config =
@@ -311,16 +309,15 @@ static int rt_tmbench_start(struct rtdm_dev_context 
*context,
                if (!test_bit(RTDM_CLOSING, &context->context_flags)) {
                        ctx->mode = RTTST_TMBENCH_HANDLER;
 
-                       RTDM_EXECUTE_ATOMICALLY(
-                               ctx->start_time = rtdm_clock_read_monotonic();
+                       cobalt_atomic_enter(s);
+                       ctx->start_time = rtdm_clock_read_monotonic();
 
-                               /* first event: one millisecond from now. */
-                               ctx->date = ctx->start_time + 1000000;
+                       /* first event: one millisecond from now. */
+                       ctx->date = ctx->start_time + 1000000;
 
-                               err =
-                                   rtdm_timer_start(&ctx->timer, ctx->date, 0,
-                                                    RTDM_TIMERMODE_ABSOLUTE);
-                       );
+                       err = rtdm_timer_start(&ctx->timer, ctx->date, 0,
+                                              RTDM_TIMERMODE_ABSOLUTE);
+                       cobalt_atomic_leave(s);
                }
        }
 


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
http://www.xenomai.org/mailman/listinfo/xenomai-git

Reply via email to