lkml.org 
[lkml]   [2008]   [Oct]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 1/6] of/base: Add new helper of_should_create_pdev()
This is used to check list of devices for which we should create
a dedicated device.

Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
---
drivers/of/base.c | 27 +++++++++++++++++++++++++++
include/linux/of.h | 1 +
2 files changed, 28 insertions(+), 0 deletions(-)

diff --git a/drivers/of/base.c b/drivers/of/base.c
index 7c79e94..1baeee3 100644
--- a/drivers/of/base.c
+++ b/drivers/of/base.c
@@ -458,6 +458,33 @@ int of_modalias_node(struct device_node *node, char *modalias, int len)
}
EXPORT_SYMBOL_GPL(of_modalias_node);

+/*
+ * The list of device's compatible entries for which drivers require
+ * platform_data to be filled. For such cases we create OF platform
+ * devices.
+ */
+static const char *of_pdev_list[] = {
+};
+
+/**
+ * of_should_create_pdev - See if a node needs a full-fledged OF device
+ * @node: pointer to a device tree node
+ *
+ * Based on the value of the compatible property, this routine will determine
+ * if a full-fledged device should be created for a node.
+ */
+bool of_should_create_pdev(struct device_node *node)
+{
+ unsigned int i;
+
+ for (i = 0; i < ARRAY_SIZE(of_pdev_list); i++) {
+ if (!of_device_is_compatible(node, of_pdev_list[i]))
+ return 1;
+ }
+ return 0;
+}
+EXPORT_SYMBOL_GPL(of_should_create_pdev);
+
/**
* of_parse_phandles_with_args - Find a node pointed by phandle in a list
* @np: pointer to a device tree node containing a list
diff --git a/include/linux/of.h b/include/linux/of.h
index e2488f5..d183533 100644
--- a/include/linux/of.h
+++ b/include/linux/of.h
@@ -71,6 +71,7 @@ extern int of_n_size_cells(struct device_node *np);
extern const struct of_device_id *of_match_node(
const struct of_device_id *matches, const struct device_node *node);
extern int of_modalias_node(struct device_node *node, char *modalias, int len);
+extern bool of_should_create_pdev(struct device_node *node);
extern int of_parse_phandles_with_args(struct device_node *np,
const char *list_name, const char *cells_name, int index,
struct device_node **out_node, const void **out_args);
--
1.5.6.3


\
 
 \ /
  Last update: 2008-10-28 18:49    [W:0.511 / U:0.476 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site