title: Linux: Disabling interrupt from interrupt handler
body: <p>I am writing a Linux device driver which needs to wait for an interrupt (triggered by changes in a GPIO line), and, once the interrupt happens, disable the interrupt until certain conditions are met.</p>
  
  <p>I have tried calling <code>disable_irq_nosync</code> from the handler. Later, when I want to process this interrupt again, I would call <code>enable_irq</code> to reenable it. However I have found that if the GPIO changes while the interrupt is disabled, this seem to be internally detected by the kernel and would result in the interrupt firing immediately as soon as I call <code>enable_irq</code>.</p>
  
  <p>Why is this happening, and how can I avoid it?</p>