aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/busses/i2c-versatile.c
diff options
context:
space:
mode:
authorCatalin Marinas <catalin.marinas@arm.com>2009-02-12 09:57:20 -0500
committerRussell King <rmk+kernel@arm.linux.org.uk>2009-02-19 06:30:22 -0500
commit2514cca06be9dc7ae12908085ebaf0ef49e6d8ae (patch)
tree912c6b59bf5d82f8bd0e24a6ffe787c670bba4f2 /drivers/i2c/busses/i2c-versatile.c
parenteab184c2362567f2b2e951b7bd0e0d353a7e5091 (diff)
[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: Catalin Marinas <catalin.marinas@arm.com> Acked-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/i2c/busses/i2c-versatile.c')
-rw-r--r--drivers/i2c/busses/i2c-versatile.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/i2c/busses/i2c-versatile.c b/drivers/i2c/busses/i2c-versatile.c
index 4678babd3ce6..fede619ba227 100644
--- a/drivers/i2c/busses/i2c-versatile.c
+++ b/drivers/i2c/busses/i2c-versatile.c
@@ -102,7 +102,13 @@ static int i2c_versatile_probe(struct platform_device *dev)
102 i2c->algo = i2c_versatile_algo; 102 i2c->algo = i2c_versatile_algo;
103 i2c->algo.data = i2c; 103 i2c->algo.data = i2c;
104 104
105 ret = i2c_bit_add_bus(&i2c->adap); 105 if (dev->id >= 0) {
106 /* static bus numbering */
107 i2c->adap.nr = dev->id;
108 ret = i2c_bit_add_numbered_bus(&i2c->adap);
109 } else
110 /* dynamic bus numbering */
111 ret = i2c_bit_add_bus(&i2c->adap);
106 if (ret >= 0) { 112 if (ret >= 0) {
107 platform_set_drvdata(dev, i2c); 113 platform_set_drvdata(dev, i2c);
108 return 0; 114 return 0;
@@ -146,7 +152,7 @@ static void __exit i2c_versatile_exit(void)
146 platform_driver_unregister(&i2c_versatile_driver); 152 platform_driver_unregister(&i2c_versatile_driver);
147} 153}
148 154
149module_init(i2c_versatile_init); 155subsys_initcall(i2c_versatile_init);
150module_exit(i2c_versatile_exit); 156module_exit(i2c_versatile_exit);
151 157
152MODULE_DESCRIPTION("ARM Versatile I2C bus driver"); 158MODULE_DESCRIPTION("ARM Versatile I2C bus driver");