* [PATCH 0/4] RTC fixes for 3.1
@ 2011-08-10 23:01 John Stultz
2011-08-10 23:01 ` [PATCH 1/4] rtc: ep93xx: Fix 'rtc' may be used uninitialized warning John Stultz
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: John Stultz @ 2011-08-10 23:01 UTC (permalink / raw)
To: LKML; +Cc: John Stultz, Thomas Gleixner
Hey Thomas,
Here are a few RTC fixes for 3.1. Let me know if you have any
issues with them.
These patches are also available in the git repository at:
git://git.linaro.org/people/jstultz/linux.git fortglx/3.1/tip/timers/rtc
Cc: Thomas Gleixner <tglx@linutronix.de>
Axel Lin (1):
rtc: ep93xx: Fix 'rtc' may be used uninitialized warning
Ilkka Koskinen (1):
rtc: rtc-twl: Switch to using threaded irq
John Stultz (1):
rtc: Fix RTC PIE frequency limit
Sebastian Reichel (1):
rtc: rtc-twl: Remove lockdep related local_irq_enable()
drivers/rtc/interface.c | 2 +-
drivers/rtc/rtc-ep93xx.c | 16 ++++++++--------
drivers/rtc/rtc-twl.c | 10 +---------
include/linux/rtc.h | 3 +++
4 files changed, 13 insertions(+), 18 deletions(-)
--
1.7.3.2.146.gca209
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/4] rtc: ep93xx: Fix 'rtc' may be used uninitialized warning
2011-08-10 23:01 [PATCH 0/4] RTC fixes for 3.1 John Stultz
@ 2011-08-10 23:01 ` John Stultz
2011-08-10 23:01 ` [PATCH 2/4] rtc: rtc-twl: Switch to using threaded irq John Stultz
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: John Stultz @ 2011-08-10 23:01 UTC (permalink / raw)
To: LKML; +Cc: Axel Lin, Thomas Gleixner, John Stultz
From: Axel Lin <axel.lin@gmail.com>
commit 92d921c5d "rtc: ep93xx: Initialize drvdata before registering device"
ensures the drvdata is initialized prior to registering the rtc device.
But it set the drvdata to an uninitialized pointer.
Thus calling platform_get_drvdata in ep93xx_rtc_remove does not get correct address.
This patch fixes below warning by adding struct rtc_device *rtc to struct ep93xx_rtc.
Then set platform drvdata to ep93xx_rtc instead of rtc.
CC drivers/rtc/rtc-ep93xx.o
drivers/rtc/rtc-ep93xx.c: In function 'ep93xx_rtc_probe':
drivers/rtc/rtc-ep93xx.c:154: warning: 'rtc' may be used uninitialized in this function
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
---
drivers/rtc/rtc-ep93xx.c | 16 ++++++++--------
1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/rtc/rtc-ep93xx.c b/drivers/rtc/rtc-ep93xx.c
index 335551d..14a42a1 100644
--- a/drivers/rtc/rtc-ep93xx.c
+++ b/drivers/rtc/rtc-ep93xx.c
@@ -36,6 +36,7 @@
*/
struct ep93xx_rtc {
void __iomem *mmio_base;
+ struct rtc_device *rtc;
};
static int ep93xx_rtc_get_swcomp(struct device *dev, unsigned short *preload,
@@ -130,7 +131,6 @@ static int __init ep93xx_rtc_probe(struct platform_device *pdev)
{
struct ep93xx_rtc *ep93xx_rtc;
struct resource *res;
- struct rtc_device *rtc;
int err;
ep93xx_rtc = devm_kzalloc(&pdev->dev, sizeof(*ep93xx_rtc), GFP_KERNEL);
@@ -151,12 +151,12 @@ static int __init ep93xx_rtc_probe(struct platform_device *pdev)
return -ENXIO;
pdev->dev.platform_data = ep93xx_rtc;
- platform_set_drvdata(pdev, rtc);
+ platform_set_drvdata(pdev, ep93xx_rtc);
- rtc = rtc_device_register(pdev->name,
+ ep93xx_rtc->rtc = rtc_device_register(pdev->name,
&pdev->dev, &ep93xx_rtc_ops, THIS_MODULE);
- if (IS_ERR(rtc)) {
- err = PTR_ERR(rtc);
+ if (IS_ERR(ep93xx_rtc->rtc)) {
+ err = PTR_ERR(ep93xx_rtc->rtc);
goto exit;
}
@@ -167,7 +167,7 @@ static int __init ep93xx_rtc_probe(struct platform_device *pdev)
return 0;
fail:
- rtc_device_unregister(rtc);
+ rtc_device_unregister(ep93xx_rtc->rtc);
exit:
platform_set_drvdata(pdev, NULL);
pdev->dev.platform_data = NULL;
@@ -176,11 +176,11 @@ exit:
static int __exit ep93xx_rtc_remove(struct platform_device *pdev)
{
- struct rtc_device *rtc = platform_get_drvdata(pdev);
+ struct ep93xx_rtc *ep93xx_rtc = platform_get_drvdata(pdev);
sysfs_remove_group(&pdev->dev.kobj, &ep93xx_rtc_sysfs_files);
platform_set_drvdata(pdev, NULL);
- rtc_device_unregister(rtc);
+ rtc_device_unregister(ep93xx_rtc->rtc);
pdev->dev.platform_data = NULL;
return 0;
--
1.7.3.2.146.gca209
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/4] rtc: rtc-twl: Switch to using threaded irq
2011-08-10 23:01 [PATCH 0/4] RTC fixes for 3.1 John Stultz
2011-08-10 23:01 ` [PATCH 1/4] rtc: ep93xx: Fix 'rtc' may be used uninitialized warning John Stultz
@ 2011-08-10 23:01 ` John Stultz
2011-08-10 23:01 ` [PATCH 3/4] rtc: rtc-twl: Remove lockdep related local_irq_enable() John Stultz
2011-08-10 23:01 ` [PATCH 4/4] rtc: Fix RTC PIE frequency limit John Stultz
3 siblings, 0 replies; 5+ messages in thread
From: John Stultz @ 2011-08-10 23:01 UTC (permalink / raw)
To: LKML; +Cc: Ilkka Koskinen, Thomas Gleixner, John Stultz
From: Ilkka Koskinen <ilkka.koskinen@nokia.com>
The driver is accessing to i2c bus in interrupt handler.
Therefore, it should use threaded irq.
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ilkka Koskinen <ilkka.koskinen@nokia.com>
Acked-by: Balaji T K <balajitk@ti.com>
Signed-off-by: John Stultz <john.stultz@linaro.org>
---
drivers/rtc/rtc-twl.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c
index 9a81f77..1963cdd 100644
--- a/drivers/rtc/rtc-twl.c
+++ b/drivers/rtc/rtc-twl.c
@@ -462,7 +462,7 @@ static int __devinit twl_rtc_probe(struct platform_device *pdev)
if (ret < 0)
goto out1;
- ret = request_irq(irq, twl_rtc_interrupt,
+ ret = request_threaded_irq(irq, NULL, twl_rtc_interrupt,
IRQF_TRIGGER_RISING,
dev_name(&rtc->dev), rtc);
if (ret < 0) {
--
1.7.3.2.146.gca209
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 3/4] rtc: rtc-twl: Remove lockdep related local_irq_enable()
2011-08-10 23:01 [PATCH 0/4] RTC fixes for 3.1 John Stultz
2011-08-10 23:01 ` [PATCH 1/4] rtc: ep93xx: Fix 'rtc' may be used uninitialized warning John Stultz
2011-08-10 23:01 ` [PATCH 2/4] rtc: rtc-twl: Switch to using threaded irq John Stultz
@ 2011-08-10 23:01 ` John Stultz
2011-08-10 23:01 ` [PATCH 4/4] rtc: Fix RTC PIE frequency limit John Stultz
3 siblings, 0 replies; 5+ messages in thread
From: John Stultz @ 2011-08-10 23:01 UTC (permalink / raw)
To: LKML; +Cc: Sebastian Reichel, Thomas Gleixner, John Stultz
From: Sebastian Reichel <sre@debian.org>
Now that the irq is properly threaded (due to it needing i2c access)
we should also remove the local_irq_enable() call in twl_rtc_interrupt.
Testing this with Pandaboard, the RTC is still working.
Cc: Thomas Gleixner <tglx@linutronix.de>
[Reworked commit message -jstultz]
Signed-off-by: John Stultz <john.stultz@linaro.org>
---
drivers/rtc/rtc-twl.c | 8 --------
1 files changed, 0 insertions(+), 8 deletions(-)
diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c
index 1963cdd..9677bbc 100644
--- a/drivers/rtc/rtc-twl.c
+++ b/drivers/rtc/rtc-twl.c
@@ -362,14 +362,6 @@ static irqreturn_t twl_rtc_interrupt(int irq, void *rtc)
int res;
u8 rd_reg;
-#ifdef CONFIG_LOCKDEP
- /* WORKAROUND for lockdep forcing IRQF_DISABLED on us, which
- * we don't want and can't tolerate. Although it might be
- * friendlier not to borrow this thread context...
- */
- local_irq_enable();
-#endif
-
res = twl_rtc_read_u8(&rd_reg, REG_RTC_STATUS_REG);
if (res)
goto out;
--
1.7.3.2.146.gca209
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 4/4] rtc: Fix RTC PIE frequency limit
2011-08-10 23:01 [PATCH 0/4] RTC fixes for 3.1 John Stultz
` (2 preceding siblings ...)
2011-08-10 23:01 ` [PATCH 3/4] rtc: rtc-twl: Remove lockdep related local_irq_enable() John Stultz
@ 2011-08-10 23:01 ` John Stultz
3 siblings, 0 replies; 5+ messages in thread
From: John Stultz @ 2011-08-10 23:01 UTC (permalink / raw)
To: LKML; +Cc: John Stultz, Willy Tarreau, stable, Thomas Gleixner
Thomas earlier submitted a fix to limit the RTC PIE freq, but
picked 5000Hz out of the air. Willy noticed that we should
instead use the 8192Hz max from the rtc man documentation.
Cc: Willy Tarreau <w@1wt.eu>
Cc: stable@kernel.org
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: John Stultz <john.stultz@linaro.org>
---
drivers/rtc/interface.c | 2 +-
include/linux/rtc.h | 3 +++
2 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c
index 3195dbd..eb4c883 100644
--- a/drivers/rtc/interface.c
+++ b/drivers/rtc/interface.c
@@ -708,7 +708,7 @@ 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 > 5000)
+ if (freq <= 0 || freq > RTC_MAX_FREQ)
return -EINVAL;
retry:
spin_lock_irqsave(&rtc->irq_task_lock, flags);
diff --git a/include/linux/rtc.h b/include/linux/rtc.h
index b27ebea..93f4d03 100644
--- a/include/linux/rtc.h
+++ b/include/linux/rtc.h
@@ -97,6 +97,9 @@ struct rtc_pll_info {
#define RTC_AF 0x20 /* Alarm interrupt */
#define RTC_UF 0x10 /* Update interrupt for 1Hz RTC */
+
+#define RTC_MAX_FREQ 8192
+
#ifdef __KERNEL__
#include <linux/types.h>
--
1.7.3.2.146.gca209
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-08-10 23:03 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-10 23:01 [PATCH 0/4] RTC fixes for 3.1 John Stultz
2011-08-10 23:01 ` [PATCH 1/4] rtc: ep93xx: Fix 'rtc' may be used uninitialized warning John Stultz
2011-08-10 23:01 ` [PATCH 2/4] rtc: rtc-twl: Switch to using threaded irq John Stultz
2011-08-10 23:01 ` [PATCH 3/4] rtc: rtc-twl: Remove lockdep related local_irq_enable() John Stultz
2011-08-10 23:01 ` [PATCH 4/4] rtc: Fix RTC PIE frequency limit John Stultz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®