button_upper: fix interrupt enabling for poll-events

This commit is contained in:
Jussi Kivilinna 2017-05-24 07:13:32 -06:00 committed by Gregory Nutt
parent dac08c8372
commit 7ae8173449

View File

@ -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? */
for (i = 0; i < CONFIG_BUTTONS_NPOLLWAITERS; i++)
{
if (opriv->bo_fds[i])
{
/* Yes.. OR in the poll event buttons */
/* OR in the poll event buttons */
press |= opriv->bo_pollevents.bp_press;
release |= opriv->bo_pollevents.bp_release;
break;
}
}
#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;