libfdt: Bring in upstream stringlist functions
These have now landed upstream. The naming is different and in one case the function signature has changed. Update the code to match. This applies the following upstream commits by Thierry Reding <treding@nvidia.com> : 604e61e fdt: Add functions to retrieve strings 8702bd1 fdt: Add a function to get the index of a string 2218387 fdt: Add a function to count strings Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
@@ -71,7 +71,7 @@ int exynos_pinctrl_set_state(struct udevice *dev, struct udevice *config)
|
||||
{
|
||||
const void *fdt = gd->fdt_blob;
|
||||
int node = config->of_offset;
|
||||
unsigned int count, idx, pin_num, ret;
|
||||
unsigned int count, idx, pin_num;
|
||||
unsigned int pinfunc, pinpud, pindrv;
|
||||
unsigned long reg, value;
|
||||
const char *name;
|
||||
@@ -80,7 +80,7 @@ int exynos_pinctrl_set_state(struct udevice *dev, struct udevice *config)
|
||||
* refer to the following document for the pinctrl bindings
|
||||
* linux/Documentation/devicetree/bindings/pinctrl/samsung-pinctrl.txt
|
||||
*/
|
||||
count = fdt_count_strings(fdt, node, "samsung,pins");
|
||||
count = fdt_stringlist_count(fdt, node, "samsung,pins");
|
||||
if (count <= 0)
|
||||
return -EINVAL;
|
||||
|
||||
@@ -89,9 +89,8 @@ int exynos_pinctrl_set_state(struct udevice *dev, struct udevice *config)
|
||||
pindrv = fdtdec_get_int(fdt, node, "samsung,pin-drv", -1);
|
||||
|
||||
for (idx = 0; idx < count; idx++) {
|
||||
ret = fdt_get_string_index(fdt, node, "samsung,pins",
|
||||
idx, &name);
|
||||
if (ret < 0)
|
||||
name = fdt_stringlist_get(fdt, node, "samsung,pins", idx, NULL);
|
||||
if (!name)
|
||||
continue;
|
||||
reg = pin_to_bank_base(dev, name, &pin_num);
|
||||
|
||||
|
||||
@@ -122,7 +122,7 @@ static fdt_addr_t parse_address(int offset, const char *name, int na, int ns)
|
||||
int index, len = 0;
|
||||
const fdt32_t *reg;
|
||||
|
||||
index = fdt_find_string(gd->fdt_blob, offset, "reg-names", name);
|
||||
index = fdt_stringlist_search(gd->fdt_blob, offset, "reg-names", name);
|
||||
if (index < 0)
|
||||
return FDT_ADDR_T_NONE;
|
||||
|
||||
|
||||
@@ -306,11 +306,11 @@ static int pinctrl_generic_set_state_subnode(struct udevice *dev,
|
||||
const char *name;
|
||||
int strings_count, selector, i, ret;
|
||||
|
||||
strings_count = fdt_count_strings(fdt, node, subnode_target_type);
|
||||
strings_count = fdt_stringlist_count(fdt, node, subnode_target_type);
|
||||
if (strings_count < 0) {
|
||||
subnode_target_type = "groups";
|
||||
is_group = true;
|
||||
strings_count = fdt_count_strings(fdt, node,
|
||||
strings_count = fdt_stringlist_count(fdt, node,
|
||||
subnode_target_type);
|
||||
if (strings_count < 0) {
|
||||
/* skip this node; may contain config child nodes */
|
||||
@@ -319,9 +319,9 @@ static int pinctrl_generic_set_state_subnode(struct udevice *dev,
|
||||
}
|
||||
|
||||
for (i = 0; i < strings_count; i++) {
|
||||
ret = fdt_get_string_index(fdt, node, subnode_target_type,
|
||||
i, &name);
|
||||
if (ret < 0)
|
||||
name = fdt_stringlist_get(fdt, node, subnode_target_type, i,
|
||||
NULL);
|
||||
if (!name)
|
||||
return -EINVAL;
|
||||
|
||||
if (is_group)
|
||||
|
||||
@@ -72,7 +72,7 @@ static int pinctrl_select_state_full(struct udevice *dev, const char *statename)
|
||||
struct udevice *config;
|
||||
int state, size, i, ret;
|
||||
|
||||
state = fdt_find_string(fdt, node, "pinctrl-names", statename);
|
||||
state = fdt_stringlist_search(fdt, node, "pinctrl-names", statename);
|
||||
if (state < 0) {
|
||||
char *end;
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user