From 7ae81734495210c611c8d1f54b2d8b3d33357980 Mon Sep 17 00:00:00 2001 From: Jussi Kivilinna Date: Wed, 24 May 2017 07:13:32 -0600 Subject: [PATCH] button_upper: fix interrupt enabling for poll-events --- drivers/input/button_upper.c | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/drivers/input/button_upper.c b/drivers/input/button_upper.c index 12f2896cf5..93b54454e0 100644 --- a/drivers/input/button_upper.c +++ b/drivers/input/button_upper.c @@ -202,9 +202,6 @@ static void btn_enable(FAR struct btn_upperhalf_s *priv) btn_buttonset_t press; btn_buttonset_t release; irqstate_t flags; -#ifndef CONFIG_DISABLE_POLL - int i; -#endif DEBUGASSERT(priv && priv->bu_lower); lower = priv->bu_lower; @@ -223,19 +220,10 @@ static void btn_enable(FAR struct btn_upperhalf_s *priv) for (opriv = priv->bu_open; opriv; opriv = opriv->bo_flink) { #ifndef CONFIG_DISABLE_POLL - /* Are there any poll waiters? */ + /* OR in the poll event buttons */ - for (i = 0; i < CONFIG_BUTTONS_NPOLLWAITERS; i++) - { - if (opriv->bo_fds[i]) - { - /* Yes.. OR in the poll event buttons */ - - press |= opriv->bo_pollevents.bp_press; - release |= opriv->bo_pollevents.bp_release; - break; - } - } + press |= opriv->bo_pollevents.bp_press; + release |= opriv->bo_pollevents.bp_release; #endif #ifndef CONFIG_DISABLE_SIGNALS @@ -448,6 +436,10 @@ static int btn_open(FAR struct file *filep) filep->f_priv = (FAR void *)opriv; ret = OK; + /* Enable/disable interrupt handling */ + + btn_enable(priv); + errout_with_sem: btn_givesem(&priv->bu_exclsem); return ret;