]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
drivers/rtc/rtc-twl.c: fix rtc_reg_map initialization
authorPeter Ujfalusi <peter.ujfalusi@ti.com>
Thu, 27 Jun 2013 23:53:41 +0000 (09:53 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Fri, 28 Jun 2013 06:38:50 +0000 (16:38 +1000)
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: Christoph Fritz <chf.fritz@googlemail.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
Tested-by: Kevin Hilman <khilman@linaro.org>
Tested-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
drivers/rtc/rtc-twl.c

index 3614874f7e3fb4dde9e143dd4e0e39289b4fb0fa..8a04044a9c1cfd950fe791edce538943ff2a39b0 100644 (file)
@@ -481,6 +481,12 @@ static int twl_rtc_probe(struct platform_device *pdev)
        if (irq <= 0)
                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);
        if (ret < 0)
                goto out1;
@@ -622,11 +628,6 @@ static struct platform_driver twl4030rtc_driver = {
 
 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);
 }
 module_init(twl_rtc_init);