Commit 2514cca0 authored by Catalin Marinas's avatar Catalin Marinas Committed by Russell King
Browse files

[ARM] 5394/1: Add static bus numbering support to i2c-versatile



If dev->id is not -1, the platform code may use static bus numbering
rather than dynamic. The patch also changes the i2c_versatile_init to a
subsys_initcall rather than module_init to make sure it is initialised
before the I2C devices initialisation.
Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
Acked-by: default avatarJean Delvare <khali@linux-fr.org>
Signed-off-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
parent eab184c2
...@@ -102,6 +102,12 @@ static int i2c_versatile_probe(struct platform_device *dev) ...@@ -102,6 +102,12 @@ static int i2c_versatile_probe(struct platform_device *dev)
i2c->algo = i2c_versatile_algo; i2c->algo = i2c_versatile_algo;
i2c->algo.data = i2c; i2c->algo.data = i2c;
if (dev->id >= 0) {
/* static bus numbering */
i2c->adap.nr = dev->id;
ret = i2c_bit_add_numbered_bus(&i2c->adap);
} else
/* dynamic bus numbering */
ret = i2c_bit_add_bus(&i2c->adap); ret = i2c_bit_add_bus(&i2c->adap);
if (ret >= 0) { if (ret >= 0) {
platform_set_drvdata(dev, i2c); platform_set_drvdata(dev, i2c);
...@@ -146,7 +152,7 @@ static void __exit i2c_versatile_exit(void) ...@@ -146,7 +152,7 @@ static void __exit i2c_versatile_exit(void)
platform_driver_unregister(&i2c_versatile_driver); platform_driver_unregister(&i2c_versatile_driver);
} }
module_init(i2c_versatile_init); subsys_initcall(i2c_versatile_init);
module_exit(i2c_versatile_exit); module_exit(i2c_versatile_exit);
MODULE_DESCRIPTION("ARM Versatile I2C bus driver"); MODULE_DESCRIPTION("ARM Versatile I2C bus driver");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment