Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: 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>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Peter Ujfalusi and committed by
Linus Torvalds
d3869ff6 998a0605

+6 -5
+6 -5
drivers/rtc/rtc-twl.c
··· 481 481 if (irq <= 0) 482 482 goto out1; 483 483 484 + /* Initialize the register map */ 485 + if (twl_class_is_4030()) 486 + rtc_reg_map = (u8 *)twl4030_rtc_reg_map; 487 + else 488 + rtc_reg_map = (u8 *)twl6030_rtc_reg_map; 489 + 484 490 ret = twl_rtc_read_u8(&rd_reg, REG_RTC_STATUS_REG); 485 491 if (ret < 0) 486 492 goto out1; ··· 628 622 629 623 static int __init twl_rtc_init(void) 630 624 { 631 - if (twl_class_is_4030()) 632 - rtc_reg_map = (u8 *) twl4030_rtc_reg_map; 633 - else 634 - rtc_reg_map = (u8 *) twl6030_rtc_reg_map; 635 - 636 625 return platform_driver_register(&twl4030rtc_driver); 637 626 } 638 627 module_init(twl_rtc_init);