* [PATCH 1/8] rtc: sa1100: don't set PIE frequency
2018-07-26 13:40 [PATCH 0/8] rtc: cleanup task handling Alexandre Belloni
@ 2018-07-26 13:40 ` Alexandre Belloni
2018-07-26 13:40 ` [PATCH 2/8] rtc: sh: remove dead code Alexandre Belloni
` (6 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Alexandre Belloni @ 2018-07-26 13:40 UTC (permalink / raw)
To: linux-rtc; +Cc: linux-kernel, Alexandre Belloni
It doesn't make sense to set the PIE frequency from the driver. Let
userspace do its job.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-sa1100.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/rtc/rtc-sa1100.c b/drivers/rtc/rtc-sa1100.c
index ed71d1113627..304d905cb23f 100644
--- a/drivers/rtc/rtc-sa1100.c
+++ b/drivers/rtc/rtc-sa1100.c
@@ -224,7 +224,6 @@ int sa1100_rtc_init(struct platform_device *pdev, struct sa1100_rtc *info)
info->rtc = rtc;
rtc->max_user_freq = RTC_FREQ;
- rtc_irq_set_freq(rtc, NULL, RTC_FREQ);
/* Fix for a nasty initialization problem the in SA11xx RTSR register.
* See also the comments in sa1100_rtc_interrupt().
--
2.18.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 2/8] rtc: sh: remove dead code
2018-07-26 13:40 [PATCH 0/8] rtc: cleanup task handling Alexandre Belloni
2018-07-26 13:40 ` [PATCH 1/8] rtc: sa1100: don't set PIE frequency Alexandre Belloni
@ 2018-07-26 13:40 ` Alexandre Belloni
2018-07-26 13:40 ` [PATCH 3/8] rtc: remove rtc_irq_register/rtc_irq_unregister Alexandre Belloni
` (5 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Alexandre Belloni @ 2018-07-26 13:40 UTC (permalink / raw)
To: linux-rtc; +Cc: linux-kernel, Alexandre Belloni
Since commit 80d4bb515b78 ("RTC: Cleanup rtc_class_ops->irq_set_state") and
commit 696160fec162 ("RTC: Cleanup rtc_class_ops->irq_set_freq()"),
sh_rtc_irq_set_state and sh_rtc_irq_set_freq are never called. Remove them
along with task handling.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/rtc-sh.c | 89 +-------------------------------------------
1 file changed, 1 insertion(+), 88 deletions(-)
diff --git a/drivers/rtc/rtc-sh.c b/drivers/rtc/rtc-sh.c
index 4f98543d1ea5..abbce362f4df 100644
--- a/drivers/rtc/rtc-sh.c
+++ b/drivers/rtc/rtc-sh.c
@@ -143,7 +143,6 @@ static int __sh_rtc_alarm(struct sh_rtc *rtc)
static int __sh_rtc_periodic(struct sh_rtc *rtc)
{
struct rtc_device *rtc_dev = rtc->rtc_dev;
- struct rtc_task *irq_task;
unsigned int tmp, pending;
tmp = readb(rtc->regbase + RCR2);
@@ -160,14 +159,7 @@ static int __sh_rtc_periodic(struct sh_rtc *rtc)
else {
if (rtc->periodic_freq & PF_HP)
rtc->periodic_freq |= PF_COUNT;
- if (rtc->periodic_freq & PF_KOU) {
- spin_lock(&rtc_dev->irq_task_lock);
- irq_task = rtc_dev->irq_task;
- if (irq_task)
- irq_task->func(irq_task->private_data);
- spin_unlock(&rtc_dev->irq_task_lock);
- } else
- rtc_update_irq(rtc->rtc_dev, 1, RTC_PF | RTC_IRQF);
+ rtc_update_irq(rtc->rtc_dev, 1, RTC_PF | RTC_IRQF);
}
return pending;
@@ -223,81 +215,6 @@ static irqreturn_t sh_rtc_shared(int irq, void *dev_id)
return IRQ_RETVAL(ret);
}
-static int sh_rtc_irq_set_state(struct device *dev, int enable)
-{
- struct sh_rtc *rtc = dev_get_drvdata(dev);
- unsigned int tmp;
-
- spin_lock_irq(&rtc->lock);
-
- tmp = readb(rtc->regbase + RCR2);
-
- if (enable) {
- rtc->periodic_freq |= PF_KOU;
- tmp &= ~RCR2_PEF; /* Clear PES bit */
- tmp |= (rtc->periodic_freq & ~PF_HP); /* Set PES2-0 */
- } else {
- rtc->periodic_freq &= ~PF_KOU;
- tmp &= ~(RCR2_PESMASK | RCR2_PEF);
- }
-
- writeb(tmp, rtc->regbase + RCR2);
-
- spin_unlock_irq(&rtc->lock);
-
- return 0;
-}
-
-static int sh_rtc_irq_set_freq(struct device *dev, int freq)
-{
- struct sh_rtc *rtc = dev_get_drvdata(dev);
- int tmp, ret = 0;
-
- spin_lock_irq(&rtc->lock);
- tmp = rtc->periodic_freq & PF_MASK;
-
- switch (freq) {
- case 0:
- rtc->periodic_freq = 0x00;
- break;
- case 1:
- rtc->periodic_freq = 0x60;
- break;
- case 2:
- rtc->periodic_freq = 0x50;
- break;
- case 4:
- rtc->periodic_freq = 0x40;
- break;
- case 8:
- rtc->periodic_freq = 0x30 | PF_HP;
- break;
- case 16:
- rtc->periodic_freq = 0x30;
- break;
- case 32:
- rtc->periodic_freq = 0x20 | PF_HP;
- break;
- case 64:
- rtc->periodic_freq = 0x20;
- break;
- case 128:
- rtc->periodic_freq = 0x10 | PF_HP;
- break;
- case 256:
- rtc->periodic_freq = 0x10;
- break;
- default:
- ret = -ENOTSUPP;
- }
-
- if (ret == 0)
- rtc->periodic_freq |= tmp;
-
- spin_unlock_irq(&rtc->lock);
- return ret;
-}
-
static inline void sh_rtc_setaie(struct device *dev, unsigned int enable)
{
struct sh_rtc *rtc = dev_get_drvdata(dev);
@@ -674,8 +591,6 @@ static int __init sh_rtc_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, rtc);
/* everything disabled by default */
- sh_rtc_irq_set_freq(&pdev->dev, 0);
- sh_rtc_irq_set_state(&pdev->dev, 0);
sh_rtc_setaie(&pdev->dev, 0);
sh_rtc_setcie(&pdev->dev, 0);
@@ -707,8 +622,6 @@ static int __exit sh_rtc_remove(struct platform_device *pdev)
{
struct sh_rtc *rtc = platform_get_drvdata(pdev);
- sh_rtc_irq_set_state(&pdev->dev, 0);
-
sh_rtc_setaie(&pdev->dev, 0);
sh_rtc_setcie(&pdev->dev, 0);
--
2.18.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 3/8] rtc: remove rtc_irq_register/rtc_irq_unregister
2018-07-26 13:40 [PATCH 0/8] rtc: cleanup task handling Alexandre Belloni
2018-07-26 13:40 ` [PATCH 1/8] rtc: sa1100: don't set PIE frequency Alexandre Belloni
2018-07-26 13:40 ` [PATCH 2/8] rtc: sh: remove dead code Alexandre Belloni
@ 2018-07-26 13:40 ` Alexandre Belloni
2018-07-26 13:40 ` [PATCH 4/8] rtc: remove irq_task and irq_task_lock Alexandre Belloni
` (4 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Alexandre Belloni @ 2018-07-26 13:40 UTC (permalink / raw)
To: linux-rtc; +Cc: linux-kernel, Alexandre Belloni
The rtc_irq_* interface is not used from outside the RTC subsytem since
2016.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/interface.c | 33 ---------------------------------
include/linux/rtc.h | 4 ----
2 files changed, 37 deletions(-)
diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c
index 6d4012dd6922..2b1b9a0b9f8a 100644
--- a/drivers/rtc/interface.c
+++ b/drivers/rtc/interface.c
@@ -719,39 +719,6 @@ void rtc_class_close(struct rtc_device *rtc)
}
EXPORT_SYMBOL_GPL(rtc_class_close);
-int rtc_irq_register(struct rtc_device *rtc, struct rtc_task *task)
-{
- int retval = -EBUSY;
-
- if (task == NULL || task->func == NULL)
- return -EINVAL;
-
- /* Cannot register while the char dev is in use */
- if (test_and_set_bit_lock(RTC_DEV_BUSY, &rtc->flags))
- return -EBUSY;
-
- spin_lock_irq(&rtc->irq_task_lock);
- if (rtc->irq_task == NULL) {
- rtc->irq_task = task;
- retval = 0;
- }
- spin_unlock_irq(&rtc->irq_task_lock);
-
- clear_bit_unlock(RTC_DEV_BUSY, &rtc->flags);
-
- return retval;
-}
-EXPORT_SYMBOL_GPL(rtc_irq_register);
-
-void rtc_irq_unregister(struct rtc_device *rtc, struct rtc_task *task)
-{
- spin_lock_irq(&rtc->irq_task_lock);
- if (rtc->irq_task == task)
- rtc->irq_task = NULL;
- spin_unlock_irq(&rtc->irq_task_lock);
-}
-EXPORT_SYMBOL_GPL(rtc_irq_unregister);
-
static int rtc_update_hrtimer(struct rtc_device *rtc, int enabled)
{
/*
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index 6268208760e9..f868d6b619ab 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -204,10 +204,6 @@ extern void rtc_update_irq(struct rtc_device *rtc,
extern struct rtc_device *rtc_class_open(const char *name);
extern void rtc_class_close(struct rtc_device *rtc);
-extern int rtc_irq_register(struct rtc_device *rtc,
- struct rtc_task *task);
-extern void rtc_irq_unregister(struct rtc_device *rtc,
- struct rtc_task *task);
extern int rtc_irq_set_state(struct rtc_device *rtc,
struct rtc_task *task, int enabled);
extern int rtc_irq_set_freq(struct rtc_device *rtc,
--
2.18.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 4/8] rtc: remove irq_task and irq_task_lock
2018-07-26 13:40 [PATCH 0/8] rtc: cleanup task handling Alexandre Belloni
` (2 preceding siblings ...)
2018-07-26 13:40 ` [PATCH 3/8] rtc: remove rtc_irq_register/rtc_irq_unregister Alexandre Belloni
@ 2018-07-26 13:40 ` Alexandre Belloni
2018-07-26 13:40 ` [PATCH 5/8] rtc: simplify rtc_irq_set_state/rtc_irq_set_freq Alexandre Belloni
` (3 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Alexandre Belloni @ 2018-07-26 13:40 UTC (permalink / raw)
To: linux-rtc; +Cc: linux-kernel, Alexandre Belloni
There is no way to set a periodic task anymore, remove task pointer and
lock.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/class.c | 1 -
drivers/rtc/interface.c | 50 +++++++++--------------------------------
include/linux/rtc.h | 2 --
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)
mutex_init(&rtc->ops_lock);
spin_lock_init(&rtc->irq_lock);
- spin_lock_init(&rtc->irq_task_lock);
init_waitqueue_head(&rtc->irq_queue);
/* 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)
rtc->irq_data = (rtc->irq_data + (num << 8)) | (RTC_IRQF|mode);
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);
kill_fasync(&rtc->async_queue, SIGIO, POLL_IN);
}
@@ -750,28 +744,16 @@ static int rtc_update_hrtimer(struct rtc_device *rtc, int enabled)
* Context: any
*
* 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 err = 0;
- unsigned long flags;
-retry:
- spin_lock_irqsave(&rtc->irq_task_lock, flags);
- if (rtc->irq_task != NULL && task == NULL)
- err = -EBUSY;
- 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);
+ while (rtc_update_hrtimer(rtc, enabled) < 0)
+ cpu_relax();
+
+ rtc->pie_enabled = enabled;
trace_rtc_irq_set_state(enabled, err);
return err;
@@ -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: the rtc device
* @task: currently registered with rtc_irq_register()
- * @freq: positive frequency with which task->func() will be called
+ * @freq: positive frequency
* Context: any
*
* Note that rtc_irq_set_state() is used to enable or disable the
@@ -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 err = 0;
- unsigned long flags;
if (freq <= 0 || freq > RTC_MAX_FREQ)
return -EINVAL;
-retry:
- spin_lock_irqsave(&rtc->irq_task_lock, flags);
- if (rtc->irq_task != NULL && task == NULL)
- err = -EBUSY;
- 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);
+
+ rtc->irq_freq = freq;
+ while (rtc->pie_enabled && rtc_update_hrtimer(rtc, 1) < 0)
+ cpu_relax();
trace_rtc_irq_set_freq(freq, err);
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 {
wait_queue_head_t irq_queue;
struct fasync_struct *async_queue;
- struct rtc_task *irq_task;
- spinlock_t irq_task_lock;
int irq_freq;
int max_user_freq;
--
2.18.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 5/8] rtc: simplify rtc_irq_set_state/rtc_irq_set_freq
2018-07-26 13:40 [PATCH 0/8] rtc: cleanup task handling Alexandre Belloni
` (3 preceding siblings ...)
2018-07-26 13:40 ` [PATCH 4/8] rtc: remove irq_task and irq_task_lock Alexandre Belloni
@ 2018-07-26 13:40 ` Alexandre Belloni
2018-07-26 13:40 ` [PATCH 6/8] rtc: unexport rtc_irq_set_* Alexandre Belloni
` (2 subsequent siblings)
7 siblings, 0 replies; 11+ messages in thread
From: Alexandre Belloni @ 2018-07-26 13:40 UTC (permalink / raw)
To: linux-rtc; +Cc: linux-kernel, Alexandre Belloni
The PIE doesn't handle tasks anymore, remove the pointer from the
interface.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/interface.c | 4 ++--
drivers/rtc/rtc-dev.c | 8 ++++----
include/linux/rtc.h | 6 ++----
3 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c
index ae0d67610c7b..76eb3a2957cc 100644
--- a/drivers/rtc/interface.c
+++ b/drivers/rtc/interface.c
@@ -746,7 +746,7 @@ static int rtc_update_hrtimer(struct rtc_device *rtc, int enabled)
* Note that rtc_irq_set_freq() should previously have been used to
* 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, int enabled)
{
int err = 0;
@@ -770,7 +770,7 @@ EXPORT_SYMBOL_GPL(rtc_irq_set_state);
* Note that rtc_irq_set_state() is used to enable or disable the
* periodic IRQs.
*/
-int rtc_irq_set_freq(struct rtc_device *rtc, struct rtc_task *task, int freq)
+int rtc_irq_set_freq(struct rtc_device *rtc, int freq)
{
int err = 0;
diff --git a/drivers/rtc/rtc-dev.c b/drivers/rtc/rtc-dev.c
index efa221e8bc22..43d962a9c210 100644
--- a/drivers/rtc/rtc-dev.c
+++ b/drivers/rtc/rtc-dev.c
@@ -341,11 +341,11 @@ static long rtc_dev_ioctl(struct file *file,
return rtc_set_time(rtc, &tm);
case RTC_PIE_ON:
- err = rtc_irq_set_state(rtc, NULL, 1);
+ err = rtc_irq_set_state(rtc, 1);
break;
case RTC_PIE_OFF:
- err = rtc_irq_set_state(rtc, NULL, 0);
+ err = rtc_irq_set_state(rtc, 0);
break;
case RTC_AIE_ON:
@@ -365,7 +365,7 @@ static long rtc_dev_ioctl(struct file *file,
return rtc_update_irq_enable(rtc, 0);
case RTC_IRQP_SET:
- err = rtc_irq_set_freq(rtc, NULL, arg);
+ err = rtc_irq_set_freq(rtc, arg);
break;
case RTC_IRQP_READ:
@@ -427,7 +427,7 @@ static int rtc_dev_release(struct inode *inode, struct file *file)
/* Keep ioctl until all drivers are converted */
rtc_dev_ioctl(file, RTC_UIE_OFF, 0);
rtc_update_irq_enable(rtc, 0);
- rtc_irq_set_state(rtc, NULL, 0);
+ rtc_irq_set_state(rtc, 0);
clear_bit_unlock(RTC_DEV_BUSY, &rtc->flags);
return 0;
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index 8cc23fdfd4ee..bf4d375025d1 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -202,10 +202,8 @@ extern void rtc_update_irq(struct rtc_device *rtc,
extern struct rtc_device *rtc_class_open(const char *name);
extern void rtc_class_close(struct rtc_device *rtc);
-extern int rtc_irq_set_state(struct rtc_device *rtc,
- struct rtc_task *task, int enabled);
-extern int rtc_irq_set_freq(struct rtc_device *rtc,
- struct rtc_task *task, int freq);
+extern int rtc_irq_set_state(struct rtc_device *rtc, int enabled);
+extern int rtc_irq_set_freq(struct rtc_device *rtc, int freq);
extern int rtc_update_irq_enable(struct rtc_device *rtc, unsigned int enabled);
extern int rtc_alarm_irq_enable(struct rtc_device *rtc, unsigned int enabled);
extern int rtc_dev_update_irq_enable_emul(struct rtc_device *rtc,
--
2.18.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 6/8] rtc: unexport rtc_irq_set_*
2018-07-26 13:40 [PATCH 0/8] rtc: cleanup task handling Alexandre Belloni
` (4 preceding siblings ...)
2018-07-26 13:40 ` [PATCH 5/8] rtc: simplify rtc_irq_set_state/rtc_irq_set_freq Alexandre Belloni
@ 2018-07-26 13:40 ` Alexandre Belloni
2018-07-26 13:40 ` [PATCH 7/8] char: rtc: remove task handling Alexandre Belloni
2018-07-26 13:40 ` [PATCH 8/8] rtc: remove struct rtc_task Alexandre Belloni
7 siblings, 0 replies; 11+ messages in thread
From: Alexandre Belloni @ 2018-07-26 13:40 UTC (permalink / raw)
To: linux-rtc; +Cc: linux-kernel, Alexandre Belloni
Make the rtc_irq_set interface internale to the RTC subsystem.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/interface.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c
index 76eb3a2957cc..d0983ed6c842 100644
--- a/drivers/rtc/interface.c
+++ b/drivers/rtc/interface.c
@@ -758,7 +758,6 @@ int rtc_irq_set_state(struct rtc_device *rtc, int enabled)
trace_rtc_irq_set_state(enabled, err);
return err;
}
-EXPORT_SYMBOL_GPL(rtc_irq_set_state);
/**
* rtc_irq_set_freq - set 2^N Hz periodic IRQ frequency for IRQ
@@ -784,7 +783,6 @@ int rtc_irq_set_freq(struct rtc_device *rtc, int freq)
trace_rtc_irq_set_freq(freq, err);
return err;
}
-EXPORT_SYMBOL_GPL(rtc_irq_set_freq);
/**
* rtc_timer_enqueue - Adds a rtc_timer to the rtc_device timerqueue
--
2.18.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 7/8] char: rtc: remove task handling
2018-07-26 13:40 [PATCH 0/8] rtc: cleanup task handling Alexandre Belloni
` (5 preceding siblings ...)
2018-07-26 13:40 ` [PATCH 6/8] rtc: unexport rtc_irq_set_* Alexandre Belloni
@ 2018-07-26 13:40 ` Alexandre Belloni
2018-08-02 8:30 ` Greg Kroah-Hartman
2018-07-26 13:40 ` [PATCH 8/8] rtc: remove struct rtc_task Alexandre Belloni
7 siblings, 1 reply; 11+ messages in thread
From: Alexandre Belloni @ 2018-07-26 13:40 UTC (permalink / raw)
To: linux-rtc
Cc: linux-kernel, Alexandre Belloni, Arnd Bergmann, Greg Kroah-Hartman
Since commit 9e7002a70e42 ("char: rtc: remove unused rtc_control() API"),
it is not possible to set a callback anymore, remove its handling from the
interrupt handler.
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
Hi,
My plan is to take that patch through the RTC tree because the next patch relies
on the rtc_task_t *rtc_callback removal.
drivers/char/rtc.c | 13 -------------
1 file changed, 13 deletions(-)
diff --git a/drivers/char/rtc.c b/drivers/char/rtc.c
index 94fedeeec035..4948c8bda6b1 100644
--- a/drivers/char/rtc.c
+++ b/drivers/char/rtc.c
@@ -193,14 +193,6 @@ static unsigned long rtc_freq; /* Current periodic IRQ rate */
static unsigned long rtc_irq_data; /* our output to the world */
static unsigned long rtc_max_user_freq = 64; /* > this, need CAP_SYS_RESOURCE */
-#ifdef RTC_IRQ
-/*
- * rtc_task_lock nests inside rtc_lock.
- */
-static DEFINE_SPINLOCK(rtc_task_lock);
-static rtc_task_t *rtc_callback;
-#endif
-
/*
* If this driver ever becomes modularised, it will be really nice
* to make the epoch retain its value across module reload...
@@ -264,11 +256,6 @@ static irqreturn_t rtc_interrupt(int irq, void *dev_id)
spin_unlock(&rtc_lock);
- /* Now do the rest of the actions */
- spin_lock(&rtc_task_lock);
- if (rtc_callback)
- rtc_callback->func(rtc_callback->private_data);
- spin_unlock(&rtc_task_lock);
wake_up_interruptible(&rtc_wait);
kill_fasync(&rtc_async_queue, SIGIO, POLL_IN);
--
2.18.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 7/8] char: rtc: remove task handling
2018-07-26 13:40 ` [PATCH 7/8] char: rtc: remove task handling Alexandre Belloni
@ 2018-08-02 8:30 ` Greg Kroah-Hartman
0 siblings, 0 replies; 11+ messages in thread
From: Greg Kroah-Hartman @ 2018-08-02 8:30 UTC (permalink / raw)
To: Alexandre Belloni; +Cc: linux-rtc, linux-kernel, Arnd Bergmann
On Thu, Jul 26, 2018 at 03:40:55PM +0200, Alexandre Belloni wrote:
> Since commit 9e7002a70e42 ("char: rtc: remove unused rtc_control() API"),
> it is not possible to set a callback anymore, remove its handling from the
> interrupt handler.
>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
> ---
> Hi,
>
> My plan is to take that patch through the RTC tree because the next patch relies
> on the rtc_task_t *rtc_callback removal.
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 8/8] rtc: remove struct rtc_task
2018-07-26 13:40 [PATCH 0/8] rtc: cleanup task handling Alexandre Belloni
` (6 preceding siblings ...)
2018-07-26 13:40 ` [PATCH 7/8] char: rtc: remove task handling Alexandre Belloni
@ 2018-07-26 13:40 ` Alexandre Belloni
2018-08-06 9:06 ` Arnd Bergmann
7 siblings, 1 reply; 11+ messages in thread
From: Alexandre Belloni @ 2018-07-26 13:40 UTC (permalink / raw)
To: linux-rtc; +Cc: linux-kernel, Alexandre Belloni
Include rtc_task members directly in rtc_timer member.
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
drivers/rtc/interface.c | 8 ++++----
include/linux/rtc.h | 9 ++-------
2 files changed, 6 insertions(+), 11 deletions(-)
diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c
index d0983ed6c842..a962540faf2e 100644
--- a/drivers/rtc/interface.c
+++ b/drivers/rtc/interface.c
@@ -912,8 +912,8 @@ void rtc_timer_do_work(struct work_struct *work)
timerqueue_del(&rtc->timerqueue, &timer->node);
trace_rtc_timer_dequeue(timer);
timer->enabled = 0;
- if (timer->task.func)
- timer->task.func(timer->task.private_data);
+ if (timer->func)
+ timer->func(timer->private_data);
trace_rtc_timer_fired(timer);
/* Re-add/fwd periodic timers */
@@ -968,8 +968,8 @@ void rtc_timer_init(struct rtc_timer *timer, void (*f)(void *p), void *data)
{
timerqueue_init(&timer->node);
timer->enabled = 0;
- timer->task.func = f;
- timer->task.private_data = data;
+ timer->func = f;
+ timer->private_data = data;
}
/* rtc_timer_start - Sets an rtc_timer to fire in the future
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index bf4d375025d1..6aedc30003e7 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -87,16 +87,11 @@ struct rtc_class_ops {
int (*set_offset)(struct device *, long offset);
};
-typedef struct rtc_task {
- void (*func)(void *private_data);
- void *private_data;
-} rtc_task_t;
-
-
struct rtc_timer {
- struct rtc_task task;
struct timerqueue_node node;
ktime_t period;
+ void (*func)(void *private_data);
+ void *private_data;
int enabled;
};
--
2.18.0
^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH 8/8] rtc: remove struct rtc_task
2018-07-26 13:40 ` [PATCH 8/8] rtc: remove struct rtc_task Alexandre Belloni
@ 2018-08-06 9:06 ` Arnd Bergmann
0 siblings, 0 replies; 11+ messages in thread
From: Arnd Bergmann @ 2018-08-06 9:06 UTC (permalink / raw)
To: Alexandre Belloni; +Cc: linux-rtc, Linux Kernel Mailing List
On Thu, Jul 26, 2018 at 3:42 PM Alexandre Belloni
<alexandre.belloni@bootlin.com> wrote:
>
> Include rtc_task members directly in rtc_timer member.
>
> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
> ---
> drivers/rtc/interface.c | 8 ++++----
> include/linux/rtc.h | 9 ++-------
> 2 files changed, 6 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c
> index d0983ed6c842..a962540faf2e 100644
> --- a/drivers/rtc/interface.c
> +++ b/drivers/rtc/interface.c
> @@ -912,8 +912,8 @@ void rtc_timer_do_work(struct work_struct *work)
> timerqueue_del(&rtc->timerqueue, &timer->node);
> trace_rtc_timer_dequeue(timer);
> timer->enabled = 0;
> - if (timer->task.func)
> - timer->task.func(timer->task.private_data);
> + if (timer->func)
> + timer->func(timer->private_data);
>
> trace_rtc_timer_fired(timer);
> /* Re-add/fwd periodic timers */
> @@ -968,8 +968,8 @@ void rtc_timer_init(struct rtc_timer *timer, void (*f)(void *p), void *data)
> {
> timerqueue_init(&timer->node);
> timer->enabled = 0;
> - timer->task.func = f;
> - timer->task.private_data = data;
> + timer->func = f;
> + timer->private_data = data;
> }
>From what I can see, all remaining users pass the rtc_device pointer as
'private_data', so maybe make that explicit now instead of the void pointer?
Arnd
^ permalink raw reply [flat|nested] 11+ messages in thread