aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandre Belloni <alexandre.belloni@bootlin.com>2018-07-25 08:58:10 -0400
committerAlexandre Belloni <alexandre.belloni@bootlin.com>2018-07-26 09:08:53 -0400
commitacecb3ad8b21a519ce4ad728106d45d4e978bb56 (patch)
treefe275bcd4dd62c55faead9de0973a46e3656ac5a
parent1560d0848a1a84db6c1d9b17c14273c0dae41828 (diff)
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: Alexandre Belloni <alexandre.belloni@bootlin.com>
-rw-r--r--drivers/rtc/class.c1
-rw-r--r--drivers/rtc/interface.c50
-rw-r--r--include/linux/rtc.h2
3 files changed, 10 insertions, 43 deletions
diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c
index 7fa32c922617..0fca4d74c76b 100644
--- a/drivers/rtc/class.c
+++ b/drivers/rtc/class.c
@@ -172,7 +172,6 @@ static struct rtc_device *rtc_allocate_device(void)
172 172
173 mutex_init(&rtc->ops_lock); 173 mutex_init(&rtc->ops_lock);
174 spin_lock_init(&rtc->irq_lock); 174 spin_lock_init(&rtc->irq_lock);
175 spin_lock_init(&rtc->irq_task_lock);
176 init_waitqueue_head(&rtc->irq_queue); 175 init_waitqueue_head(&rtc->irq_queue);
177 176
178 /* Init timerqueue */ 177 /* Init timerqueue */
diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c
index 2b1b9a0b9f8a..ae0d67610c7b 100644
--- a/drivers/rtc/interface.c
+++ b/drivers/rtc/interface.c
@@ -605,12 +605,6 @@ void rtc_handle_legacy_irq(struct rtc_device *rtc, int num, int mode)
605 rtc->irq_data = (rtc->irq_data + (num << 8)) | (RTC_IRQF|mode); 605 rtc->irq_data = (rtc->irq_data + (num << 8)) | (RTC_IRQF|mode);
606 spin_unlock_irqrestore(&rtc->irq_lock, flags); 606 spin_unlock_irqrestore(&rtc->irq_lock, flags);
607 607
608 /* call the task func */
609 spin_lock_irqsave(&rtc->irq_task_lock, flags);
610 if (rtc->irq_task)
611 rtc->irq_task->func(rtc->irq_task->private_data);
612 spin_unlock_irqrestore(&rtc->irq_task_lock, flags);
613
614 wake_up_interruptible(&rtc->irq_queue); 608 wake_up_interruptible(&rtc->irq_queue);
615 kill_fasync(&rtc->async_queue, SIGIO, POLL_IN); 609 kill_fasync(&rtc->async_queue, SIGIO, POLL_IN);
616} 610}
@@ -750,28 +744,16 @@ static int rtc_update_hrtimer(struct rtc_device *rtc, int enabled)
750 * Context: any 744 * Context: any
751 * 745 *
752 * Note that rtc_irq_set_freq() should previously have been used to 746 * Note that rtc_irq_set_freq() should previously have been used to
753 * specify the desired frequency of periodic IRQ task->func() callbacks. 747 * specify the desired frequency of periodic IRQ.
754 */ 748 */
755int rtc_irq_set_state(struct rtc_device *rtc, struct rtc_task *task, int enabled) 749int rtc_irq_set_state(struct rtc_device *rtc, struct rtc_task *task, int enabled)
756{ 750{
757 int err = 0; 751 int err = 0;
758 unsigned long flags;
759 752
760retry: 753 while (rtc_update_hrtimer(rtc, enabled) < 0)
761 spin_lock_irqsave(&rtc->irq_task_lock, flags); 754 cpu_relax();
762 if (rtc->irq_task != NULL && task == NULL) 755
763 err = -EBUSY; 756 rtc->pie_enabled = enabled;
764 else if (rtc->irq_task != task)
765 err = -EACCES;
766 else {
767 if (rtc_update_hrtimer(rtc, enabled) < 0) {
768 spin_unlock_irqrestore(&rtc->irq_task_lock, flags);
769 cpu_relax();
770 goto retry;
771 }
772 rtc->pie_enabled = enabled;
773 }
774 spin_unlock_irqrestore(&rtc->irq_task_lock, flags);
775 757
776 trace_rtc_irq_set_state(enabled, err); 758 trace_rtc_irq_set_state(enabled, err);
777 return err; 759 return err;
@@ -782,7 +764,7 @@ EXPORT_SYMBOL_GPL(rtc_irq_set_state);
782 * rtc_irq_set_freq - set 2^N Hz periodic IRQ frequency for IRQ 764 * rtc_irq_set_freq - set 2^N Hz periodic IRQ frequency for IRQ
783 * @rtc: the rtc device 765 * @rtc: the rtc device
784 * @task: currently registered with rtc_irq_register() 766 * @task: currently registered with rtc_irq_register()
785 * @freq: positive frequency with which task->func() will be called 767 * @freq: positive frequency
786 * Context: any 768 * Context: any
787 * 769 *
788 * Note that rtc_irq_set_state() is used to enable or disable the 770 * Note that rtc_irq_set_state() is used to enable or disable the
@@ -791,25 +773,13 @@ EXPORT_SYMBOL_GPL(rtc_irq_set_state);
791int rtc_irq_set_freq(struct rtc_device *rtc, struct rtc_task *task, int freq) 773int rtc_irq_set_freq(struct rtc_device *rtc, struct rtc_task *task, int freq)
792{ 774{
793 int err = 0; 775 int err = 0;
794 unsigned long flags;
795 776
796 if (freq <= 0 || freq > RTC_MAX_FREQ) 777 if (freq <= 0 || freq > RTC_MAX_FREQ)
797 return -EINVAL; 778 return -EINVAL;
798retry: 779
799 spin_lock_irqsave(&rtc->irq_task_lock, flags); 780 rtc->irq_freq = freq;
800 if (rtc->irq_task != NULL && task == NULL) 781 while (rtc->pie_enabled && rtc_update_hrtimer(rtc, 1) < 0)
801 err = -EBUSY; 782 cpu_relax();
802 else if (rtc->irq_task != task)
803 err = -EACCES;
804 else {
805 rtc->irq_freq = freq;
806 if (rtc->pie_enabled && rtc_update_hrtimer(rtc, 1) < 0) {
807 spin_unlock_irqrestore(&rtc->irq_task_lock, flags);
808 cpu_relax();
809 goto retry;
810 }
811 }
812 spin_unlock_irqrestore(&rtc->irq_task_lock, flags);
813 783
814 trace_rtc_irq_set_freq(freq, err); 784 trace_rtc_irq_set_freq(freq, err);
815 return err; 785 return err;
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index f868d6b619ab..8cc23fdfd4ee 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -121,8 +121,6 @@ struct rtc_device {
121 wait_queue_head_t irq_queue; 121 wait_queue_head_t irq_queue;
122 struct fasync_struct *async_queue; 122 struct fasync_struct *async_queue;
123 123
124 struct rtc_task *irq_task;
125 spinlock_t irq_task_lock;
126 int irq_freq; 124 int irq_freq;
127 int max_user_freq; 125 int max_user_freq;
128 126