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

Author: Philippe Gerum <r...@xenomai.org>
Date:   Thu Apr 17 12:37:38 2014 +0200

cobalt/bufd: introduce preemptible_only() predicate

---

 include/cobalt/kernel/assert.h |    1 +
 kernel/cobalt/bufd.c           |    8 ++++----
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/include/cobalt/kernel/assert.h b/include/cobalt/kernel/assert.h
index bf9be27..6a3b642 100644
--- a/include/cobalt/kernel/assert.h
+++ b/include/cobalt/kernel/assert.h
@@ -85,6 +85,7 @@
 #define secondary_mode_only()  XENO_BUGON(CONTEXT, !ipipe_root_p)
 #define interrupt_only()       XENO_BUGON(CONTEXT, !xnsched_interrupt_p())
 #define atomic_only()          XENO_BUGON(CONTEXT, (xnlock_is_owner(&nklock) 
&& hard_irqs_disabled()) == 0)
+#define preemptible_only()     XENO_BUGON(CONTEXT, xnlock_is_owner(&nklock) || 
hard_irqs_disabled())
 #define realtime_cpu_only()    XENO_BUGON(CONTEXT, 
!xnsched_supported_cpu(ipipe_processor_id()))
 
 void __xnsys_assert_failed(const char *file, int line, const char *msg);
diff --git a/kernel/cobalt/bufd.c b/kernel/cobalt/bufd.c
index 78a0b6a..d05b238 100644
--- a/kernel/cobalt/bufd.c
+++ b/kernel/cobalt/bufd.c
@@ -332,7 +332,7 @@ ssize_t xnbufd_copy_to_kmem(void *to, struct xnbufd *bufd, 
size_t len)
         */
        if (xnthread_test_state(xnsched_current_thread(), XNROOT|XNUSER) &&
            !xnsched_interrupt_p() && current->mm == bufd->b_mm) {
-               XENO_BUGON(NUCLEUS, xnlock_is_owner(&nklock) || spltest());
+               preemptible_only();
                if (__xn_safe_copy_from_user(to, (void __user *)from, len))
                        return -EFAULT;
                goto advance_offset;
@@ -438,7 +438,7 @@ ssize_t xnbufd_copy_from_kmem(struct xnbufd *bufd, void 
*from, size_t len)
         */
        if (xnthread_test_state(xnsched_current_thread(), XNROOT|XNUSER) &&
            !xnsched_interrupt_p() && current->mm == bufd->b_mm) {
-               XENO_BUGON(NUCLEUS, xnlock_is_owner(&nklock) || spltest());
+               preemptible_only();
                if (__xn_safe_copy_to_user((void __user *)to, from, len))
                        return -EFAULT;
                goto advance_offset;
@@ -499,7 +499,7 @@ EXPORT_SYMBOL_GPL(xnbufd_copy_from_kmem);
 
 ssize_t xnbufd_unmap_uread(struct xnbufd *bufd)
 {
-       XENO_BUGON(NUCLEUS, xnlock_is_owner(&nklock) || spltest());
+       preemptible_only();
 
 #if XENO_DEBUG(NUCLEUS)
        bufd->b_ptr = (caddr_t)-1;
@@ -541,7 +541,7 @@ ssize_t xnbufd_unmap_uwrite(struct xnbufd *bufd)
        void *from;
        size_t len;
 
-       XENO_BUGON(NUCLEUS, xnlock_is_owner(&nklock) || spltest());
+       preemptible_only();
 
        len = bufd->b_off;
 


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

Reply via email to