static int uio_dmem_genirq_irqcontrol()

in uio_dmem_genirq.c [119:144]


static int uio_dmem_genirq_irqcontrol(struct uio_info *dev_info, s32 irq_on)
{
	struct uio_dmem_genirq_platdata *priv = dev_info->priv;
	unsigned long flags;

	/* Allow user space to enable and disable the interrupt
	 * in the interrupt controller, but keep track of the
	 * state to prevent per-irq depth damage.
	 *
	 * Serialize this operation to support multiple tasks.
	 */

	spin_lock_irqsave(&priv->lock, flags);
	if (irq_on) {
		if (test_and_clear_bit(0, &priv->flags))
			enable_irq(dev_info->irq);
		spin_unlock_irqrestore(&priv->lock, flags);
	} else {
		if (!test_and_set_bit(0, &priv->flags)) {
			spin_unlock_irqrestore(&priv->lock, flags);
			disable_irq(dev_info->irq);
		}
	}

	return 0;
}