From patchwork Tue Apr 16 08:30:12 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 2448251 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 8D1D8DF230 for ; Tue, 16 Apr 2013 08:31:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935688Ab3DPIau (ORCPT ); Tue, 16 Apr 2013 04:30:50 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:34141 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934696Ab3DPIas (ORCPT ); Tue, 16 Apr 2013 04:30:48 -0400 Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id r3G8UGGW023498; Tue, 16 Apr 2013 03:30:16 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id r3G8UGWV025433; Tue, 16 Apr 2013 03:30:16 -0500 Received: from dlelxv22.itg.ti.com (172.17.1.197) by DLEE71.ent.ti.com (157.170.170.114) with Microsoft SMTP Server id 14.2.342.3; Tue, 16 Apr 2013 03:30:15 -0500 Received: from barack.emea.dhcp.ti.com (barack.emea.dhcp.ti.com [137.167.125.74]) by dlelxv22.itg.ti.com (8.13.8/8.13.8) with ESMTP id r3G8UESQ032016; Tue, 16 Apr 2013 03:30:14 -0500 From: Peter Ujfalusi To: Alessandro Zummo , Tony Lindgren CC: , , , Christoph Fritz , Grygorii Strashko , Tomi Valkeinen Subject: [PATCH v2 1/2] RTC: rtc-twl: Fix rtc_reg_map initialization Date: Tue, 16 Apr 2013 10:30:12 +0200 Message-ID: <1366101013-21183-1-git-send-email-peter.ujfalusi@ti.com> X-Mailer: git-send-email 1.8.1.5 MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org 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 it's init. Reported-by: Christoph Fritz Signed-off-by: Peter Ujfalusi Tested-by: Kevin Hilman --- Hi, As Tomi commented on the first version: www.spinics.net/lists/linux-omap/msg90064.html www.spinics.net/lists/linux-omap/msg90066.html I have separated the actual fix from the module_platform_driver() conversion. Regards, Peter drivers/rtc/rtc-twl.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c index 8bc6c80..c385e9b 100644 --- a/drivers/rtc/rtc-twl.c +++ b/drivers/rtc/rtc-twl.c @@ -469,6 +469,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; @@ -614,11 +620,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);