[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1419272149-28716-1-git-send-email-walter@vanguardiasur.com.ar>
Date: Mon, 22 Dec 2014 15:15:49 -0300
From: Walter Lozano <walter@...guardiasur.com.ar>
To: wsa@...-dreams.de, mika.westerberg@...ux.intel.com,
Romain.Baeriswyl@...lis.com, atull@...nsource.altera.com,
raymond.tan@...el.com, carlpeng008@...il.com,
linux-i2c@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: Walter Lozano <walter@...guardiasur.com.ar>
Subject: [RFC] i2c: designware: Avoid initcall and initialize the driver like a regular one
Currently, the driver is relying on a subsys_initcall() to register
the platform driver struct. This is typically done to allow early uses
of the I2C bus (for instance, I2C regulators used from early machine code).
While this might work on some cases, it breaks on others. For instance,
I2C devices with GPIO-wired interrupts will fail to request the
interrupt because of this initcall usage.
This commits attempts to fix the above issue, by converting the I2C
driver into a regular kernel platform driver. This guarantees it will
probe after GPIOs drivers.
Platforms based on devicetree won't be affected by this change. Legacy
platforms, relying on the I2C being available early, might need to
implement proper defered mechanisms to overcome potential problems.
Signed-off-by: Walter Lozano <walter@...guardiasur.com.ar>
---
drivers/i2c/busses/i2c-designware-platdrv.c | 12 +-----------
1 file changed, 1 insertion(+), 11 deletions(-)
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index 2b463c3..579e65c 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -333,17 +333,7 @@ static struct platform_driver dw_i2c_driver = {
},
};
-static int __init dw_i2c_init_driver(void)
-{
- return platform_driver_register(&dw_i2c_driver);
-}
-subsys_initcall(dw_i2c_init_driver);
-
-static void __exit dw_i2c_exit_driver(void)
-{
- platform_driver_unregister(&dw_i2c_driver);
-}
-module_exit(dw_i2c_exit_driver);
+module_platform_driver(dw_i2c_driver);
MODULE_AUTHOR("Baruch Siach <baruch@...s.co.il>");
MODULE_DESCRIPTION("Synopsys DesignWare I2C bus adapter");
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists