OSDN Git Service

i2c: core: Pick i2c bus number from dt alias if present
authorDoug Anderson <dianders@chromium.org>
Fri, 1 Mar 2013 16:57:31 +0000 (08:57 -0800)
committerWolfram Sang <wsa@the-dreams.de>
Sun, 24 Mar 2013 09:30:53 +0000 (10:30 +0100)
commitee5c27440cc24d62ec463cce4c000bb32c5692c7
tree9f6a2bfdeff932a5ac6a42f1f6cbec7f1d22f5b4
parent8bb9660418e05bb1845ac1a2428444d78e322cc7
i2c: core: Pick i2c bus number from dt alias if present

This allows you to get the equivalent functionality of
i2c_add_numbered_adapter() with all data in the device tree and no
special case code in your driver.  This is a common device tree
technique.

For quick reference, the FDT syntax for using an alias to provide an
ID looks like:
  aliases {
    i2c0 = &i2c_0;
    i2c1 = &i2c_1;
  };

Signed-off-by: Doug Anderson <dianders@chromium.org>
[wsa: removed one check from static function. We know our callers]
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
drivers/i2c/i2c-core.c