Commit acecb3ad authored by Alexandre Belloni's avatar Alexandre Belloni

rtc: remove irq_task and irq_task_lock

There is no way to set a periodic task anymore, remove task pointer and
lock.
Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
parent 1560d084
...@@ -172,7 +172,6 @@ static struct rtc_device *rtc_allocate_device(void) ...@@ -172,7 +172,6 @@ static struct rtc_device *rtc_allocate_device(void)
mutex_init(&rtc->ops_lock); mutex_init(&rtc->ops_lock);
spin_lock_init(&rtc->irq_lock); spin_lock_init(&rtc->irq_lock);
spin_lock_init(&rtc->irq_task_lock);
init_waitqueue_head(&rtc->irq_queue); init_waitqueue_head(&rtc->irq_queue);
/* Init timerqueue */ /* Init timerqueue */
......
...@@ -605,12 +605,6 @@ void rtc_handle_legacy_irq(struct rtc_device *rtc, int num, int mode) ...@@ -605,12 +605,6 @@ void rtc_handle_legacy_irq(struct rtc_device *rtc, int num, int mode)
rtc->irq_data = (rtc->irq_data + (num << 8)) | (RTC_IRQF|mode); rtc->irq_data = (rtc->irq_data + (num << 8)) | (RTC_IRQF|mode);
spin_unlock_irqrestore(&rtc->irq_lock, flags); spin_unlock_irqrestore(&rtc->irq_lock, flags);
/* call the task func */
spin_lock_irqsave(&rtc->irq_task_lock, flags);
if (rtc->irq_task)
rtc->irq_task->func(rtc->irq_task->private_data);
spin_unlock_irqrestore(&rtc->irq_task_lock, flags);
wake_up_interruptible(&rtc->irq_queue); wake_up_interruptible(&rtc->irq_queue);
kill_fasync(&rtc->async_queue, SIGIO, POLL_IN); kill_fasync(&rtc->async_queue, SIGIO, POLL_IN);
} }
...@@ -750,28 +744,16 @@ static int rtc_update_hrtimer(struct rtc_device *rtc, int enabled) ...@@ -750,28 +744,16 @@ static int rtc_update_hrtimer(struct rtc_device *rtc, int enabled)
* Context: any * Context: any
* *
* Note that rtc_irq_set_freq() should previously have been used to * Note that rtc_irq_set_freq() should previously have been used to
* specify the desired frequency of periodic IRQ task->func() callbacks. * specify the desired frequency of periodic IRQ.
*/ */
int rtc_irq_set_state(struct rtc_device *rtc, struct rtc_task *task, int enabled) int rtc_irq_set_state(struct rtc_device *rtc, struct rtc_task *task, int enabled)
{ {
int err = 0; int err = 0;
unsigned long flags;
retry: while (rtc_update_hrtimer(rtc, enabled) < 0)
spin_lock_irqsave(&rtc->irq_task_lock, flags); cpu_relax();
if (rtc->irq_task != NULL && task == NULL)
err = -EBUSY; rtc->pie_enabled = enabled;
else if (rtc->irq_task != task)
err = -EACCES;
else {
if (rtc_update_hrtimer(rtc, enabled) < 0) {
spin_unlock_irqrestore(&rtc->irq_task_lock, flags);
cpu_relax();
goto retry;
}
rtc->pie_enabled = enabled;
}
spin_unlock_irqrestore(&rtc->irq_task_lock, flags);
trace_rtc_irq_set_state(enabled, err); trace_rtc_irq_set_state(enabled, err);
return err; return err;
...@@ -782,7 +764,7 @@ EXPORT_SYMBOL_GPL(rtc_irq_set_state); ...@@ -782,7 +764,7 @@ EXPORT_SYMBOL_GPL(rtc_irq_set_state);
* rtc_irq_set_freq - set 2^N Hz periodic IRQ frequency for IRQ * rtc_irq_set_freq - set 2^N Hz periodic IRQ frequency for IRQ
* @rtc: the rtc device * @rtc: the rtc device
* @task: currently registered with rtc_irq_register() * @task: currently registered with rtc_irq_register()
* @freq: positive frequency with which task->func() will be called * @freq: positive frequency
* Context: any * Context: any
* *
* Note that rtc_irq_set_state() is used to enable or disable the * Note that rtc_irq_set_state() is used to enable or disable the
...@@ -791,25 +773,13 @@ EXPORT_SYMBOL_GPL(rtc_irq_set_state); ...@@ -791,25 +773,13 @@ EXPORT_SYMBOL_GPL(rtc_irq_set_state);
int rtc_irq_set_freq(struct rtc_device *rtc, struct rtc_task *task, int freq) int rtc_irq_set_freq(struct rtc_device *rtc, struct rtc_task *task, int freq)
{ {
int err = 0; int err = 0;
unsigned long flags;
if (freq <= 0 || freq > RTC_MAX_FREQ) if (freq <= 0 || freq > RTC_MAX_FREQ)
return -EINVAL; return -EINVAL;
retry:
spin_lock_irqsave(&rtc->irq_task_lock, flags); rtc->irq_freq = freq;
if (rtc->irq_task != NULL && task == NULL) while (rtc->pie_enabled && rtc_update_hrtimer(rtc, 1) < 0)
err = -EBUSY; cpu_relax();
else if (rtc->irq_task != task)
err = -EACCES;
else {
rtc->irq_freq = freq;
if (rtc->pie_enabled && rtc_update_hrtimer(rtc, 1) < 0) {
spin_unlock_irqrestore(&rtc->irq_task_lock, flags);
cpu_relax();
goto retry;
}
}
spin_unlock_irqrestore(&rtc->irq_task_lock, flags);
trace_rtc_irq_set_freq(freq, err); trace_rtc_irq_set_freq(freq, err);
return err; return err;
......
...@@ -121,8 +121,6 @@ struct rtc_device { ...@@ -121,8 +121,6 @@ struct rtc_device {
wait_queue_head_t irq_queue; wait_queue_head_t irq_queue;
struct fasync_struct *async_queue; struct fasync_struct *async_queue;
struct rtc_task *irq_task;
spinlock_t irq_task_lock;
int irq_freq; int irq_freq;
int max_user_freq; int max_user_freq;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment