/* Note that rtc_irq_set_freq() should previously have been used to specify the desired frequency of periodic IRQ task->func() callbacks.  */
int rtc_irq_set_state(struct rtc_device *rtc, struct rtc_task *task, int enabled)
/* Note that rtc_irq_set_freq() should previously have been used to specify the desired frequency of periodic IRQ task->func() callbacks.  */
int rtc_irq_set_state(struct rtc_device *rtc, struct rtc_task *task, int enabled)
{
	int err = 0;
	unsigned long flags;
	if (rtc->ops->irq_set_state == NULL)
		return -ENXIO;
	spin_lock_irqsave(&rtc->irq_task_lock, flags);
	if (rtc->irq_task != NULL && task == NULL)
		err = -EBUSY;
	if (rtc->irq_task != task)
		err = -EACCES;
	spin_unlock_irqrestore(&rtc->irq_task_lock, flags);
	if (err == 0)
		err = rtc->ops->irq_set_state(rtc->dev.parent, enabled);
	return err;
}