[Xenomai-git] Philippe Gerum : cobalt/intr: calling xnintr_detach() may lead to nop
Module: xenomai-forge Branch: master Commit: c85970b99e249cf0616be93a947a4ca855ab55ce URL: http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=c85970b99e249cf0616be93a947a4ca855ab55ce Author: Philippe Gerum Date: Thu Aug 1 14:29:15 2013 +0200 cobalt/intr: calling xnintr_detach() may lead to nop --- include/cobalt/kernel/intr.h |4 +- include/rtdm/rtdm_driver.h |3 +- kernel/cobalt/intr.c | 55 +++-- 3 files changed, 19 insertions(+), 43 deletions(-) diff --git a/include/cobalt/kernel/intr.h b/include/cobalt/kernel/intr.h index 835f7fd..7c29b97 100644 --- a/include/cobalt/kernel/intr.h +++ b/include/cobalt/kernel/intr.h @@ -117,12 +117,12 @@ int xnintr_init(xnintr_t *intr, xniack_t iack, int flags); -int xnintr_destroy(xnintr_t *intr); +void xnintr_destroy(xnintr_t *intr); int xnintr_attach(xnintr_t *intr, void *cookie); -int xnintr_detach(xnintr_t *intr); +void xnintr_detach(xnintr_t *intr); void xnintr_enable(xnintr_t *intr); diff --git a/include/rtdm/rtdm_driver.h b/include/rtdm/rtdm_driver.h index 61706a8..801dbdd 100644 --- a/include/rtdm/rtdm_driver.h +++ b/include/rtdm/rtdm_driver.h @@ -924,7 +924,8 @@ int rtdm_irq_request(rtdm_irq_t *irq_handle, unsigned int irq_no, static inline int rtdm_irq_free(rtdm_irq_t *irq_handle) { XENO_ASSERT(RTDM, xnsched_root_p(), return -EPERM;); - return xnintr_detach(irq_handle); + xnintr_detach(irq_handle); + return 0; } static inline int rtdm_irq_enable(rtdm_irq_t *irq_handle) diff --git a/kernel/cobalt/intr.c b/kernel/cobalt/intr.c index a57c1e6..6973a46 100644 --- a/kernel/cobalt/intr.c +++ b/kernel/cobalt/intr.c @@ -646,9 +646,9 @@ int xnintr_init(xnintr_t *intr, const char *name, } EXPORT_SYMBOL_GPL(xnintr_init); -/*! - * \fn int xnintr_destroy (xnintr_t *intr) - * \brief Destroy an interrupt object. +/** + * @fn void xnintr_destroy(xnintr_t *intr) + * @brief Destroy an interrupt object. * * Destroys an interrupt object previously initialized by * xnintr_init(). The interrupt object is automatically detached by a @@ -658,10 +658,6 @@ EXPORT_SYMBOL_GPL(xnintr_init); * @param intr The descriptor address of the interrupt object to * destroy. * - * @return 0 is returned on success. Otherwise, -EINVAL is returned if - * an error occurred while detaching the interrupt (see - * xnintr_detach()). - * * Environments: * * This service can be called from: @@ -671,20 +667,11 @@ EXPORT_SYMBOL_GPL(xnintr_init); * * Rescheduling: never. */ - -int xnintr_destroy(xnintr_t *intr) +void xnintr_destroy(xnintr_t *intr) { - int ret; - XENO_BUGON(NUCLEUS, !ipipe_root_p); - - ret = xnintr_detach(intr); - if (ret) - return ret; - + xnintr_detach(intr); free_percpu(intr->stats); - - return 0; } EXPORT_SYMBOL_GPL(xnintr_destroy); @@ -762,9 +749,9 @@ out: } EXPORT_SYMBOL_GPL(xnintr_attach); -/*! - * \fn int xnintr_detach (xnintr_t *intr) - * \brief Detach an interrupt object. +/** + * @fn int xnintr_detach(xnintr_t *intr) + * @brief Detach an interrupt object. * * Detach an interrupt object previously attached by * xnintr_attach(). After this operation is completed, no more IRQs @@ -775,14 +762,8 @@ EXPORT_SYMBOL_GPL(xnintr_attach); * @param intr The descriptor address of the interrupt object to * detach. * - * @return 0 is returned on success. Otherwise: - * - * - -EINVAL is returned if a low-level error occurred while detaching - * the interrupt, or if the interrupt object was not attached. In both - * cases, no action is performed. - * - * @note The caller must not hold nklock when invoking this service, - * this would cause deadlocks. + * @note The caller must not hold nklock when invoking this + * service, this would cause deadlocks. * * Environments: * @@ -793,27 +774,21 @@ EXPORT_SYMBOL_GPL(xnintr_attach); * * Rescheduling: never. */ -int xnintr_detach(xnintr_t *intr) +void xnintr_detach(xnintr_t *intr) { - int ret; spl_t s; trace_mark(xn_nucleus, irq_detach, "irq %u", intr->irq); xnlock_get_irqsave(&intrlock, s); - if ((intr->flags & XN_ISR_ATTACHED) == 0) { - ret = -EINVAL; - goto out; + if (intr->flags & XN_ISR_ATTACHED) { + intr->flags &= ~XN_ISR_ATTACHED; + xnintr_irq_detach(intr); + stat_counter_dec(); } - intr->flags &= ~XN_ISR_ATTACHED; - xnintr_irq_detach(intr); - stat_counter_dec(); -out: xnlock_put_irqrestore(&intrlock, s); - - return ret; } EXPORT_SYMBOL_GPL(xnintr_detach); ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://www.xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Philippe Gerum : cobalt/intr: calling xnintr_detach() may lead to nop
Module: xenomai-forge Branch: next Commit: c85970b99e249cf0616be93a947a4ca855ab55ce URL: http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=c85970b99e249cf0616be93a947a4ca855ab55ce Author: Philippe Gerum Date: Thu Aug 1 14:29:15 2013 +0200 cobalt/intr: calling xnintr_detach() may lead to nop --- include/cobalt/kernel/intr.h |4 +- include/rtdm/rtdm_driver.h |3 +- kernel/cobalt/intr.c | 55 +++-- 3 files changed, 19 insertions(+), 43 deletions(-) diff --git a/include/cobalt/kernel/intr.h b/include/cobalt/kernel/intr.h index 835f7fd..7c29b97 100644 --- a/include/cobalt/kernel/intr.h +++ b/include/cobalt/kernel/intr.h @@ -117,12 +117,12 @@ int xnintr_init(xnintr_t *intr, xniack_t iack, int flags); -int xnintr_destroy(xnintr_t *intr); +void xnintr_destroy(xnintr_t *intr); int xnintr_attach(xnintr_t *intr, void *cookie); -int xnintr_detach(xnintr_t *intr); +void xnintr_detach(xnintr_t *intr); void xnintr_enable(xnintr_t *intr); diff --git a/include/rtdm/rtdm_driver.h b/include/rtdm/rtdm_driver.h index 61706a8..801dbdd 100644 --- a/include/rtdm/rtdm_driver.h +++ b/include/rtdm/rtdm_driver.h @@ -924,7 +924,8 @@ int rtdm_irq_request(rtdm_irq_t *irq_handle, unsigned int irq_no, static inline int rtdm_irq_free(rtdm_irq_t *irq_handle) { XENO_ASSERT(RTDM, xnsched_root_p(), return -EPERM;); - return xnintr_detach(irq_handle); + xnintr_detach(irq_handle); + return 0; } static inline int rtdm_irq_enable(rtdm_irq_t *irq_handle) diff --git a/kernel/cobalt/intr.c b/kernel/cobalt/intr.c index a57c1e6..6973a46 100644 --- a/kernel/cobalt/intr.c +++ b/kernel/cobalt/intr.c @@ -646,9 +646,9 @@ int xnintr_init(xnintr_t *intr, const char *name, } EXPORT_SYMBOL_GPL(xnintr_init); -/*! - * \fn int xnintr_destroy (xnintr_t *intr) - * \brief Destroy an interrupt object. +/** + * @fn void xnintr_destroy(xnintr_t *intr) + * @brief Destroy an interrupt object. * * Destroys an interrupt object previously initialized by * xnintr_init(). The interrupt object is automatically detached by a @@ -658,10 +658,6 @@ EXPORT_SYMBOL_GPL(xnintr_init); * @param intr The descriptor address of the interrupt object to * destroy. * - * @return 0 is returned on success. Otherwise, -EINVAL is returned if - * an error occurred while detaching the interrupt (see - * xnintr_detach()). - * * Environments: * * This service can be called from: @@ -671,20 +667,11 @@ EXPORT_SYMBOL_GPL(xnintr_init); * * Rescheduling: never. */ - -int xnintr_destroy(xnintr_t *intr) +void xnintr_destroy(xnintr_t *intr) { - int ret; - XENO_BUGON(NUCLEUS, !ipipe_root_p); - - ret = xnintr_detach(intr); - if (ret) - return ret; - + xnintr_detach(intr); free_percpu(intr->stats); - - return 0; } EXPORT_SYMBOL_GPL(xnintr_destroy); @@ -762,9 +749,9 @@ out: } EXPORT_SYMBOL_GPL(xnintr_attach); -/*! - * \fn int xnintr_detach (xnintr_t *intr) - * \brief Detach an interrupt object. +/** + * @fn int xnintr_detach(xnintr_t *intr) + * @brief Detach an interrupt object. * * Detach an interrupt object previously attached by * xnintr_attach(). After this operation is completed, no more IRQs @@ -775,14 +762,8 @@ EXPORT_SYMBOL_GPL(xnintr_attach); * @param intr The descriptor address of the interrupt object to * detach. * - * @return 0 is returned on success. Otherwise: - * - * - -EINVAL is returned if a low-level error occurred while detaching - * the interrupt, or if the interrupt object was not attached. In both - * cases, no action is performed. - * - * @note The caller must not hold nklock when invoking this service, - * this would cause deadlocks. + * @note The caller must not hold nklock when invoking this + * service, this would cause deadlocks. * * Environments: * @@ -793,27 +774,21 @@ EXPORT_SYMBOL_GPL(xnintr_attach); * * Rescheduling: never. */ -int xnintr_detach(xnintr_t *intr) +void xnintr_detach(xnintr_t *intr) { - int ret; spl_t s; trace_mark(xn_nucleus, irq_detach, "irq %u", intr->irq); xnlock_get_irqsave(&intrlock, s); - if ((intr->flags & XN_ISR_ATTACHED) == 0) { - ret = -EINVAL; - goto out; + if (intr->flags & XN_ISR_ATTACHED) { + intr->flags &= ~XN_ISR_ATTACHED; + xnintr_irq_detach(intr); + stat_counter_dec(); } - intr->flags &= ~XN_ISR_ATTACHED; - xnintr_irq_detach(intr); - stat_counter_dec(); -out: xnlock_put_irqrestore(&intrlock, s); - - return ret; } EXPORT_SYMBOL_GPL(xnintr_detach); ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://www.xenomai.org/mailman/listinfo/xenomai-git
[Xenomai-git] Philippe Gerum : cobalt/intr: calling xnintr_detach() may lead to nop
Module: xenomai-forge Branch: next Commit: ca4d5a53531cf454bda997fb8c1a16e53f994019 URL: http://git.xenomai.org/?p=xenomai-forge.git;a=commit;h=ca4d5a53531cf454bda997fb8c1a16e53f994019 Author: Philippe Gerum Date: Thu Aug 1 14:29:15 2013 +0200 cobalt/intr: calling xnintr_detach() may lead to nop --- include/cobalt/kernel/intr.h |4 +- include/rtdm/rtdm_driver.h |3 +- kernel/cobalt/intr.c | 55 +++-- 3 files changed, 19 insertions(+), 43 deletions(-) diff --git a/include/cobalt/kernel/intr.h b/include/cobalt/kernel/intr.h index 835f7fd..7c29b97 100644 --- a/include/cobalt/kernel/intr.h +++ b/include/cobalt/kernel/intr.h @@ -117,12 +117,12 @@ int xnintr_init(xnintr_t *intr, xniack_t iack, int flags); -int xnintr_destroy(xnintr_t *intr); +void xnintr_destroy(xnintr_t *intr); int xnintr_attach(xnintr_t *intr, void *cookie); -int xnintr_detach(xnintr_t *intr); +void xnintr_detach(xnintr_t *intr); void xnintr_enable(xnintr_t *intr); diff --git a/include/rtdm/rtdm_driver.h b/include/rtdm/rtdm_driver.h index 61706a8..801dbdd 100644 --- a/include/rtdm/rtdm_driver.h +++ b/include/rtdm/rtdm_driver.h @@ -924,7 +924,8 @@ int rtdm_irq_request(rtdm_irq_t *irq_handle, unsigned int irq_no, static inline int rtdm_irq_free(rtdm_irq_t *irq_handle) { XENO_ASSERT(RTDM, xnsched_root_p(), return -EPERM;); - return xnintr_detach(irq_handle); + xnintr_detach(irq_handle); + return 0; } static inline int rtdm_irq_enable(rtdm_irq_t *irq_handle) diff --git a/kernel/cobalt/intr.c b/kernel/cobalt/intr.c index a57c1e6..6973a46 100644 --- a/kernel/cobalt/intr.c +++ b/kernel/cobalt/intr.c @@ -646,9 +646,9 @@ int xnintr_init(xnintr_t *intr, const char *name, } EXPORT_SYMBOL_GPL(xnintr_init); -/*! - * \fn int xnintr_destroy (xnintr_t *intr) - * \brief Destroy an interrupt object. +/** + * @fn void xnintr_destroy(xnintr_t *intr) + * @brief Destroy an interrupt object. * * Destroys an interrupt object previously initialized by * xnintr_init(). The interrupt object is automatically detached by a @@ -658,10 +658,6 @@ EXPORT_SYMBOL_GPL(xnintr_init); * @param intr The descriptor address of the interrupt object to * destroy. * - * @return 0 is returned on success. Otherwise, -EINVAL is returned if - * an error occurred while detaching the interrupt (see - * xnintr_detach()). - * * Environments: * * This service can be called from: @@ -671,20 +667,11 @@ EXPORT_SYMBOL_GPL(xnintr_init); * * Rescheduling: never. */ - -int xnintr_destroy(xnintr_t *intr) +void xnintr_destroy(xnintr_t *intr) { - int ret; - XENO_BUGON(NUCLEUS, !ipipe_root_p); - - ret = xnintr_detach(intr); - if (ret) - return ret; - + xnintr_detach(intr); free_percpu(intr->stats); - - return 0; } EXPORT_SYMBOL_GPL(xnintr_destroy); @@ -762,9 +749,9 @@ out: } EXPORT_SYMBOL_GPL(xnintr_attach); -/*! - * \fn int xnintr_detach (xnintr_t *intr) - * \brief Detach an interrupt object. +/** + * @fn int xnintr_detach(xnintr_t *intr) + * @brief Detach an interrupt object. * * Detach an interrupt object previously attached by * xnintr_attach(). After this operation is completed, no more IRQs @@ -775,14 +762,8 @@ EXPORT_SYMBOL_GPL(xnintr_attach); * @param intr The descriptor address of the interrupt object to * detach. * - * @return 0 is returned on success. Otherwise: - * - * - -EINVAL is returned if a low-level error occurred while detaching - * the interrupt, or if the interrupt object was not attached. In both - * cases, no action is performed. - * - * @note The caller must not hold nklock when invoking this service, - * this would cause deadlocks. + * @note The caller must not hold nklock when invoking this + * service, this would cause deadlocks. * * Environments: * @@ -793,27 +774,21 @@ EXPORT_SYMBOL_GPL(xnintr_attach); * * Rescheduling: never. */ -int xnintr_detach(xnintr_t *intr) +void xnintr_detach(xnintr_t *intr) { - int ret; spl_t s; trace_mark(xn_nucleus, irq_detach, "irq %u", intr->irq); xnlock_get_irqsave(&intrlock, s); - if ((intr->flags & XN_ISR_ATTACHED) == 0) { - ret = -EINVAL; - goto out; + if (intr->flags & XN_ISR_ATTACHED) { + intr->flags &= ~XN_ISR_ATTACHED; + xnintr_irq_detach(intr); + stat_counter_dec(); } - intr->flags &= ~XN_ISR_ATTACHED; - xnintr_irq_detach(intr); - stat_counter_dec(); -out: xnlock_put_irqrestore(&intrlock, s); - - return ret; } EXPORT_SYMBOL_GPL(xnintr_detach); ___ Xenomai-git mailing list Xenomai-git@xenomai.org http://www.xenomai.org/mailman/listinfo/xenomai-git