From patchwork Thu Jun 6 08:13:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 249316 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-gg0-x237.google.com (mail-gg0-x237.google.com [IPv6:2607:f8b0:4002:c02::237]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 8A8B62C02B4 for ; Thu, 6 Jun 2013 18:13:44 +1000 (EST) Received: by mail-gg0-f183.google.com with SMTP id q1sf713368ggm.20 for ; Thu, 06 Jun 2013 01:13:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=x-beenthere:from:to:cc:subject:date:message-id:x-mailer :mime-version:x-original-sender:x-original-authentication-results :reply-to:precedence:mailing-list:list-id:x-google-group-id :list-post:list-help:list-archive:sender:list-subscribe :list-unsubscribe:content-type; bh=GWRQv7d2M1250UXFpknf6BbkByKQSFaU7TaddHt6+l8=; b=fH/pSEVFYYx0/tGI+EPhsjnnazFLavGccJeri3+0Ojg+P3xhnehorEcVcTwrYXnHJT UbMec46gS7lleaNMXpehqyg/uQs8h+OK799yZ+vyXjyMQJIQ07KC3sCvapHG4J5WBg9g oT1IyT7yHQ8jx1QpCJqYxYmFuTe3hSf1TQyH6mKkIiyAd0qXwb9LAnY6j1BpqMmoqwex hHRbMsnyVZCsJZF3bDA9SidlKSZs5IktqyjQYRg+AntzkIgVScNi9avUsdB3y0HKhKxG kke183Qx3TjV44LFWYiiX+pQYaUmTPAuBO9SYCqPCeeZFWb0zjBdHy82w58SuPMpy6D+ zdqw== X-Received: by 10.50.98.1 with SMTP id ee1mr1521912igb.5.1370506421722; Thu, 06 Jun 2013 01:13:41 -0700 (PDT) X-BeenThere: rtc-linux@googlegroups.com Received: by 10.50.6.47 with SMTP id x15ls4259587igx.21.canary; Thu, 06 Jun 2013 01:13:41 -0700 (PDT) X-Received: by 10.50.50.33 with SMTP id z1mr8575908ign.6.1370506421089; Thu, 06 Jun 2013 01:13:41 -0700 (PDT) Received: from devils.ext.ti.com (devils.ext.ti.com. [198.47.26.153]) by gmr-mx.google.com with ESMTPS id b5si950052igx.3.2013.06.06.01.13.40 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 06 Jun 2013 01:13:41 -0700 (PDT) Received-SPF: pass (google.com: domain of peter.ujfalusi@ti.com designates 198.47.26.153 as permitted sender) client-ip=198.47.26.153; Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id r568Ddpt005827; Thu, 6 Jun 2013 03:13:39 -0500 Received: from DLEE71.ent.ti.com (dlee71.ent.ti.com [157.170.170.114]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id r568Ddau015993; Thu, 6 Jun 2013 03:13:39 -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; Thu, 6 Jun 2013 03:13:38 -0500 Received: from barack.itg.ti.com (h0-70.vpn.ti.com [172.24.0.70]) by dlelxv22.itg.ti.com (8.13.8/8.13.8) with ESMTP id r568DaEW008675; Thu, 6 Jun 2013 03:13:36 -0500 From: Peter Ujfalusi To: Andrew Morton CC: Tony Lindgren , Alessandro Zummo , Thomas Gleixner , , , , Grygorii Strashko , Tomi Valkeinen Subject: [rtc-linux] [PATCH v3 1/2] RTC: rtc-twl: Fix rtc_reg_map initialization Date: Thu, 6 Jun 2013 10:13:37 +0200 Message-ID: <1370506418-1491-1-git-send-email-peter.ujfalusi@ti.com> X-Mailer: git-send-email 1.8.2.1 MIME-Version: 1.0 X-Original-Sender: peter.ujfalusi@ti.com X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of peter.ujfalusi@ti.com designates 198.47.26.153 as permitted sender) smtp.mail=peter.ujfalusi@ti.com Reply-To: rtc-linux@googlegroups.com Precedence: list Mailing-list: list rtc-linux@googlegroups.com; contact rtc-linux+owners@googlegroups.com List-ID: X-Google-Group-Id: 712029733259 List-Post: , List-Help: , List-Archive: Sender: rtc-linux@googlegroups.com List-Subscribe: , List-Unsubscribe: , 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 Tested-by: Grygorii Strashko --- Hi, Changes since v2: - Acked-by and Tested-by added to patches - Recreated on top of 3.10-rc4 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 8751a52..c9060e9 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; @@ -610,11 +616,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);