diff for duplicates of <4E81F42B.5070806@ti.com> diff --git a/a/1.txt b/N1/1.txt index 9588656..c5caa56 100644 --- a/a/1.txt +++ b/N1/1.txt @@ -76,152 +76,3 @@ Regards, Benoit --- ->From 4403f8a00090e5ea1814a5242947b81c348947a1 Mon Sep 17 00:00:00 2001 -From: Benoit Cousson <b-cousson@ti.com> -Date: Tue, 27 Sep 2011 17:45:43 +0200 -Subject: [PATCH] of: Add helpers to get one string in multiple strings property - -Add of_property_read_string_index and of_property_count_strings -to retrieve one string inside a property that will contains -severals strings. - -Signed-off-by: Benoit Cousson <b-cousson@ti.com> ---- - drivers/of/base.c | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++++ - include/linux/of.h | 18 +++++++++++ - 2 files changed, 103 insertions(+), 0 deletions(-) - -diff --git a/drivers/of/base.c b/drivers/of/base.c -index 3ff22e3..d97d53e 100644 ---- a/drivers/of/base.c -+++ b/drivers/of/base.c -@@ -662,6 +662,91 @@ int of_property_read_string(struct device_node *np, const char *propname, - EXPORT_SYMBOL_GPL(of_property_read_string); - - /** -+ * of_property_read_string_index - Find and read a string from a multiple -+ * strings property. -+ * @np: device node from which the property value is to be read. -+ * @propname: name of the property to be searched. -+ * @index: index of the string in the list of strings -+ * @out_string: pointer to null terminated return string, modified only if -+ * return value is 0. -+ * -+ * Search for a property in a device tree node and retrieve a null -+ * terminated string value (pointer to data, not a copy) in the list of strings -+ * contained in that property. -+ * Returns 0 on -+ * success, -EINVAL if the property does not exist, -ENODATA if property -+ * does not have a value, and -EILSEQ if the string is not null-terminated -+ * within the length of the property data. -+ * -+ * The out_string pointer is modified only if a valid string can be decoded. -+ */ -+int of_property_read_string_index(struct device_node *np, const char *propname, -+ int index, const char **output) -+{ -+ struct property *prop = of_find_property(np, propname, NULL); -+ int i = 0; -+ size_t l = 0, total = 0; -+ const char *p; -+ -+ if (!prop) -+ return -EINVAL; -+ if (!prop->value) -+ return -ENODATA; -+ if (strnlen(prop->value, prop->length) >= prop->length) -+ return -EILSEQ; -+ -+ p = prop->value; -+ -+ for (i = 0; total < prop->length; total += l, p += l) { -+ l = strlen(p) + 1; -+ if ((*p != 0) && (i++ == index)) { -+ *output = p; -+ return 0; -+ } -+ } -+ return -ENODATA; -+} -+EXPORT_SYMBOL_GPL(of_property_read_string_index); -+ -+ -+/** -+ * of_property_count_strings - Find and return the number of strings from a -+ * multiple strings property. -+ * @np: device node from which the property value is to be read. -+ * @propname: name of the property to be searched. -+ * -+ * Search for a property in a device tree node and retrieve the number of null -+ * terminated string contain in it. Returns the number of strings on -+ * success, -EINVAL if the property does not exist, -ENODATA if property -+ * does not have a value, and -EILSEQ if the string is not null-terminated -+ * within the length of the property data. -+ */ -+int of_property_count_strings(struct device_node *np, const char *propname) -+{ -+ struct property *prop = of_find_property(np, propname, NULL); -+ int i = 0; -+ size_t l = 0, total = 0; -+ const char *p; -+ -+ if (!prop) -+ return -EINVAL; -+ if (!prop->value) -+ return -ENODATA; -+ if (strnlen(prop->value, prop->length) >= prop->length) -+ return -EILSEQ; -+ -+ p = prop->value; -+ -+ for (i = 0; total < prop->length; total += l, p += l) { -+ l = strlen(p) + 1; -+ if (*p != 0) -+ i++; -+ } -+ return i; -+} -+EXPORT_SYMBOL_GPL(of_property_count_strings); -+ -+/** - * of_parse_phandle - Resolve a phandle property to a device_node pointer - * @np: Pointer to device node holding phandle property - * @phandle_name: Name of property holding a phandle value -diff --git a/include/linux/of.h b/include/linux/of.h -index 9180dc5..9eadc4e 100644 ---- a/include/linux/of.h -+++ b/include/linux/of.h -@@ -203,6 +203,11 @@ extern int of_property_read_u32_array(const struct device_node *np, - extern int of_property_read_string(struct device_node *np, - const char *propname, - const char **out_string); -+extern int of_property_read_string_index(struct device_node *np, -+ const char *propname, -+ int index, const char **output); -+extern int of_property_count_strings(struct device_node *np, -+ const char *propname); - extern int of_device_is_compatible(const struct device_node *device, - const char *); - extern int of_device_is_available(const struct device_node *device); -@@ -256,6 +261,19 @@ static inline int of_property_read_string(struct device_node *np, - return -ENOSYS; - } - -+static inline int of_property_read_string_index(struct device_node *np, -+ const char *propname, index, -+ const char **out_string) -+{ -+ return -ENOSYS; -+} -+ -+static inline int of_property_count_strings(struct device_node *np, -+ const char *propname) -+{ -+ return -ENOSYS; -+} -+ - static inline const void *of_get_property(const struct device_node *node, - const char *name, - int *lenp) --- -1.7.0.4 diff --git a/a/content_digest b/N1/content_digest index 34d91bb..c72b6ea 100644 --- a/a/content_digest +++ b/N1/content_digest @@ -1,14 +1,10 @@ "ref\01316724745-24896-1-git-send-email-b-cousson@ti.com\0" "ref\01316724745-24896-3-git-send-email-b-cousson@ti.com\0" "ref\020110927014632.GB20588@ponder.secretlab.ca\0" - "From\0Cousson, Benoit <b-cousson@ti.com>\0" - "Subject\0Re: [PATCH v3 2/2] OMAP: omap_device: Add a method to build an omap_device from a DT node\0" + "From\0b-cousson@ti.com (Cousson, Benoit)\0" + "Subject\0[PATCH v3 2/2] OMAP: omap_device: Add a method to build an omap_device from a DT node\0" "Date\0Tue, 27 Sep 2011 18:04:59 +0200\0" - "To\0Grant Likely <grant.likely@secretlab.ca>\0" - "Cc\0Hilman" - Kevin <khilman@ti.com> - linux-omap@vger.kernel.org <linux-omap@vger.kernel.org> - " linux-arm-kernel@lists.infradead.org <linux-arm-kernel@lists.infradead.org>\0" + "To\0linux-arm-kernel@lists.infradead.org\0" "\00:1\0" "b\0" "On 9/27/2011 3:46 AM, Grant Likely wrote:\n" @@ -88,155 +84,6 @@ "Regards,\n" "Benoit\n" "\n" - "---\n" - ">From 4403f8a00090e5ea1814a5242947b81c348947a1 Mon Sep 17 00:00:00 2001\n" - "From: Benoit Cousson <b-cousson@ti.com>\n" - "Date: Tue, 27 Sep 2011 17:45:43 +0200\n" - "Subject: [PATCH] of: Add helpers to get one string in multiple strings property\n" - "\n" - "Add of_property_read_string_index and of_property_count_strings\n" - "to retrieve one string inside a property that will contains\n" - "severals strings.\n" - "\n" - "Signed-off-by: Benoit Cousson <b-cousson@ti.com>\n" - "---\n" - " drivers/of/base.c | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++++\n" - " include/linux/of.h | 18 +++++++++++\n" - " 2 files changed, 103 insertions(+), 0 deletions(-)\n" - "\n" - "diff --git a/drivers/of/base.c b/drivers/of/base.c\n" - "index 3ff22e3..d97d53e 100644\n" - "--- a/drivers/of/base.c\n" - "+++ b/drivers/of/base.c\n" - "@@ -662,6 +662,91 @@ int of_property_read_string(struct device_node *np, const char *propname,\n" - " EXPORT_SYMBOL_GPL(of_property_read_string);\n" - " \n" - " /**\n" - "+ * of_property_read_string_index - Find and read a string from a multiple\n" - "+ * strings property.\n" - "+ * @np:\t\tdevice node from which the property value is to be read.\n" - "+ * @propname:\tname of the property to be searched.\n" - "+ * @index:\tindex of the string in the list of strings\n" - "+ * @out_string:\tpointer to null terminated return string, modified only if\n" - "+ *\t\treturn value is 0.\n" - "+ *\n" - "+ * Search for a property in a device tree node and retrieve a null\n" - "+ * terminated string value (pointer to data, not a copy) in the list of strings\n" - "+ * contained in that property.\n" - "+ * Returns 0 on\n" - "+ * success, -EINVAL if the property does not exist, -ENODATA if property\n" - "+ * does not have a value, and -EILSEQ if the string is not null-terminated\n" - "+ * within the length of the property data.\n" - "+ *\n" - "+ * The out_string pointer is modified only if a valid string can be decoded.\n" - "+ */\n" - "+int of_property_read_string_index(struct device_node *np, const char *propname,\n" - "+\t\t\t\t int index, const char **output)\n" - "+{\n" - "+\tstruct property *prop = of_find_property(np, propname, NULL);\n" - "+\tint i = 0;\n" - "+\tsize_t l = 0, total = 0;\n" - "+\tconst char *p;\n" - "+\n" - "+\tif (!prop)\n" - "+\t\treturn -EINVAL;\n" - "+\tif (!prop->value)\n" - "+\t\treturn -ENODATA;\n" - "+\tif (strnlen(prop->value, prop->length) >= prop->length)\n" - "+\t\treturn -EILSEQ;\n" - "+\n" - "+\tp = prop->value;\n" - "+\n" - "+\tfor (i = 0; total < prop->length; total += l, p += l) {\n" - "+\t\tl = strlen(p) + 1;\n" - "+\t\tif ((*p != 0) && (i++ == index)) {\n" - "+\t\t\t*output = p;\n" - "+\t\t\treturn 0;\n" - "+\t\t}\n" - "+\t}\n" - "+\treturn -ENODATA;\n" - "+}\n" - "+EXPORT_SYMBOL_GPL(of_property_read_string_index);\n" - "+\n" - "+\n" - "+/**\n" - "+ * of_property_count_strings - Find and return the number of strings from a\n" - "+ * multiple strings property.\n" - "+ * @np:\t\tdevice node from which the property value is to be read.\n" - "+ * @propname:\tname of the property to be searched.\n" - "+ *\n" - "+ * Search for a property in a device tree node and retrieve the number of null\n" - "+ * terminated string contain in it. Returns the number of strings on\n" - "+ * success, -EINVAL if the property does not exist, -ENODATA if property\n" - "+ * does not have a value, and -EILSEQ if the string is not null-terminated\n" - "+ * within the length of the property data.\n" - "+ */\n" - "+int of_property_count_strings(struct device_node *np, const char *propname)\n" - "+{\n" - "+\tstruct property *prop = of_find_property(np, propname, NULL);\n" - "+\tint i = 0;\n" - "+\tsize_t l = 0, total = 0;\n" - "+\tconst char *p;\n" - "+\n" - "+\tif (!prop)\n" - "+\t\treturn -EINVAL;\n" - "+\tif (!prop->value)\n" - "+\t\treturn -ENODATA;\n" - "+\tif (strnlen(prop->value, prop->length) >= prop->length)\n" - "+\t\treturn -EILSEQ;\n" - "+\n" - "+\tp = prop->value;\n" - "+\n" - "+\tfor (i = 0; total < prop->length; total += l, p += l) {\n" - "+\t\tl = strlen(p) + 1;\n" - "+\t\tif (*p != 0)\n" - "+\t\t\ti++;\n" - "+\t}\n" - "+\treturn i;\n" - "+}\n" - "+EXPORT_SYMBOL_GPL(of_property_count_strings);\n" - "+\n" - "+/**\n" - " * of_parse_phandle - Resolve a phandle property to a device_node pointer\n" - " * @np: Pointer to device node holding phandle property\n" - " * @phandle_name: Name of property holding a phandle value\n" - "diff --git a/include/linux/of.h b/include/linux/of.h\n" - "index 9180dc5..9eadc4e 100644\n" - "--- a/include/linux/of.h\n" - "+++ b/include/linux/of.h\n" - "@@ -203,6 +203,11 @@ extern int of_property_read_u32_array(const struct device_node *np,\n" - " extern int of_property_read_string(struct device_node *np,\n" - " \t\t\t\t const char *propname,\n" - " \t\t\t\t const char **out_string);\n" - "+extern int of_property_read_string_index(struct device_node *np,\n" - "+\t\t\t\t\t const char *propname,\n" - "+\t\t\t\t\t int index, const char **output);\n" - "+extern int of_property_count_strings(struct device_node *np,\n" - "+\t\t\t\t const char *propname);\n" - " extern int of_device_is_compatible(const struct device_node *device,\n" - " \t\t\t\t const char *);\n" - " extern int of_device_is_available(const struct device_node *device);\n" - "@@ -256,6 +261,19 @@ static inline int of_property_read_string(struct device_node *np,\n" - " \treturn -ENOSYS;\n" - " }\n" - " \n" - "+static inline int of_property_read_string_index(struct device_node *np,\n" - "+\t\t\t\t\t\tconst char *propname, index,\n" - "+\t\t\t\t\t\tconst char **out_string)\n" - "+{\n" - "+\treturn -ENOSYS;\n" - "+}\n" - "+\n" - "+static inline int of_property_count_strings(struct device_node *np,\n" - "+\t\t\t\t\t const char *propname)\n" - "+{\n" - "+\treturn -ENOSYS;\n" - "+}\n" - "+\n" - " static inline const void *of_get_property(const struct device_node *node,\n" - " \t\t\t\tconst char *name,\n" - " \t\t\t\tint *lenp)\n" - "-- \n" - 1.7.0.4 + --- -02f5fbb39e6fcfeef6a43bf7aab4321261a9c4a31b591d98ed66d92f77f0d5fe +5d3a11fdedc738ae21e4c96edfe31cc4f33d13cdc9c39642502ab893f8681ff5
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.