Module: xenomai-rpm
Branch: for-upstream
Commit: 899cc5f1e76e85f913110d63bc0fded190958ab0
URL:    
http://git.xenomai.org/?p=xenomai-rpm.git;a=commit;h=899cc5f1e76e85f913110d63bc0fded190958ab0

Author: Philippe Gerum <r...@xenomai.org>
Date:   Thu Feb  3 12:00:11 2011 +0100

wrappers: introduce generic chip handler accessors for 
GENERIC_HARDIRQS-compliant kernels

---

 include/asm-arm/wrappers.h      |    4 +++-
 include/asm-blackfin/wrappers.h |    4 +++-
 include/asm-generic/wrappers.h  |   30 ++++++++++++++++++++++++++++++
 include/asm-nios2/wrappers.h    |    4 +++-
 include/asm-powerpc/wrappers.h  |    2 ++
 include/asm-x86/wrappers_32.h   |    2 ++
 include/asm-x86/wrappers_64.h   |    2 ++
 7 files changed, 45 insertions(+), 3 deletions(-)

diff --git a/include/asm-arm/wrappers.h b/include/asm-arm/wrappers.h
index 97e6724..321c207 100644
--- a/include/asm-arm/wrappers.h
+++ b/include/asm-arm/wrappers.h
@@ -65,9 +65,11 @@ typedef irqreturn_t (*rthal_irq_host_handler_t)(int irq,
 
 extern void (*fp_init)(union fp_state *);
 #else /* >= 2.6.19 */
-#define rthal_irq_desc_lock(irq) (&rthal_irq_descp(irq)->lock)
+#ifndef CONFIG_GENERIC_HARDIRQS
 #define rthal_irq_chip_enable(irq)   ({ 
rthal_irq_descp(irq)->chip->unmask(irq); 0; })
 #define rthal_irq_chip_disable(irq)  ({ rthal_irq_descp(irq)->chip->mask(irq); 
0; })
+#endif
+#define rthal_irq_desc_lock(irq) (&rthal_irq_descp(irq)->lock)
 #define rthal_irq_chip_end(irq)      ({ rthal_irq_descp(irq)->ipipe_end(irq, 
rthal_irq_descp(irq)); 0; })
 typedef irq_handler_t rthal_irq_host_handler_t;
 #define rthal_mark_irq_disabled(irq) do {              \
diff --git a/include/asm-blackfin/wrappers.h b/include/asm-blackfin/wrappers.h
index 4573f52..ccfc3fc 100644
--- a/include/asm-blackfin/wrappers.h
+++ b/include/asm-blackfin/wrappers.h
@@ -35,9 +35,11 @@
 
 #define wrap_strncpy_from_user(dstP, srcP, n)  strncpy_from_user(dstP, srcP, n)
 
-#define rthal_irq_desc_status(irq)     (rthal_irq_descp(irq)->status)
+#ifndef CONFIG_GENERIC_HARDIRQS
 #define rthal_irq_chip_enable(irq)     ({ 
rthal_irq_descp(irq)->chip->enable(irq); 0; })
 #define rthal_irq_chip_disable(irq)    ({ 
rthal_irq_descp(irq)->chip->disable(irq); 0; })
+#endif
+#define rthal_irq_desc_status(irq)     (rthal_irq_descp(irq)->status)
 #define rthal_irq_chip_end(irq)                ({ 
rthal_irq_descp(irq)->ipipe_end(irq, rthal_irq_descp(irq)); 0; })
 
 typedef irq_handler_t rthal_irq_host_handler_t;
diff --git a/include/asm-generic/wrappers.h b/include/asm-generic/wrappers.h
index 81c722c..69ec0e5 100644
--- a/include/asm-generic/wrappers.h
+++ b/include/asm-generic/wrappers.h
@@ -610,4 +610,34 @@ static inline void wrap_proc_dir_entry_owner(struct 
proc_dir_entry *entry)
 #define init_MUTEX(sem)           sema_init((sem), 1)
 #endif
 
+#ifdef CONFIG_GENERIC_HARDIRQS
+/*
+ * The irq chip descriptor has been heavily revamped in
+ * 2.6.37. Provide generic accessors to the chip handlers we need for
+ * kernels implementing those changes.
+ */
+#define rthal_irq_chip_enable(irq)                                     \
+       ({                                                              \
+               struct irq_desc *desc = rthal_irq_descp(irq);           \
+               struct irq_chip *chip = desc->chip;                     \
+               int __ret__ = 0;                                        \
+               if (unlikely(chip->irq_unmask == NULL))                 \
+                       __ret__ = -ENODEV;                              \
+               else                                                    \
+                       chip->irq_unmask(&desc->irq_data);              \
+               __ret__;                                                \
+       })
+#define rthal_irq_chip_disable(irq)                                    \
+       ({                                                              \
+               struct irq_desc *desc = rthal_irq_descp(irq);           \
+               struct irq_chip *chip = desc->chip;                     \
+               int __ret__ = 0;                                        \
+               if (unlikely(chip->irq_mask == NULL))                   \
+                       __ret__ = -ENODEV;                              \
+               else                                                    \
+                       chip->irq_mask(&desc->irq_data);                \
+               __ret__;                                                \
+       })
+#endif
+
 #endif /* _XENO_ASM_GENERIC_WRAPPERS_H */
