aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/of/of_i2c.c
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2009-01-22 04:03:02 -0500
committerThomas Gleixner <tglx@linutronix.de>2009-01-22 04:03:02 -0500
commit6552ebae25ffd57574c6e72d17fce67fea08b918 (patch)
treecde6cc932c7e47d818154b011dfd8a6997d5c18e /drivers/of/of_i2c.c
parent749a440b2218e9937dca8c68e23e51ca4d8d37fe (diff)
parent336f6c322d87806ef93afad6308ac65083a865e5 (diff)
Merge branch 'core/debugobjects' into core/urgent
Diffstat (limited to 'drivers/of/of_i2c.c')
-rw-r--r--drivers/of/of_i2c.c19
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,
66} 66}
67EXPORT_SYMBOL(of_register_i2c_devices); 67EXPORT_SYMBOL(of_register_i2c_devices);
68 68
69static int of_dev_node_match(struct device *dev, void *data)
70{
71 return dev_archdata_get_node(&dev->archdata) == data;
72}
73
74/* must call put_device() when done with returned i2c_client device */
75struct i2c_client *of_find_i2c_device_by_node(struct device_node *node)
76{
77 struct device *dev;
78
79 dev = bus_find_device(&i2c_bus_type, NULL, node,
80 of_dev_node_match);
81 if (!dev)
82 return NULL;
83
84 return to_i2c_client(dev);
85}
86EXPORT_SYMBOL(of_find_i2c_device_by_node);
87
69MODULE_LICENSE("GPL"); 88MODULE_LICENSE("GPL");