Small logic change after ike's discussion; clear_irq clears the FLAGGED bit first, then decides later if it should be re-set.