summaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-stk17ta8.c
diff options
context:
space:
mode:
authorAlessandro Zummo <alessandro.zummo@towertech.it>2009-12-16 01:45:53 +0100
committerLinus Torvalds <torvalds@linux-foundation.org>2009-12-16 16:19:58 +0100
commitb74d2caa64f8e542e9c6716ae6ed4a60d681ea9f (patch)
tree3d34fb87043b4a800bd35455725ba81638541cc3 /drivers/rtc/rtc-stk17ta8.c
parentrtc: disable hpet emulation on suspend (diff)
downloadlinux-b74d2caa64f8e542e9c6716ae6ed4a60d681ea9f.tar.xz
linux-b74d2caa64f8e542e9c6716ae6ed4a60d681ea9f.zip
rtc: fix driver data issues in several rtc drivers
Herton Ronaldo Krzesinski recently raised up, and fixed, an issue with the rtc_cmos driver, which was referring to an inconsistent driver data. This patch ensures that driver data registration happens before rtc_device_register(). Signed-off-by: Alessandro Zummo <a.zummo@towertech.it> Acked-by: Thomas Hommel <thomas.hommel@gefanuc.com> Acked-by: Hans-Christian Egtvedt <hcegtvedt@atmel.com> Acked-by: Paul Mundt <lethal@linux-sh.org> Cc: David S. Miller <davem@davemloft.net> Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de> Cc: Andrew Sharp <andy.sharp@onstor.com> Cc: Atsushi Nemoto <anemo@mba.ocn.ne.jp> Cc: Alexander Bigga <ab@mycable.de> Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de> Cc: Mark Zhan <rongkai.zhan@windriver.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc/rtc-stk17ta8.c')
-rw-r--r--drivers/rtc/rtc-stk17ta8.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/rtc/rtc-stk17ta8.c b/drivers/rtc/rtc-stk17ta8.c
index d491eb265c38..62c2969436a8 100644
--- a/drivers/rtc/rtc-stk17ta8.c
+++ b/drivers/rtc/rtc-stk17ta8.c
@@ -288,7 +288,6 @@ static struct bin_attribute stk17ta8_nvram_attr = {
static int __devinit stk17ta8_rtc_probe(struct platform_device *pdev)
{
- struct rtc_device *rtc;
struct resource *res;
unsigned int cal;
unsigned int flags;
@@ -338,22 +337,23 @@ static int __devinit stk17ta8_rtc_probe(struct platform_device *pdev)
}
}
- rtc = rtc_device_register(pdev->name, &pdev->dev,
+ pdata->last_jiffies = jiffies;
+ platform_set_drvdata(pdev, pdata);
+
+ pdata->rtc = rtc_device_register(pdev->name, &pdev->dev,
&stk17ta8_rtc_ops, THIS_MODULE);
- if (IS_ERR(rtc)) {
- ret = PTR_ERR(rtc);
+ if (IS_ERR(pdata->rtc)) {
+ ret = PTR_ERR(pdata->rtc);
goto out;
}
- pdata->rtc = rtc;
- pdata->last_jiffies = jiffies;
- platform_set_drvdata(pdev, pdata);
+
ret = sysfs_create_bin_file(&pdev->dev.kobj, &stk17ta8_nvram_attr);
- if (ret)
+ if (ret) {
+ rtc_device_unregister(pdata->rtc);
goto out;
+ }
return 0;
out:
- if (pdata->rtc)
- rtc_device_unregister(pdata->rtc);
if (pdata->irq > 0)
free_irq(pdata->irq, pdev);
if (ioaddr)