diff options
author | Wolfram Sang <wsa+renesas@sang-engineering.com> | 2015-03-12 12:17:59 -0400 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2015-03-18 08:42:14 -0400 |
commit | 03bde7c31a360f814ca42101d60563b1b803dca1 (patch) | |
tree | def8c38af9087e4afe4849ebc5abbda33f109fa3 /drivers | |
parent | 351d224f64afc1b3b359a1738b7d4600c7e64061 (diff) |
i2c: busses with dynamic ids should start after fixed ids for DT
Make sure dynamic ids do not interfere with fixed ones and let them
start after the highest fixed id. This patch might cause different
bus-numbers than before for dynamic ids, however it fixes a bug. Assume:
- fixed id0 defers probe
- fixed id1 succeeds and registers a muxed bus with dynamic id
- muxed bus gets id0
- fixed id0 wants to probe again, but its fixed id is gone now
- fixed id0 probe fails
With this patch, the fixed ids are always reserved in the DT case.
For legacy board init, we already have a mechanism like this in
i2c_register_board_info().
Reported-by: Bob Feretich <bob.feretich@rafresearch.com>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/i2c/i2c-core.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 57a86f4aab43..fe80f85896e2 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -1878,6 +1878,13 @@ static int __init i2c_init(void) | |||
1878 | { | 1878 | { |
1879 | int retval; | 1879 | int retval; |
1880 | 1880 | ||
1881 | retval = of_alias_get_highest_id("i2c"); | ||
1882 | |||
1883 | down_write(&__i2c_board_lock); | ||
1884 | if (retval >= __i2c_first_dynamic_bus_num) | ||
1885 | __i2c_first_dynamic_bus_num = retval + 1; | ||
1886 | up_write(&__i2c_board_lock); | ||
1887 | |||
1881 | retval = bus_register(&i2c_bus_type); | 1888 | retval = bus_register(&i2c_bus_type); |
1882 | if (retval) | 1889 | if (retval) |
1883 | return retval; | 1890 | return retval; |