From patchwork Tue Apr 16 07:44:22 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 236848 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from mail-oa0-f57.google.com (mail-oa0-f57.google.com [209.85.219.57]) (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 DE80B2C00F3 for ; Tue, 16 Apr 2013 17:44:31 +1000 (EST) Received: by mail-oa0-f57.google.com with SMTP id o17sf46592oag.22 for ; Tue, 16 Apr 2013 00:44:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20120806; h=x-received:x-beenthere:x-received:received-spf: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=ABBLqgDHj6POJjq3ONpZk3dv2H1e1CQsPigJ9i8Vcho=; b=QcnzCxQu5E1Z8tZygddHOcDlU9HwdDPXIuyx40hWgDnsxn7wR9E5K90cot7RazURLp giQPDAvmodLjdKUqni/9v7zRREsyQpX+OtgmblXsiKnzW9E1zs/2yYXv6ZBYdBGbFXo5 qD4G67aLVcZoIcm5vHM51EOqwbJlj7d8ZTy/tbdLwkm9MztztyZlFmG2iikPI18/yqiS phmd3N+X+ijcTlP1M2KRCMQTEY7uaAd1DfdQ9UtMMOVtpG0evAPQpiF9jrzEhOyoUPRU yW8uRdwjgl3KyLO8vaUSGyGLnIeSCTeg/ilpQG1eoiYk/oHK7yJV/5XoqjTpNCDNow2o Q6+w== X-Received: by 10.49.0.48 with SMTP id 16mr52696qeb.6.1366098268659; Tue, 16 Apr 2013 00:44:28 -0700 (PDT) X-BeenThere: rtc-linux@googlegroups.com Received: by 10.49.130.200 with SMTP id og8ls160497qeb.61.gmail; Tue, 16 Apr 2013 00:44:27 -0700 (PDT) X-Received: by 10.224.160.65 with SMTP id m1mr1122164qax.2.1366098267636; Tue, 16 Apr 2013 00:44:27 -0700 (PDT) Received: from comal.ext.ti.com (comal.ext.ti.com. [198.47.26.152]) by gmr-mx.google.com with ESMTPS id y8si152534qcx.0.2013.04.16.00.44.27 (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 16 Apr 2013 00:44:27 -0700 (PDT) Received-SPF: pass (google.com: domain of peter.ujfalusi@ti.com designates 198.47.26.152 as permitted sender) client-ip=198.47.26.152; Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id r3G7iQxr018672; Tue, 16 Apr 2013 02:44:26 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id r3G7iPsJ005573; Tue, 16 Apr 2013 02:44:26 -0500 Received: from dlelxv22.itg.ti.com (172.17.1.197) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.2.342.3; Tue, 16 Apr 2013 02:44:25 -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 r3G7iOnO012433; Tue, 16 Apr 2013 02:44:24 -0500 From: Peter Ujfalusi To: Alessandro Zummo , Tony Lindgren CC: , , , Christoph Fritz , Grygorii Strashko Subject: [rtc-linux] [PATCH] RTC: rtc-twl: Convert to module_platform_driver() and relocate reg_map init Date: Tue, 16 Apr 2013 09:44:22 +0200 Message-ID: <1366098262-20726-1-git-send-email-peter.ujfalusi@ti.com> X-Mailer: git-send-email 1.8.1.5 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.152 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: , Convert the driver to use module_platform_driver() to register the platform driver and relocate the rtc_reg_map initialization to platform driver's probe function. In this way we can make sure that the twl-core has been already probed since the core driver will create the device at the end of it's probe function. Reported-by: Christoph Fritz Signed-off-by: Peter Ujfalusi --- Hi Tony, Alessandro, Christoph, I think this patch is the correct solution for the issue Christoph reported: http://www.spinics.net/lists/linux-omap/msg89980.html We can make sure that the twl-core has been already probed and initialized when the RTC driver tries to pick the correct register map. Regards, Peter drivers/rtc/rtc-twl.c | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/drivers/rtc/rtc-twl.c b/drivers/rtc/rtc-twl.c index 8bc6c80..22b2fd6 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; @@ -612,22 +618,7 @@ 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); - -static void __exit twl_rtc_exit(void) -{ - platform_driver_unregister(&twl4030rtc_driver); -} -module_exit(twl_rtc_exit); +module_platform_driver(twl4030rtc_driver); MODULE_AUTHOR("Texas Instruments, MontaVista Software"); MODULE_LICENSE("GPL");