lkml.org 
[lkml]   [2012]   [Oct]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] i2c: Export capability to probe devices
Date
Probe devices for a node other that the adapter node.

Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com>
---
drivers/of/of_i2c.c | 14 ++++++++++----
include/linux/of_i2c.h | 3 +++
2 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/of/of_i2c.c b/drivers/of/of_i2c.c
index 3550f3b..7f36b05 100644
--- a/drivers/of/of_i2c.c
+++ b/drivers/of/of_i2c.c
@@ -18,18 +18,18 @@
#include <linux/of_irq.h>
#include <linux/module.h>

-void of_i2c_register_devices(struct i2c_adapter *adap)
+void of_i2c_register_node_devices(struct i2c_adapter *adap,
+ struct device_node *parent_node)
{
void *result;
struct device_node *node;

- /* Only register child devices if the adapter has a node pointer set */
- if (!adap->dev.of_node)
+ if (!parent_node)
return;

dev_dbg(&adap->dev, "of_i2c: walking child nodes\n");

- for_each_child_of_node(adap->dev.of_node, node) {
+ for_each_child_of_node(parent_node, node) {
struct i2c_board_info info = {};
struct dev_archdata dev_ad = {};
const __be32 *addr;
@@ -76,6 +76,12 @@ void of_i2c_register_devices(struct i2c_adapter *adap)
}
}
}
+EXPORT_SYMBOL(of_i2c_register_node_devices);
+
+void of_i2c_register_devices(struct i2c_adapter *adap)
+{
+ of_i2c_register_node_devices(adap, adap->dev.of_node);
+}
EXPORT_SYMBOL(of_i2c_register_devices);

static int of_dev_node_match(struct device *dev, void *data)
diff --git a/include/linux/of_i2c.h b/include/linux/of_i2c.h
index 1cb775f..d2f8ebb6 100644
--- a/include/linux/of_i2c.h
+++ b/include/linux/of_i2c.h
@@ -15,6 +15,9 @@
#if defined(CONFIG_OF_I2C) || defined(CONFIG_OF_I2C_MODULE)
#include <linux/i2c.h>

+extern void of_i2c_register_node_devices(struct i2c_adapter *adap,
+ struct device_node *parent_node);
+
extern void of_i2c_register_devices(struct i2c_adapter *adap);

/* must call put_device() when done with returned i2c_client device */
--
1.7.12


\
 
 \ /
  Last update: 2012-10-30 22:01    [W:0.038 / U:0.160 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site