From patchwork Fri Mar 16 10:58:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Zapolskiy X-Patchwork-Id: 10286925 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2F1EA60291 for ; Fri, 16 Mar 2018 10:59:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 21C832873F for ; Fri, 16 Mar 2018 10:59:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1686928E05; Fri, 16 Mar 2018 10:59:17 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 638E42873F for ; Fri, 16 Mar 2018 10:59:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753610AbeCPK7Q (ORCPT ); Fri, 16 Mar 2018 06:59:16 -0400 Received: from relay1.mentorg.com ([192.94.38.131]:61052 "EHLO relay1.mentorg.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753537AbeCPK7P (ORCPT ); Fri, 16 Mar 2018 06:59:15 -0400 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-MBX-04.mgc.mentorg.com) by relay1.mentorg.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-SHA384:256) id 1ewn4r-0005Zw-Hj from Vladimir_Zapolskiy@mentor.com ; Fri, 16 Mar 2018 03:59:13 -0700 Received: from eyas.local (137.202.0.87) by SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) with Microsoft SMTP Server (TLS) id 15.0.1320.4; Fri, 16 Mar 2018 10:59:09 +0000 From: Vladimir Zapolskiy To: Wolfram Sang CC: , , Eugeniu Rosca Subject: [PATCH] i2c: rcar: initialize earlier using subsys_initcall() Date: Fri, 16 Mar 2018 12:58:52 +0200 Message-ID: <1521197932-2073-1-git-send-email-vladimir_zapolskiy@mentor.com> X-Mailer: git-send-email 2.8.1 MIME-Version: 1.0 X-Originating-IP: [137.202.0.87] X-ClientProxiedBy: svr-ies-mbx-01.mgc.mentorg.com (139.181.222.1) To SVR-IES-MBX-04.mgc.mentorg.com (139.181.222.4) Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Eugeniu Rosca The purpose of this patch looks pretty similar to: 104522806a7d ("i2c: designware: dw_i2c_init_driver as subsys initcall") 74f56c4ad4e4 ("i2c-bfin-twi: move setup to the earlier subsys initcall") b8680784875b ("i2c-gpio: Move initialization code to subsys_initcall()") 5d3f33318a6c ("[PATCH] i2c-imx: make bus available early") ccb3bc16b489 ("i2c-sh_mobile: change module_init() to subsys_initcall()") 18dc83a6ea48 ("i2c: i2c-s3c2410: Initialise Samsung I2C controller early") 2514cca06be9 ("[ARM] 5394/1: Add static bus numbering support to i2c-versatile") 47a9b1379a5e ("i2c-pxa: Initialize early") However, the story behind it might be a bit different. Experimenting with async probing in various rcar-specific drivers (e.g. rcar-du, vsp1, rcar-fcp, rcar-vin), it was noticed that in most of the cases enabling async probing in one driver introduced some degree of inconsistency in the initialization of other builtin drivers. To give an example, with pure sequential driver initialization, based on 5 dmesg logs, the builtin kernel initialization deviation is around +/- 5ms, whereas after enabling async probing in e.g. vsp1 driver, the variance is increased to sometimes +/- 80ms or more. This patch fixes it and keeps the startup time consistent after switching certain i2c-dependent drivers to asynchronous probing on H3-es20-Salvator-X target. Another effect seems to be improving the init time of rcar_i2c_driver itself from ~7ms to ~1ms (assuming CONFIG_I2C_RCAR=y). Signed-off-by: Eugeniu Rosca Signed-off-by: Vladimir Zapolskiy --- drivers/i2c/busses/i2c-rcar.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-rcar.c b/drivers/i2c/busses/i2c-rcar.c index 4159ebcec2bb..502f62052b49 100644 --- a/drivers/i2c/busses/i2c-rcar.c +++ b/drivers/i2c/busses/i2c-rcar.c @@ -972,7 +972,18 @@ static struct platform_driver rcar_i2c_driver = { .remove = rcar_i2c_remove, }; -module_platform_driver(rcar_i2c_driver); +static int __init rcar_i2c_driver_init(void) +{ + return platform_driver_register(&rcar_i2c_driver); +} + +static void __exit rcar_i2c_driver_exit(void) +{ + return platform_driver_unregister(&rcar_i2c_driver); +} + +subsys_initcall(rcar_i2c_driver_init); +module_exit(rcar_i2c_driver_exit); MODULE_LICENSE("GPL v2"); MODULE_DESCRIPTION("Renesas R-Car I2C bus driver");