Commit d3869ff6 authored by Peter Ujfalusi's avatar Peter Ujfalusi Committed by Linus Torvalds

drivers/rtc/rtc-twl.c: fix rtc_reg_map initialization

Initialize the rtc_reg_map in platform_driver's probe function instead at
module_init time.  This way we can make sure that the twl-core has been
already probed and initialized (twl_priv->twl_id is valid) since the
platform device for the RTC driver will be created by the twl-core after
it finished its init.
Reported-by: default avatarChristoph Fritz <chf.fritz@googlemail.com>
Signed-off-by: default avatarPeter Ujfalusi <peter.ujfalusi@ti.com>
Tested-by: default avatarKevin Hilman <khilman@linaro.org>
Tested-by: default avatarGrygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 998a0605
...@@ -481,6 +481,12 @@ static int twl_rtc_probe(struct platform_device *pdev) ...@@ -481,6 +481,12 @@ static int twl_rtc_probe(struct platform_device *pdev)
if (irq <= 0) if (irq <= 0)
goto out1; goto out1;
/* Initialize the register map */
if (twl_class_is_4030())
rtc_reg_map = (u8 *)twl4030_rtc_reg_map;
else
rtc_reg_map = (u8 *)twl6030_rtc_reg_map;
ret = twl_rtc_read_u8(&rd_reg, REG_RTC_STATUS_REG); ret = twl_rtc_read_u8(&rd_reg, REG_RTC_STATUS_REG);
if (ret < 0) if (ret < 0)
goto out1; goto out1;
...@@ -622,11 +628,6 @@ static struct platform_driver twl4030rtc_driver = { ...@@ -622,11 +628,6 @@ static struct platform_driver twl4030rtc_driver = {
static int __init twl_rtc_init(void) static int __init twl_rtc_init(void)
{ {
if (twl_class_is_4030())
rtc_reg_map = (u8 *) twl4030_rtc_reg_map;
else
rtc_reg_map = (u8 *) twl6030_rtc_reg_map;
return platform_driver_register(&twl4030rtc_driver); return platform_driver_register(&twl4030rtc_driver);
} }
module_init(twl_rtc_init); module_init(twl_rtc_init);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment