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-m48t59.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-m48t59.c')
-rw-r--r-- | drivers/rtc/rtc-m48t59.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/rtc/rtc-m48t59.c b/drivers/rtc/rtc-m48t59.c index 33921a6b1707..ede43b846859 100644 --- a/drivers/rtc/rtc-m48t59.c +++ b/drivers/rtc/rtc-m48t59.c | |||
@@ -481,6 +481,9 @@ static int __devinit m48t59_rtc_probe(struct platform_device *pdev) | |||
481 | goto out; | 481 | goto out; |
482 | } | 482 | } |
483 | 483 | ||
484 | spin_lock_init(&m48t59->lock); | ||
485 | platform_set_drvdata(pdev, m48t59); | ||
486 | |||
484 | m48t59->rtc = rtc_device_register(name, &pdev->dev, ops, THIS_MODULE); | 487 | m48t59->rtc = rtc_device_register(name, &pdev->dev, ops, THIS_MODULE); |
485 | if (IS_ERR(m48t59->rtc)) { | 488 | if (IS_ERR(m48t59->rtc)) { |
486 | ret = PTR_ERR(m48t59->rtc); | 489 | ret = PTR_ERR(m48t59->rtc); |
@@ -490,16 +493,14 @@ static int __devinit m48t59_rtc_probe(struct platform_device *pdev) | |||
490 | m48t59_nvram_attr.size = pdata->offset; | 493 | m48t59_nvram_attr.size = pdata->offset; |
491 | 494 | ||
492 | ret = sysfs_create_bin_file(&pdev->dev.kobj, &m48t59_nvram_attr); | 495 | ret = sysfs_create_bin_file(&pdev->dev.kobj, &m48t59_nvram_attr); |
493 | if (ret) | 496 | if (ret) { |
497 | rtc_device_unregister(m48t59->rtc); | ||
494 | goto out; | 498 | goto out; |
499 | } | ||
495 | 500 | ||
496 | spin_lock_init(&m48t59->lock); | ||
497 | platform_set_drvdata(pdev, m48t59); | ||
498 | return 0; | 501 | return 0; |
499 | 502 | ||
500 | out: | 503 | out: |
501 | if (!IS_ERR(m48t59->rtc)) | ||
502 | rtc_device_unregister(m48t59->rtc); | ||
503 | if (m48t59->irq != NO_IRQ) | 504 | if (m48t59->irq != NO_IRQ) |
504 | free_irq(m48t59->irq, &pdev->dev); | 505 | free_irq(m48t59->irq, &pdev->dev); |
505 | if (m48t59->ioaddr) | 506 | if (m48t59->ioaddr) |