staging: tidspbridge: mgr_enum_node_info cleanup
Reorganized mgr_enum_node_info code to increase its readability. Signed-off-by: Ionut Nicu <ionut.nicu@mindbit.ro> Signed-off-by: Omar Ramirez Luna <omar.ramirez@ti.com>
This commit is contained in:
parent
d723818e7c
commit
59403c21af
|
@ -134,8 +134,7 @@ int mgr_enum_node_info(u32 node_id, struct dsp_ndbprops *pndb_props,
|
||||||
u32 undb_props_size, u32 *pu_num_nodes)
|
u32 undb_props_size, u32 *pu_num_nodes)
|
||||||
{
|
{
|
||||||
int status = 0;
|
int status = 0;
|
||||||
struct dsp_uuid node_uuid, temp_uuid;
|
struct dsp_uuid node_uuid;
|
||||||
u32 temp_index = 0;
|
|
||||||
u32 node_index = 0;
|
u32 node_index = 0;
|
||||||
struct dcd_genericobj gen_obj;
|
struct dcd_genericobj gen_obj;
|
||||||
struct mgr_object *pmgr_obj = NULL;
|
struct mgr_object *pmgr_obj = NULL;
|
||||||
|
@ -149,24 +148,27 @@ int mgr_enum_node_info(u32 node_id, struct dsp_ndbprops *pndb_props,
|
||||||
*pu_num_nodes = 0;
|
*pu_num_nodes = 0;
|
||||||
/* Get the Manager Object from the driver data */
|
/* Get the Manager Object from the driver data */
|
||||||
if (!drv_datap || !drv_datap->mgr_object) {
|
if (!drv_datap || !drv_datap->mgr_object) {
|
||||||
status = -ENODATA;
|
|
||||||
pr_err("%s: Failed to retrieve the object handle\n", __func__);
|
pr_err("%s: Failed to retrieve the object handle\n", __func__);
|
||||||
goto func_cont;
|
return -ENODATA;
|
||||||
} else {
|
|
||||||
pmgr_obj = drv_datap->mgr_object;
|
|
||||||
}
|
}
|
||||||
|
pmgr_obj = drv_datap->mgr_object;
|
||||||
|
|
||||||
DBC_ASSERT(pmgr_obj);
|
DBC_ASSERT(pmgr_obj);
|
||||||
/* Forever loop till we hit failed or no more items in the
|
/* Forever loop till we hit failed or no more items in the
|
||||||
* Enumeration. We will exit the loop other than 0; */
|
* Enumeration. We will exit the loop other than 0; */
|
||||||
while (status == 0) {
|
while (!status) {
|
||||||
status = dcd_enumerate_object(temp_index++, DSP_DCDNODETYPE,
|
status = dcd_enumerate_object(node_index++, DSP_DCDNODETYPE,
|
||||||
&temp_uuid);
|
&node_uuid);
|
||||||
if (status == 0) {
|
if (status)
|
||||||
node_index++;
|
break;
|
||||||
if (node_id == (node_index - 1))
|
*pu_num_nodes = node_index;
|
||||||
node_uuid = temp_uuid;
|
if (node_id == (node_index - 1)) {
|
||||||
|
status = dcd_get_object_def(pmgr_obj->hdcd_mgr,
|
||||||
|
&node_uuid, DSP_DCDNODETYPE, &gen_obj);
|
||||||
|
if (status)
|
||||||
|
break;
|
||||||
|
/* Get the Obj def */
|
||||||
|
*pndb_props = gen_obj.obj_data.node_obj.ndb_props;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,27 +176,6 @@ int mgr_enum_node_info(u32 node_id, struct dsp_ndbprops *pndb_props,
|
||||||
if (status > 0)
|
if (status > 0)
|
||||||
status = 0;
|
status = 0;
|
||||||
|
|
||||||
if (!status) {
|
|
||||||
if (node_id > (node_index - 1)) {
|
|
||||||
status = -EINVAL;
|
|
||||||
} else {
|
|
||||||
status = dcd_get_object_def(pmgr_obj->hdcd_mgr,
|
|
||||||
(struct dsp_uuid *)
|
|
||||||
&node_uuid, DSP_DCDNODETYPE,
|
|
||||||
&gen_obj);
|
|
||||||
if (!status) {
|
|
||||||
/* Get the Obj def */
|
|
||||||
*pndb_props =
|
|
||||||
gen_obj.obj_data.node_obj.ndb_props;
|
|
||||||
*pu_num_nodes = node_index;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func_cont:
|
|
||||||
DBC_ENSURE((!status && *pu_num_nodes > 0) ||
|
|
||||||
(status && *pu_num_nodes == 0));
|
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue