diff options
| author | Peter Ujfalusi <peter.ujfalusi@ti.com> | 2013-07-03 18:07:55 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-07-03 19:08:00 -0400 |
| commit | d3869ff684cb96ccfaf3c3a9a302fe3b7e976b02 (patch) | |
| tree | bfeb0b65a9c71824b9c694db5f876f358c7ceb7b /drivers | |
| parent | 998a06051afe6cba392eab66fa0ef1d7e7376f6c (diff) | |
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>
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/rtc/rtc-twl.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c index 3614874f7e3f..8a04044a9c1c 100644 --- a/drivers/rtc/rtc-twl.c +++ b/drivers/rtc/rtc-twl.c | |||
| @@ -481,6 +481,12 @@ static int twl_rtc_probe(struct platform_device *pdev) | |||
| 481 | if (irq <= 0) | 481 | if (irq <= 0) |
| 482 | goto out1; | 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 | ret = twl_rtc_read_u8(&rd_reg, REG_RTC_STATUS_REG); | 490 | ret = twl_rtc_read_u8(&rd_reg, REG_RTC_STATUS_REG); |
| 485 | if (ret < 0) | 491 | if (ret < 0) |
| 486 | goto out1; | 492 | goto out1; |
| @@ -622,11 +628,6 @@ static struct platform_driver twl4030rtc_driver = { | |||
| 622 | 628 | ||
| 623 | static int __init twl_rtc_init(void) | 629 | static int __init twl_rtc_init(void) |
| 624 | { | 630 | { |
| 625 | if (twl_class_is_4030()) | ||
| 626 | rtc_reg_map = (u8 *) twl4030_rtc_reg_map; | ||
| 627 | else | ||
| 628 | rtc_reg_map = (u8 *) twl6030_rtc_reg_map; | ||
| 629 | |||
| 630 | return platform_driver_register(&twl4030rtc_driver); | 631 | return platform_driver_register(&twl4030rtc_driver); |
| 631 | } | 632 | } |
| 632 | module_init(twl_rtc_init); | 633 | module_init(twl_rtc_init); |
