diff options
author | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2009-01-13 13:59:11 +1100 |
---|---|---|
committer | Benjamin Herrenschmidt <benh@kernel.crashing.org> | 2009-01-13 13:59:11 +1100 |
commit | bd1f7936ab5138d7e5e4f61bb4371e2994b2b2c5 (patch) | |
tree | 09e5424736112005c309fcd5cb572111f265197e /drivers/of/of_i2c.c | |
parent | 30aae739a9eb6db31ad7b08dac44bd302f41c709 (diff) | |
parent | ff82c587a9a4cb8796e7e04377155deba15ae18b (diff) | |
download | linux-bd1f7936ab5138d7e5e4f61bb4371e2994b2b2c5.tar.bz2 |
Merge commit 'gcl/gcl-next' into next
Diffstat (limited to 'drivers/of/of_i2c.c')
-rw-r--r-- | drivers/of/of_i2c.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/drivers/of/of_i2c.c b/drivers/of/of_i2c.c index e1b0ad6e918f..fa65a2b2ae2e 100644 --- a/drivers/of/of_i2c.c +++ b/drivers/of/of_i2c.c @@ -66,4 +66,23 @@ void of_register_i2c_devices(struct i2c_adapter *adap, } EXPORT_SYMBOL(of_register_i2c_devices); +static int of_dev_node_match(struct device *dev, void *data) +{ + return dev_archdata_get_node(&dev->archdata) == data; +} + +/* must call put_device() when done with returned i2c_client device */ +struct i2c_client *of_find_i2c_device_by_node(struct device_node *node) +{ + struct device *dev; + + dev = bus_find_device(&i2c_bus_type, NULL, node, + of_dev_node_match); + if (!dev) + return NULL; + + return to_i2c_client(dev); +} +EXPORT_SYMBOL(of_find_i2c_device_by_node); + MODULE_LICENSE("GPL"); |