diff --git a/include/asm-nios2/wrappers.h b/include/asm-nios2/wrappers.h
index c15ab35..5216a21 100644
--- a/include/asm-nios2/wrappers.h
+++ b/include/asm-nios2/wrappers.h
@@ -31,9 +31,11 @@
 
 #define wrap_strncpy_from_user(dstP, srcP, n)  strncpy_from_user(dstP, srcP, n)
 
-#define rthal_irq_desc_status(irq)     (rthal_irq_descp(irq)->status)
+#ifndef CONFIG_GENERIC_HARDIRQS
 #define rthal_irq_chip_enable(irq)     ({ 
rthal_irq_descp(irq)->chip->enable(irq); 0; })
 #define rthal_irq_chip_disable(irq)    ({ 
rthal_irq_descp(irq)->chip->disable(irq); 0; })
+#endif
+#define rthal_irq_desc_status(irq)     (rthal_irq_descp(irq)->status)
 #define rthal_irq_chip_end(irq)                ({ 
rthal_irq_descp(irq)->ipipe_end(irq, rthal_irq_descp(irq)); 0; })
 
 typedef irq_handler_t rthal_irq_host_handler_t;
diff --git a/include/asm-powerpc/wrappers.h b/include/asm-powerpc/wrappers.h
index fb49307..32dea29 100644
--- a/include/asm-powerpc/wrappers.h
+++ b/include/asm-powerpc/wrappers.h
@@ -166,6 +166,7 @@ typedef irq_handler_t rthal_irq_host_handler_t;
                __err__;                                                        
\
        })
 #else /* > 2.6.19 */
+#ifndef CONFIG_GENERIC_HARDIRQS
 #define rthal_irq_chip_enable(irq)                                     \
        ({                                                              \
                int __err__ = 0;                                        \
@@ -184,6 +185,7 @@ typedef irq_handler_t rthal_irq_host_handler_t;
                        rthal_irq_handlerp(irq)->mask(irq);             \
                __err__;                                                \
        })
+#endif
 #define rthal_irq_chip_end(irq)      ({ rthal_irq_descp(irq)->ipipe_end(irq, 
rthal_irq_descp(irq)); 0; })
 #endif
 
diff --git a/include/asm-x86/wrappers_32.h b/include/asm-x86/wrappers_32.h
index 5f37766..ff8d461 100644
--- a/include/asm-x86/wrappers_32.h
+++ b/include/asm-x86/wrappers_32.h
@@ -182,8 +182,10 @@ typedef irqreturn_t (*rthal_irq_host_handler_t)(int irq,
 
 #define rthal_irq_chip_end(irq)        rthal_irq_chip_enable(irq)
 #else /* >= 2.6.19 */
+#ifndef CONFIG_GENERIC_HARDIRQS
 #define rthal_irq_chip_enable(irq)   ({ 
rthal_irq_descp(irq)->chip->unmask(irq); 0; })
 #define rthal_irq_chip_disable(irq)  ({ rthal_irq_descp(irq)->chip->mask(irq); 
0; })
+#endif
 #define rthal_irq_chip_end(irq)      ({ rthal_irq_descp(irq)->ipipe_end(irq, 
rthal_irq_descp(irq)); 0; })
 typedef irq_handler_t rthal_irq_host_handler_t;
 
diff --git a/include/asm-x86/wrappers_64.h b/include/asm-x86/wrappers_64.h
index 0d04b9c..9d16455 100644
--- a/include/asm-x86/wrappers_64.h
+++ b/include/asm-x86/wrappers_64.h
@@ -34,8 +34,10 @@
 
 #define rthal_irq_desc_status(irq)     (rthal_irq_descp(irq)->status)
 
+#ifndef CONFIG_GENERIC_HARDIRQS
 #define rthal_irq_chip_enable(irq)   ({ 
rthal_irq_descp(irq)->chip->unmask(irq); 0; })
 #define rthal_irq_chip_disable(irq)  ({ rthal_irq_descp(irq)->chip->mask(irq); 
0; })
+#endif
 #define rthal_irq_chip_end(irq)      ({ rthal_irq_descp(irq)->ipipe_end(irq, 
rthal_irq_descp(irq)); 0; })
 
 typedef irq_handler_t rthal_irq_host_handler_t;


_______________________________________________
Xenomai-git mailing list
Xenomai-git@gna.org
https://mail.gna.org/listinfo/xenomai-git

Reply via email to