Skip to content

Commit

Permalink
staging:ti dspbridge: remove DSP_SUCCEEDED macro from pmgr
Browse files Browse the repository at this point in the history
Since status succeeded is now 0 macro DSP_SUCCEEDED
is not necessary anymore.

Signed-off-by: Ernesto Ramos <ernesto@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Ernesto Ramos authored and Greg Kroah-Hartman committed Jul 28, 2010
1 parent e6486d8 commit 157990f
Show file tree
Hide file tree
Showing 9 changed files with 139 additions and 161 deletions.
8 changes: 4 additions & 4 deletions drivers/staging/tidspbridge/pmgr/chnl.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,20 +77,20 @@ int chnl_create(struct chnl_mgr **channel_mgr,
if (mgr_attrts->word_size == 0)
status = -EINVAL;

if (DSP_SUCCEEDED(status)) {
if (!status) {
status = dev_get_chnl_mgr(hdev_obj, &hchnl_mgr);
if (DSP_SUCCEEDED(status) && hchnl_mgr != NULL)
if (!status && hchnl_mgr != NULL)
status = -EEXIST;

}

if (DSP_SUCCEEDED(status)) {
if (!status) {
struct bridge_drv_interface *intf_fxns;
dev_get_intf_fxns(hdev_obj, &intf_fxns);
/* Let Bridge channel module finish the create: */
status = (*intf_fxns->pfn_chnl_create) (&hchnl_mgr, hdev_obj,
mgr_attrts);
if (DSP_SUCCEEDED(status)) {
if (!status) {
/* Fill in DSP API channel module's fields of the
* chnl_mgr structure */
chnl_mgr_obj = (struct chnl_mgr_ *)hchnl_mgr;
Expand Down
135 changes: 60 additions & 75 deletions drivers/staging/tidspbridge/pmgr/cmm.c
Original file line number Diff line number Diff line change
Expand Up @@ -266,33 +266,25 @@ int cmm_create(struct cmm_object **ph_cmm_mgr,
sys_info.dw_page_size = PAGE_SIZE;
sys_info.dw_allocation_granularity = PAGE_SIZE;
sys_info.dw_number_of_processors = 1;
if (DSP_SUCCEEDED(status)) {
cmm_obj->dw_page_size = sys_info.dw_page_size;
} else {
cmm_obj->dw_page_size = 0;
status = -EPERM;
}

cmm_obj->dw_page_size = sys_info.dw_page_size;

/* Note: DSP SM seg table(aDSPSMSegTab[]) zero'd by
* MEM_ALLOC_OBJECT */
if (DSP_SUCCEEDED(status)) {
/* create node free list */
cmm_obj->node_free_list_head =
kzalloc(sizeof(struct lst_list),
GFP_KERNEL);
if (cmm_obj->node_free_list_head == NULL)
status = -ENOMEM;
else
INIT_LIST_HEAD(&cmm_obj->
node_free_list_head->head);
}
if (DSP_SUCCEEDED(status))
mutex_init(&cmm_obj->cmm_lock);

if (DSP_SUCCEEDED(status))
*ph_cmm_mgr = cmm_obj;
else
/* create node free list */
cmm_obj->node_free_list_head =
kzalloc(sizeof(struct lst_list),
GFP_KERNEL);
if (cmm_obj->node_free_list_head == NULL) {
status = -ENOMEM;
cmm_destroy(cmm_obj, true);

} else {
INIT_LIST_HEAD(&cmm_obj->
node_free_list_head->head);
mutex_init(&cmm_obj->cmm_lock);
*ph_cmm_mgr = cmm_obj;
}
} else {
status = -ENOMEM;
}
Expand Down Expand Up @@ -322,14 +314,14 @@ int cmm_destroy(struct cmm_object *hcmm_mgr, bool force)
if (!force) {
/* Check for outstanding memory allocations */
status = cmm_get_info(hcmm_mgr, &temp_info);
if (DSP_SUCCEEDED(status)) {
if (!status) {
if (temp_info.ul_total_in_use_cnt > 0) {
/* outstanding allocations */
status = -EPERM;
}
}
}
if (DSP_SUCCEEDED(status)) {
if (!status) {
/* UnRegister SM allocator */
for (slot_seg = 0; slot_seg < CMM_MAXGPPSEGS; slot_seg++) {
if (cmm_mgr_obj->pa_gppsm_seg_tab[slot_seg] != NULL) {
Expand All @@ -351,7 +343,7 @@ int cmm_destroy(struct cmm_object *hcmm_mgr, bool force)
kfree(cmm_mgr_obj->node_free_list_head);
}
mutex_unlock(&cmm_mgr_obj->cmm_lock);
if (DSP_SUCCEEDED(status)) {
if (!status) {
/* delete CS & cmm mgr object */
mutex_destroy(&cmm_mgr_obj->cmm_lock);
kfree(cmm_mgr_obj);
Expand Down Expand Up @@ -441,7 +433,7 @@ int cmm_get_handle(void *hprocessor, struct cmm_object ** ph_cmm_mgr)
else
hdev_obj = dev_get_first(); /* default */

if (DSP_SUCCEEDED(status))
if (!status)
status = dev_get_cmm_mgr(hdev_obj, ph_cmm_mgr);

return status;
Expand Down Expand Up @@ -571,16 +563,13 @@ int cmm_register_gppsm_seg(struct cmm_object *hcmm_mgr,
goto func_end;
}
/* Check if input ul_size is big enough to alloc at least one block */
if (DSP_SUCCEEDED(status)) {
if (ul_size < cmm_mgr_obj->ul_min_block_size) {
status = -EINVAL;
goto func_end;
}
}
if (DSP_SUCCEEDED(status)) {
/* create, zero, and tag an SM allocator object */
psma = kzalloc(sizeof(struct cmm_allocator), GFP_KERNEL);
if (ul_size < cmm_mgr_obj->ul_min_block_size) {
status = -EINVAL;
goto func_end;
}

/* create, zero, and tag an SM allocator object */
psma = kzalloc(sizeof(struct cmm_allocator), GFP_KERNEL);
if (psma != NULL) {
psma->hcmm_mgr = hcmm_mgr; /* ref to parent */
psma->shm_base = dw_gpp_base_pa; /* SM Base phys */
Expand All @@ -594,54 +583,50 @@ int cmm_register_gppsm_seg(struct cmm_object *hcmm_mgr,
status = -EPERM;
goto func_end;
}
if (DSP_SUCCEEDED(status)) {
/* return the actual segment identifier */
*sgmt_id = (u32) slot_seg + 1;
/* create memory free list */
psma->free_list_head = kzalloc(sizeof(struct lst_list),
GFP_KERNEL);
if (psma->free_list_head == NULL) {
status = -ENOMEM;
goto func_end;
}
INIT_LIST_HEAD(&psma->free_list_head->head);
}
if (DSP_SUCCEEDED(status)) {
/* create memory in-use list */
psma->in_use_list_head = kzalloc(sizeof(struct
lst_list), GFP_KERNEL);
if (psma->in_use_list_head == NULL) {
status = -ENOMEM;
goto func_end;
}
INIT_LIST_HEAD(&psma->in_use_list_head->head);
/* return the actual segment identifier */
*sgmt_id = (u32) slot_seg + 1;
/* create memory free list */
psma->free_list_head = kzalloc(sizeof(struct lst_list),
GFP_KERNEL);
if (psma->free_list_head == NULL) {
status = -ENOMEM;
goto func_end;
}
if (DSP_SUCCEEDED(status)) {
/* Get a mem node for this hunk-o-memory */
new_node = get_node(cmm_mgr_obj, dw_gpp_base_pa,
psma->dw_vm_base, ul_size);
/* Place node on the SM allocator's free list */
if (new_node) {
lst_put_tail(psma->free_list_head,
(struct list_head *)new_node);
} else {
status = -ENOMEM;
goto func_end;
}
INIT_LIST_HEAD(&psma->free_list_head->head);

/* create memory in-use list */
psma->in_use_list_head = kzalloc(sizeof(struct
lst_list), GFP_KERNEL);
if (psma->in_use_list_head == NULL) {
status = -ENOMEM;
goto func_end;
}
if (DSP_FAILED(status)) {
/* Cleanup allocator */
un_register_gppsm_seg(psma);
INIT_LIST_HEAD(&psma->in_use_list_head->head);

/* Get a mem node for this hunk-o-memory */
new_node = get_node(cmm_mgr_obj, dw_gpp_base_pa,
psma->dw_vm_base, ul_size);
/* Place node on the SM allocator's free list */
if (new_node) {
lst_put_tail(psma->free_list_head,
(struct list_head *)new_node);
} else {
status = -ENOMEM;
goto func_end;
}
} else {
status = -ENOMEM;
goto func_end;
}
/* make entry */
if (DSP_SUCCEEDED(status))
cmm_mgr_obj->pa_gppsm_seg_tab[slot_seg] = psma;
cmm_mgr_obj->pa_gppsm_seg_tab[slot_seg] = psma;

func_end:
if (status && psma) {
/* Cleanup allocator */
un_register_gppsm_seg(psma);
}

mutex_unlock(&cmm_mgr_obj->cmm_lock);
return status;
}
Expand Down Expand Up @@ -977,7 +962,7 @@ int cmm_xlator_create(struct cmm_xlatorobject **xlator,
} else {
status = -ENOMEM;
}
if (DSP_SUCCEEDED(status))
if (!status)
*xlator = (struct cmm_xlatorobject *)xlator_object;

return status;
Expand Down
10 changes: 5 additions & 5 deletions drivers/staging/tidspbridge/pmgr/cod.c
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ int cod_get_section(struct cod_libraryobj *lib, char *str_sect,
status = -ESPIPE;
}

DBC_ENSURE(DSP_SUCCEEDED(status) || ((*addr == 0) && (*len == 0)));
DBC_ENSURE(!status || ((*addr == 0) && (*len == 0)));

return status;
}
Expand Down Expand Up @@ -532,7 +532,7 @@ int cod_load_base(struct cod_manager *cod_mgr_obj, u32 num_argc, char *args[],
if (DSP_FAILED(status))
cod_mgr_obj->fxns.close_fxn(cod_mgr_obj->base_lib);

if (DSP_SUCCEEDED(status))
if (!status)
cod_mgr_obj->loaded = true;
else
cod_mgr_obj->base_lib = NULL;
Expand Down Expand Up @@ -562,11 +562,11 @@ int cod_open(struct cod_manager *hmgr, char *sz_coff_path,
if (lib == NULL)
status = -ENOMEM;

if (DSP_SUCCEEDED(status)) {
if (!status) {
lib->cod_mgr = hmgr;
status = hmgr->fxns.open_fxn(hmgr->target, sz_coff_path, flags,
&lib->dbll_lib);
if (DSP_SUCCEEDED(status))
if (!status)
*lib_obj = lib;
}

Expand Down Expand Up @@ -601,7 +601,7 @@ int cod_open_base(struct cod_manager *hmgr, char *sz_coff_path,
hmgr->base_lib = NULL;
}
status = hmgr->fxns.open_fxn(hmgr->target, sz_coff_path, flags, &lib);
if (DSP_SUCCEEDED(status)) {
if (!status) {
/* hang onto the library for subsequent sym table usage */
hmgr->base_lib = lib;
strncpy(hmgr->sz_zl_file, sz_coff_path, COD_MAXPATHLENGTH - 1);
Expand Down
20 changes: 10 additions & 10 deletions drivers/staging/tidspbridge/pmgr/dbll.c
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ int dbll_create(struct dbll_tar_obj **target_obj,
pzl_target->attrs = *pattrs;
*target_obj = (struct dbll_tar_obj *)pzl_target;
}
DBC_ENSURE((DSP_SUCCEEDED(status) && *target_obj) ||
DBC_ENSURE((!status && *target_obj) ||
(DSP_FAILED(status) && *target_obj == NULL));
}

Expand Down Expand Up @@ -393,7 +393,7 @@ int dbll_get_sect(struct dbll_library_obj *lib, char *name, u32 *paddr,
if (zl_lib != NULL) {
if (zl_lib->fp == NULL) {
status = dof_open(zl_lib);
if (DSP_SUCCEEDED(status))
if (!status)
opened_doff = true;

} else {
Expand All @@ -404,7 +404,7 @@ int dbll_get_sect(struct dbll_library_obj *lib, char *name, u32 *paddr,
} else {
status = -EFAULT;
}
if (DSP_SUCCEEDED(status)) {
if (!status) {
byte_size = 1;
if (dload_get_section_info(zl_lib->desc, name, &sect)) {
*paddr = sect->load_addr;
Expand Down Expand Up @@ -517,11 +517,11 @@ int dbll_load(struct dbll_library_obj *lib, dbll_flags flags,
/* If COFF file is not open, we open it. */
if (zl_lib->fp == NULL) {
status = dof_open(zl_lib);
if (DSP_SUCCEEDED(status))
if (!status)
opened_doff = true;

}
if (DSP_SUCCEEDED(status)) {
if (!status) {
zl_lib->ul_pos = (*(zl_lib->target_obj->attrs.ftell))
(zl_lib->fp);
/* Reset file cursor */
Expand Down Expand Up @@ -552,7 +552,7 @@ int dbll_load(struct dbll_library_obj *lib, dbll_flags flags,
}
}
}
if (DSP_SUCCEEDED(status))
if (!status)
zl_lib->load_ref++;

/* Clean up DOFF resources */
Expand Down Expand Up @@ -658,7 +658,7 @@ int dbll_open(struct dbll_tar_obj *target, char *file, dbll_flags flags,
zl_lib->init.dl_init.execute = execute;
zl_lib->init.dl_init.release = release;
zl_lib->init.lib = zl_lib;
if (DSP_SUCCEEDED(status) && zl_lib->fp == NULL)
if (!status && zl_lib->fp == NULL)
status = dof_open(zl_lib);

zl_lib->ul_pos = (*(zl_lib->target_obj->attrs.ftell)) (zl_lib->fp);
Expand Down Expand Up @@ -695,7 +695,7 @@ int dbll_open(struct dbll_tar_obj *target, char *file, dbll_flags flags,
}
}
func_cont:
if (DSP_SUCCEEDED(status)) {
if (!status) {
if (zl_lib->open_ref == 1) {
/* First time opened - insert in list */
if (zl_target->head)
Expand All @@ -712,7 +712,7 @@ int dbll_open(struct dbll_tar_obj *target, char *file, dbll_flags flags,
dbll_close((struct dbll_library_obj *)zl_lib);

}
DBC_ENSURE((DSP_SUCCEEDED(status) && (zl_lib->open_ref > 0) && *lib_obj)
DBC_ENSURE((!status && (zl_lib->open_ref > 0) && *lib_obj)
|| (DSP_FAILED(status) && *lib_obj == NULL));

dev_dbg(bridge, "%s: target: %p file: %s lib_obj: %p, status 0x%x\n",
Expand Down Expand Up @@ -745,7 +745,7 @@ int dbll_read_sect(struct dbll_library_obj *lib, char *name,
if (zl_lib != NULL) {
if (zl_lib->fp == NULL) {
status = dof_open(zl_lib);
if (DSP_SUCCEEDED(status))
if (!status)
opened_doff = true;

} else {
Expand Down
Loading

0 comments on commit 157990f

Please sign in to comment.