linux-4.4.1/__of_parse_phandle_with_args()
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
|
ログイン
]
開始行:
*参照元 [#x017eb6e]
#backlinks
*説明 [#ff5bf021]
-パス: [[linux-4.4.1/drivers/of/base.c]]
-FIXME: これは何?
--説明
**引数 [#ce943a92]
-const struct device_node *np
--
--[[linux-4.4.1/device_node]]
-const char *list_name
--
-const char *cells_name
--
-int cell_count
--
-int index
--
-struct of_phandle_args *out_args
--
--[[linux-4.4.1/of_phandle_args]]
**返り値 [#v313195c]
-int
--
**参考 [#wb1daec1]
*実装 [#vc38aac5]
static int __of_parse_phandle_with_args(const struct dev...
const char *list...
const char *cell...
int cell_count, ...
struct of_phandl...
{
const __be32 *list, *list_end;
int rc = 0, size, cur_index = 0;
uint32_t count = 0;
struct device_node *node = NULL;
phandle phandle;
-
--[[linux-4.4.1/__be32]]
--[[linux-4.4.1/device_node]]
--[[linux-4.4.1/phandle]]
/* Retrieve the phandle list property */
list = of_get_property(np, list_name, &size);
if (!list)
return -ENOENT;
list_end = list + size / sizeof(*list);
-
--[[linux-4.4.1/of_get_property()]]
/* Loop over the phandles until all the requeste...
while (list < list_end) {
rc = -EINVAL;
count = 0;
/*
* If phandle is 0, then it is an empty ...
* arguments. Skip forward to the next ...
*/
phandle = be32_to_cpup(list++);
-
--[[linux-4.4.1/be32_to_cpup()]]
if (phandle) {
/*
* Find the provider node and pa...
* property to determine the arg...
*
* This is not needed if the cel...
* (i.e. cells_name not set, but...
* except when we're going to re...
* below.
*/
if (cells_name || cur_index == i...
node = of_find_node_by_p...
if (!node) {
pr_err("%s: coul...
np->full...
goto err;
}
-
--[[linux-4.4.1/of_find_node_by_phandle()]]
--[[linux-4.4.1/pr_err()]]
}
if (cells_name) {
if (of_property_read_u32...
...
pr_err("%s: coul...
np->full...
node->fu...
goto err;
}
-
--[[linux-4.4.1/of_property_read_u32()]]
} else {
count = cell_count;
}
/*
* Make sure that the arguments ...
* remaining property data length
*/
if (list + count > list_end) {
pr_err("%s: arguments lo...
np->full_name);
goto err;
}
}
/*
* All of the error cases above bail out...
* this point, the parsing is successful...
* index matches, then fill the out_args...
* or return -ENOENT for an empty entry.
*/
rc = -ENOENT;
if (cur_index == index) {
if (!phandle)
goto err;
if (out_args) {
int i;
if (WARN_ON(count > MAX_...
count = MAX_PHAN...
out_args->np = node;
out_args->args_count = c...
for (i = 0; i < count; i...
out_args->args[i...
-
--[[linux-4.4.1/WARN_ON()]]
--[[linux-4.4.1/MAX_PHANDLE_ARGS]]
--[[linux-4.4.1/be32_to_cpup()]]
} else {
of_node_put(node);
}
-
--[[linux-4.4.1/of_node_put()]]
/* Found it! return success */
return 0;
}
of_node_put(node);
node = NULL;
list += count;
cur_index++;
-
--[[linux-4.4.1/of_node_put()]]
}
/*
* Unlock node before returning result; will be ...
* -ENOENT : index is for empty phandle
* -EINVAL : parsing error on data
* [1..n] : Number of phandle (count mode; when...
*/
rc = index < 0 ? cur_index : -ENOENT;
err:
if (node)
of_node_put(node);
return rc;
}
*コメント [#t7833506]
終了行:
*参照元 [#x017eb6e]
#backlinks
*説明 [#ff5bf021]
-パス: [[linux-4.4.1/drivers/of/base.c]]
-FIXME: これは何?
--説明
**引数 [#ce943a92]
-const struct device_node *np
--
--[[linux-4.4.1/device_node]]
-const char *list_name
--
-const char *cells_name
--
-int cell_count
--
-int index
--
-struct of_phandle_args *out_args
--
--[[linux-4.4.1/of_phandle_args]]
**返り値 [#v313195c]
-int
--
**参考 [#wb1daec1]
*実装 [#vc38aac5]
static int __of_parse_phandle_with_args(const struct dev...
const char *list...
const char *cell...
int cell_count, ...
struct of_phandl...
{
const __be32 *list, *list_end;
int rc = 0, size, cur_index = 0;
uint32_t count = 0;
struct device_node *node = NULL;
phandle phandle;
-
--[[linux-4.4.1/__be32]]
--[[linux-4.4.1/device_node]]
--[[linux-4.4.1/phandle]]
/* Retrieve the phandle list property */
list = of_get_property(np, list_name, &size);
if (!list)
return -ENOENT;
list_end = list + size / sizeof(*list);
-
--[[linux-4.4.1/of_get_property()]]
/* Loop over the phandles until all the requeste...
while (list < list_end) {
rc = -EINVAL;
count = 0;
/*
* If phandle is 0, then it is an empty ...
* arguments. Skip forward to the next ...
*/
phandle = be32_to_cpup(list++);
-
--[[linux-4.4.1/be32_to_cpup()]]
if (phandle) {
/*
* Find the provider node and pa...
* property to determine the arg...
*
* This is not needed if the cel...
* (i.e. cells_name not set, but...
* except when we're going to re...
* below.
*/
if (cells_name || cur_index == i...
node = of_find_node_by_p...
if (!node) {
pr_err("%s: coul...
np->full...
goto err;
}
-
--[[linux-4.4.1/of_find_node_by_phandle()]]
--[[linux-4.4.1/pr_err()]]
}
if (cells_name) {
if (of_property_read_u32...
...
pr_err("%s: coul...
np->full...
node->fu...
goto err;
}
-
--[[linux-4.4.1/of_property_read_u32()]]
} else {
count = cell_count;
}
/*
* Make sure that the arguments ...
* remaining property data length
*/
if (list + count > list_end) {
pr_err("%s: arguments lo...
np->full_name);
goto err;
}
}
/*
* All of the error cases above bail out...
* this point, the parsing is successful...
* index matches, then fill the out_args...
* or return -ENOENT for an empty entry.
*/
rc = -ENOENT;
if (cur_index == index) {
if (!phandle)
goto err;
if (out_args) {
int i;
if (WARN_ON(count > MAX_...
count = MAX_PHAN...
out_args->np = node;
out_args->args_count = c...
for (i = 0; i < count; i...
out_args->args[i...
-
--[[linux-4.4.1/WARN_ON()]]
--[[linux-4.4.1/MAX_PHANDLE_ARGS]]
--[[linux-4.4.1/be32_to_cpup()]]
} else {
of_node_put(node);
}
-
--[[linux-4.4.1/of_node_put()]]
/* Found it! return success */
return 0;
}
of_node_put(node);
node = NULL;
list += count;
cur_index++;
-
--[[linux-4.4.1/of_node_put()]]
}
/*
* Unlock node before returning result; will be ...
* -ENOENT : index is for empty phandle
* -EINVAL : parsing error on data
* [1..n] : Number of phandle (count mode; when...
*/
rc = index < 0 ? cur_index : -ENOENT;
err:
if (node)
of_node_put(node);
return rc;
}
*コメント [#t7833506]
ページ名: