Patchwork [1/2] i2c: omap: convert to module_platform_driver()

login
register
mail settings
Submitter Grygorii Strashko
Date April 23, 2013, 1:19 p.m.
Message ID <1366723151-23209-2-git-send-email-grygorii.strashko@ti.com>
Download mbox | patch
Permalink /patch/238907/
State Superseded
Headers show

Comments

Grygorii Strashko - April 23, 2013, 1:19 p.m.
The OMAP I2C driver has a relation to pinctrl-single driver. As result,
its probe will be deferred during system boot until late init time,
because the pinctrl-single is initizalized as moudle/device init time.
This, in turn, will delay initialization of all I2C devices (like mfd,
I2C regulators and etc.) and cause boot delay (more over, it can broken
initialization of drivers which are not ready to use deferred probe
mechanism yet, for example DSS).

There are no sense to keep OMAP I2C initialization on subsys init layer
any more, hence shift it to module/device layer where the i2c <-->
pinctrl-single dependency is resolved in drivers/Makefile now.

Cc: Wolfram Sang <wsa@the-dreams.de>
Cc: "Ben Dooks (embedded platforms)" <ben-linux@fluff.org>
Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
Cc: linux-omap@vger.kernel.org
Cc: linux-i2c@vger.kernel.org
Cc: linux-kernel@vger.kernel.org

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
---
 drivers/i2c/busses/i2c-omap.c |   14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)
Kevin Hilman - June 3, 2013, 8:59 p.m.
Grygorii Strashko <grygorii.strashko@ti.com> writes:

> The OMAP I2C driver has a relation to pinctrl-single driver. As result,
> its probe will be deferred during system boot until late init time,
> because the pinctrl-single is initizalized as moudle/device init time.
> This, in turn, will delay initialization of all I2C devices (like mfd,
> I2C regulators and etc.) and cause boot delay (more over, it can broken
> initialization of drivers which are not ready to use deferred probe
> mechanism yet, for example DSS).
>
> There are no sense to keep OMAP I2C initialization on subsys init layer
> any more, hence shift it to module/device layer where the i2c <-->
> pinctrl-single dependency is resolved in drivers/Makefile now.
>
> Cc: Wolfram Sang <wsa@the-dreams.de>
> Cc: "Ben Dooks (embedded platforms)" <ben-linux@fluff.org>
> Cc: Santosh Shilimkar <santosh.shilimkar@ti.com>
> Cc: linux-omap@vger.kernel.org
> Cc: linux-i2c@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
>
> Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>

Testing this patch with PATCH 1/2, the twl_rtc driver fails to correctly
initialize on OMAP3:

         twl_rtc rtc.22: hctosys: invalid date/time

instead of the expected result:

          twl_rtc rtc.22: setting system clock to 2000-01-01 00:00:00 UTC (946684800)

so something is still not right for the init sequence.

Kevin
--
To unsubscribe from this list: send the line "unsubscribe linux-i2c" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 4cc2f05..70d3fed 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -1342,19 +1342,7 @@  static struct platform_driver omap_i2c_driver = {
 	},
 };
 
-/* I2C may be needed to bring up other drivers */
-static int __init
-omap_i2c_init_driver(void)
-{
-	return platform_driver_register(&omap_i2c_driver);
-}
-subsys_initcall(omap_i2c_init_driver);
-
-static void __exit omap_i2c_exit_driver(void)
-{
-	platform_driver_unregister(&omap_i2c_driver);
-}
-module_exit(omap_i2c_exit_driver);
+module_platform_driver(omap_i2c_driver);
 
 MODULE_AUTHOR("MontaVista Software, Inc. (and others)");
 MODULE_DESCRIPTION("TI OMAP I2C bus adapter");