diff options
author | Alessandro Zummo <alessandro.zummo@towertech.it> | 2009-12-15 19:45:53 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-12-16 10:19:58 -0500 |
commit | b74d2caa64f8e542e9c6716ae6ed4a60d681ea9f (patch) | |
tree | 3d34fb87043b4a800bd35455725ba81638541cc3 /drivers/rtc/rtc-stk17ta8.c | |
parent | d1b2efa83fbf7b33919238fa29ef6ab935820103 (diff) |
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.c | 20 |
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 = { | |||
288 | 288 | ||
289 | static int __devinit stk17ta8_rtc_probe(struct platform_device *pdev) | 289 | static int __devinit stk17ta8_rtc_probe(struct platform_device *pdev) |
290 | { | 290 | { |
291 | struct rtc_device *rtc; | ||
292 | struct resource *res; | 291 | struct resource *res; |
293 | unsigned int cal; | 292 | unsigned int cal; |
294 | unsigned int flags; | 293 | unsigned int flags; |
@@ -338,22 +337,23 @@ static int __devinit stk17ta8_rtc_probe(struct platform_device *pdev) | |||
338 | } | 337 | } |
339 | } | 338 | } |
340 | 339 | ||
341 | rtc = rtc_device_register(pdev->name, &pdev->dev, | 340 | pdata->last_jiffies = jiffies; |
341 | platform_set_drvdata(pdev, pdata); | ||
342 | |||
343 | pdata->rtc = rtc_device_register(pdev->name, &pdev->dev, | ||
342 | &stk17ta8_rtc_ops, THIS_MODULE); | 344 | &stk17ta8_rtc_ops, THIS_MODULE); |
343 | if (IS_ERR(rtc)) { | 345 | if (IS_ERR(pdata->rtc)) { |
344 | ret = PTR_ERR(rtc); | 346 | ret = PTR_ERR(pdata->rtc); |
345 | goto out; | 347 | goto out; |
346 | } | 348 | } |
347 | pdata->rtc = rtc; | 349 | |
348 | pdata->last_jiffies = jiffies; | ||
349 | platform_set_drvdata(pdev, pdata); | ||
350 | ret = sysfs_create_bin_file(&pdev->dev.kobj, &stk17ta8_nvram_attr); | 350 | ret = sysfs_create_bin_file(&pdev->dev.kobj, &stk17ta8_nvram_attr); |
351 | if (ret) | 351 | if (ret) { |
352 | rtc_device_unregister(pdata->rtc); | ||
352 | goto out; | 353 | goto out; |
354 | } | ||
353 | return 0; | 355 | return 0; |
354 | out: | 356 | out: |
355 | if (pdata->rtc) | ||
356 | rtc_device_unregister(pdata->rtc); | ||
357 | if (pdata->irq > 0) | 357 | if (pdata->irq > 0) |
358 | free_irq(pdata->irq, pdev); | 358 | free_irq(pdata->irq, pdev); |
359 | if (ioaddr) | 359 | if (ioaddr) |