2010-07-28 14:40:58

by Ernesto Ramos

[permalink] [raw]
Subject: [PATCH 00/10] staging:ti dspbridge: Remove DSP_FAILED and DSP_SUCCEEDED macros

This series of patches is targetted to remove macros DSP_FAILED
and DSP_SUCCEEDED since bridge driver currently uses standard kernel
error codes.

Ernesto Ramos (10):
staging:ti dspbridge: remove DSP_SUCCEEDED macro from core
staging:ti dspbridge: remove DSP_SUCCEEDED macro from pmgr
staging:ti dspbridge: remove DSP_SUCCEEDED macro from rmgr
staging:ti dspbridge: remove DSP_SUCCEEDED macro from services
staging:ti dspbridge: remove DSP_SUCCEEDED macro definition
staging:ti dspbridge: remove DSP_FAILED macro from core
staging:ti dspbridge: remove DSP_FAILED macro from pmgr
staging:ti dspbridge: remove DSP_FAILED macro from rmgr
staging:ti dspbridge: remove DSP_FAILED macro from services
staging:ti dspbridge: remove DSP_FAILED macro definition

drivers/staging/tidspbridge/core/chnl_sm.c | 42 ++--
drivers/staging/tidspbridge/core/dsp-clock.c | 4 +-
drivers/staging/tidspbridge/core/io_sm.c | 111 +++++-----
drivers/staging/tidspbridge/core/msg_sm.c | 26 ++--
drivers/staging/tidspbridge/core/tiomap3430.c | 61 +++---
drivers/staging/tidspbridge/core/tiomap3430_pwr.c | 8 +-
drivers/staging/tidspbridge/core/tiomap_io.c | 41 ++--
.../staging/tidspbridge/include/dspbridge/dbdefs.h | 4 -
drivers/staging/tidspbridge/pmgr/chnl.c | 10 +-
drivers/staging/tidspbridge/pmgr/cmm.c | 137 ++++++-------
drivers/staging/tidspbridge/pmgr/cod.c | 18 +-
drivers/staging/tidspbridge/pmgr/dbll.c | 32 ++--
drivers/staging/tidspbridge/pmgr/dev.c | 79 +++----
drivers/staging/tidspbridge/pmgr/dmm.c | 12 +-
drivers/staging/tidspbridge/pmgr/dspapi.c | 82 ++++----
drivers/staging/tidspbridge/pmgr/io.c | 4 +-
drivers/staging/tidspbridge/pmgr/msg.c | 2 +-
drivers/staging/tidspbridge/rmgr/dbdcd.c | 48 ++--
drivers/staging/tidspbridge/rmgr/disp.c | 62 +++---
drivers/staging/tidspbridge/rmgr/drv.c | 39 ++--
drivers/staging/tidspbridge/rmgr/drv_interface.c | 10 +-
drivers/staging/tidspbridge/rmgr/dspdrv.c | 16 +-
drivers/staging/tidspbridge/rmgr/mgr.c | 32 ++--
drivers/staging/tidspbridge/rmgr/nldr.c | 106 +++++-----
drivers/staging/tidspbridge/rmgr/node.c | 224 ++++++++++----------
drivers/staging/tidspbridge/rmgr/proc.c | 137 ++++++------
drivers/staging/tidspbridge/rmgr/pwr.c | 26 +--
drivers/staging/tidspbridge/rmgr/rmm.c | 12 +-
drivers/staging/tidspbridge/rmgr/strm.c | 75 ++++----
drivers/staging/tidspbridge/services/cfg.c | 21 +-
30 files changed, 710 insertions(+), 771 deletions(-)


2010-07-28 14:40:55

by Ernesto Ramos

[permalink] [raw]
Subject: [PATCH 04/10] staging:ti dspbridge: remove DSP_SUCCEEDED macro from services

Since status succeeded is now 0 macro DSP_SUCCEEDED
is not necessary anymore.

Signed-off-by: Ernesto Ramos <[email protected]>
---
drivers/staging/tidspbridge/services/cfg.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/staging/tidspbridge/services/cfg.c b/drivers/staging/tidspbridge/services/cfg.c
index 4ab3cd7..c3f33f6 100644
--- a/drivers/staging/tidspbridge/services/cfg.c
+++ b/drivers/staging/tidspbridge/services/cfg.c
@@ -62,7 +62,7 @@ int cfg_get_auto_start(struct cfg_devnode *dev_node_obj,
status = -EFAULT;
if (!auto_start || !drv_datap)
status = -EFAULT;
- if (DSP_SUCCEEDED(status))
+ if (!status)
*auto_start = (drv_datap->base_img) ? 1 : 0;

DBC_ENSURE((status == 0 &&
@@ -93,7 +93,7 @@ int cfg_get_dev_object(struct cfg_devnode *dev_node_obj,
status = -EFAULT;

dw_buf_size = sizeof(value);
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {

/* check the device string and then store dev object */
if (!
@@ -127,7 +127,7 @@ int cfg_get_exec_file(struct cfg_devnode *dev_node_obj, u32 buf_size,
if (strlen(drv_datap->base_img) > buf_size)
status = -EINVAL;

- if (DSP_SUCCEEDED(status) && drv_datap->base_img)
+ if (!status && drv_datap->base_img)
strcpy(str_exec_file, drv_datap->base_img);

if (DSP_FAILED(status))
@@ -178,7 +178,7 @@ int cfg_get_object(u32 *value, u8 dw_type)
*value = 0;
pr_err("%s: Failed, status 0x%x\n", __func__, status);
}
- DBC_ENSURE((DSP_SUCCEEDED(status) && *value != 0) ||
+ DBC_ENSURE((!status && *value != 0) ||
(DSP_FAILED(status) && *value == 0));
return status;
}
@@ -211,7 +211,7 @@ int cfg_set_dev_object(struct cfg_devnode *dev_node_obj, u32 value)
if (!dev_node_obj)
status = -EFAULT;

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Store the Bridge device object in the Registry */

if (!(strcmp((char *)dev_node_obj, "TIOMAP1510")))
--
1.5.4.5

2010-07-28 14:41:01

by Ernesto Ramos

[permalink] [raw]
Subject: [PATCH 09/10] staging:ti dspbridge: remove DSP_FAILED macro from services

Since status succeeded is 0, DSP_FAILED macro
is not necessary anymore.

Signed-off-by: Ernesto Ramos <[email protected]>
---
drivers/staging/tidspbridge/services/cfg.c | 13 ++++++-------
1 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/tidspbridge/services/cfg.c b/drivers/staging/tidspbridge/services/cfg.c
index c3f33f6..a7af74f 100644
--- a/drivers/staging/tidspbridge/services/cfg.c
+++ b/drivers/staging/tidspbridge/services/cfg.c
@@ -102,7 +102,7 @@ int cfg_get_dev_object(struct cfg_devnode *dev_node_obj,
"TIOMAP1510")))
*value = (u32)drv_datap->dev_object;
}
- if (DSP_FAILED(status))
+ if (status)
pr_err("%s: Failed, status 0x%x\n", __func__, status);
return status;
}
@@ -130,7 +130,7 @@ int cfg_get_exec_file(struct cfg_devnode *dev_node_obj, u32 buf_size,
if (!status && drv_datap->base_img)
strcpy(str_exec_file, drv_datap->base_img);

- if (DSP_FAILED(status))
+ if (status)
pr_err("%s: Failed, status 0x%x\n", __func__, status);
DBC_ENSURE(((status == 0) &&
(strlen(str_exec_file) <= buf_size))
@@ -174,12 +174,11 @@ int cfg_get_object(u32 *value, u8 dw_type)
default:
break;
}
- if (DSP_FAILED(status)) {
+ if (status) {
*value = 0;
pr_err("%s: Failed, status 0x%x\n", __func__, status);
}
- DBC_ENSURE((!status && *value != 0) ||
- (DSP_FAILED(status) && *value == 0));
+ DBC_ENSURE((!status && *value != 0) || (status && *value == 0));
return status;
}

@@ -217,7 +216,7 @@ int cfg_set_dev_object(struct cfg_devnode *dev_node_obj, u32 value)
if (!(strcmp((char *)dev_node_obj, "TIOMAP1510")))
drv_datap->dev_object = (void *) value;
}
- if (DSP_FAILED(status))
+ if (status)
pr_err("%s: Failed, status 0x%x\n", __func__, status);

return status;
@@ -248,7 +247,7 @@ int cfg_set_object(u32 value, u8 dw_type)
default:
break;
}
- if (DSP_FAILED(status))
+ if (status)
pr_err("%s: Failed, status 0x%x\n", __func__, status);
return status;
}
--
1.5.4.5

2010-07-28 14:41:12

by Ernesto Ramos

[permalink] [raw]
Subject: [PATCH 06/10] staging:ti dspbridge: remove DSP_FAILED macro from core

Since status succeeded is 0, DSP_FAILED macro
is not necessary anymore.

Signed-off-by: Ernesto Ramos <[email protected]>
---
drivers/staging/tidspbridge/core/chnl_sm.c | 20 +++---
drivers/staging/tidspbridge/core/io_sm.c | 64 ++++++++++----------
drivers/staging/tidspbridge/core/msg_sm.c | 4 +-
drivers/staging/tidspbridge/core/tiomap3430.c | 4 +-
drivers/staging/tidspbridge/core/tiomap3430_pwr.c | 2 +-
5 files changed, 47 insertions(+), 47 deletions(-)

diff --git a/drivers/staging/tidspbridge/core/chnl_sm.c b/drivers/staging/tidspbridge/core/chnl_sm.c
index 1b23141..bee2b23 100644
--- a/drivers/staging/tidspbridge/core/chnl_sm.c
+++ b/drivers/staging/tidspbridge/core/chnl_sm.c
@@ -135,7 +135,7 @@ int bridge_chnl_add_io_req(struct chnl_object *chnl_obj, void *host_buf,
if (!dev_ctxt)
status = -EFAULT;

- if (DSP_FAILED(status))
+ if (status)
goto func_end;

if (pchnl->chnl_type == CHNL_PCPY && pchnl->chnl_id > 1 && host_buf) {
@@ -266,7 +266,7 @@ int bridge_chnl_cancel_io(struct chnl_object *chnl_obj)
} else {
status = -EFAULT;
}
- if (DSP_FAILED(status))
+ if (status)
goto func_end;

/* Mark this channel as cancelled, to prevent further IORequests or
@@ -372,7 +372,7 @@ func_cont:
kfree(pchnl);
pchnl = NULL;
}
- DBC_ENSURE(DSP_FAILED(status) || !pchnl);
+ DBC_ENSURE(status || !pchnl);
return status;
}

@@ -428,7 +428,7 @@ int bridge_chnl_create(struct chnl_mgr **channel_mgr,
status = -ENOMEM;
}

- if (DSP_FAILED(status)) {
+ if (status) {
bridge_chnl_destroy(chnl_mgr_obj);
*channel_mgr = NULL;
} else {
@@ -456,7 +456,7 @@ int bridge_chnl_destroy(struct chnl_mgr *hchnl_mgr)
status =
bridge_chnl_close(chnl_mgr_obj->ap_channel
[chnl_id]);
- if (DSP_FAILED(status))
+ if (status)
dev_dbg(bridge, "%s: Error status 0x%x\n",
__func__, status);
}
@@ -509,7 +509,7 @@ int bridge_chnl_flush_io(struct chnl_object *chnl_obj, u32 timeout)
while (!LST_IS_EMPTY(pchnl->pio_requests) && !status) {
status = bridge_chnl_get_ioc(chnl_obj,
timeout, &chnl_ioc_obj);
- if (DSP_FAILED(status))
+ if (status)
continue;

if (chnl_ioc_obj.status & CHNL_IOCSTATTIMEOUT)
@@ -522,7 +522,7 @@ int bridge_chnl_flush_io(struct chnl_object *chnl_obj, u32 timeout)
pchnl->dw_state &= ~CHNL_STATECANCEL;
}
}
- DBC_ENSURE(DSP_FAILED(status) || LST_IS_EMPTY(pchnl->pio_requests));
+ DBC_ENSURE(status || LST_IS_EMPTY(pchnl->pio_requests));
return status;
}

@@ -592,7 +592,7 @@ int bridge_chnl_get_ioc(struct chnl_object *chnl_obj, u32 timeout,
if (!dev_ctxt)
status = -EFAULT;

- if (DSP_FAILED(status))
+ if (status)
goto func_end;

ioc.status = CHNL_IOCSTATCOMPLETE;
@@ -806,7 +806,7 @@ int bridge_chnl_open(struct chnl_object **chnl,
}
}
}
- if (DSP_FAILED(status))
+ if (status)
goto func_end;

DBC_ASSERT(ch_id < chnl_mgr_obj->max_channels);
@@ -860,7 +860,7 @@ int bridge_chnl_open(struct chnl_object **chnl,
}
}

- if (DSP_FAILED(status)) {
+ if (status) {
/* Free memory */
if (pchnl->pio_completions) {
free_chirp_list(pchnl->pio_completions);
diff --git a/drivers/staging/tidspbridge/core/io_sm.c b/drivers/staging/tidspbridge/core/io_sm.c
index 1d433a9..02c660d 100644
--- a/drivers/staging/tidspbridge/core/io_sm.c
+++ b/drivers/staging/tidspbridge/core/io_sm.c
@@ -242,7 +242,7 @@ int bridge_io_create(struct io_mgr **io_man,
status = -EIO;
}
func_end:
- if (DSP_FAILED(status)) {
+ if (status) {
/* Cleanup */
bridge_io_destroy(pio_mgr);
if (io_man)
@@ -357,13 +357,13 @@ int bridge_io_on_loaded(struct io_mgr *hio_mgr)
/* Get start and length of channel part of shared memory */
status = cod_get_sym_value(cod_man, CHNL_SHARED_BUFFER_BASE_SYM,
&ul_shm_base);
- if (DSP_FAILED(status)) {
+ if (status) {
status = -EFAULT;
goto func_end;
}
status = cod_get_sym_value(cod_man, CHNL_SHARED_BUFFER_LIMIT_SYM,
&ul_shm_limit);
- if (DSP_FAILED(status)) {
+ if (status) {
status = -EFAULT;
goto func_end;
}
@@ -414,18 +414,18 @@ int bridge_io_on_loaded(struct io_mgr *hio_mgr)
status = cod_get_sym_value(cod_man, SHM0_SHARED_END_SYM,
&shm0_end);
#endif
- if (DSP_FAILED(status))
+ if (status)
status = -EFAULT;
}
if (!status) {
status =
cod_get_sym_value(cod_man, DYNEXTBASE, &ul_dyn_ext_base);
- if (DSP_FAILED(status))
+ if (status)
status = -EFAULT;
}
if (!status) {
status = cod_get_sym_value(cod_man, EXTEND, &ul_ext_end);
- if (DSP_FAILED(status))
+ if (status)
status = -EFAULT;
}
if (!status) {
@@ -469,7 +469,7 @@ int bridge_io_on_loaded(struct io_mgr *hio_mgr)
status = -ENOMEM;
}
}
- if (DSP_FAILED(status))
+ if (status)
goto func_end;

pa_curr = ul_gpp_pa;
@@ -508,7 +508,7 @@ int bridge_io_on_loaded(struct io_mgr *hio_mgr)
pa_curr, va_curr,
page_size[i], map_attrs,
NULL);
- if (DSP_FAILED(status))
+ if (status)
goto func_end;
pa_curr += page_size[i];
va_curr += page_size[i];
@@ -581,7 +581,7 @@ int bridge_io_on_loaded(struct io_mgr *hio_mgr)
ae_proc[ndx].ul_gpp_va,
ae_proc[ndx].ul_dsp_va *
hio_mgr->word_size, page_size[i]);
- if (DSP_FAILED(status))
+ if (status)
goto func_end;
}
pa_curr += page_size[i];
@@ -645,7 +645,7 @@ int bridge_io_on_loaded(struct io_mgr *hio_mgr)
NULL);
}
}
- if (DSP_FAILED(status))
+ if (status)
goto func_end;
}

@@ -662,7 +662,7 @@ int bridge_io_on_loaded(struct io_mgr *hio_mgr)
(hio_mgr->hbridge_context, l4_peripheral_table[i].phys_addr,
l4_peripheral_table[i].dsp_virt_addr, HW_PAGE_SIZE4KB,
map_attrs, NULL);
- if (DSP_FAILED(status))
+ if (status)
goto func_end;
i++;
}
@@ -707,7 +707,7 @@ int bridge_io_on_loaded(struct io_mgr *hio_mgr)
hio_mgr->intf_fxns->pfn_dev_cntrl(hio_mgr->hbridge_context,
BRDIOCTL_SETMMUCONFIG,
ae_proc);
- if (DSP_FAILED(status))
+ if (status)
goto func_end;
ul_shm_base = hio_mgr->ext_proc_info.ty_tlb[0].ul_gpp_phys;
ul_shm_base += ul_shm_base_offset;
@@ -756,7 +756,7 @@ int bridge_io_on_loaded(struct io_mgr *hio_mgr)
/* Get the start address of trace buffer */
status = cod_get_sym_value(cod_man, SYS_PUTCBEG,
&hio_mgr->ul_trace_buffer_begin);
- if (DSP_FAILED(status)) {
+ if (status) {
status = -EFAULT;
goto func_end;
}
@@ -767,7 +767,7 @@ int bridge_io_on_loaded(struct io_mgr *hio_mgr)
/* Get the end address of trace buffer */
status = cod_get_sym_value(cod_man, SYS_PUTCEND,
&hio_mgr->ul_trace_buffer_end);
- if (DSP_FAILED(status)) {
+ if (status) {
status = -EFAULT;
goto func_end;
}
@@ -777,7 +777,7 @@ int bridge_io_on_loaded(struct io_mgr *hio_mgr)
/* Get the current address of DSP write pointer */
status = cod_get_sym_value(cod_man, BRIDGE_SYS_PUTC_CURRENT,
&hio_mgr->ul_trace_buffer_current);
- if (DSP_FAILED(status)) {
+ if (status) {
status = -EFAULT;
goto func_end;
}
@@ -852,7 +852,7 @@ static void io_dispatch_pm(struct io_mgr *pio_mgr)
status = pio_mgr->intf_fxns->
pfn_dev_cntrl(pio_mgr->hbridge_context,
BRDIOCTL_PWR_HIBERNATE, parg);
- if (DSP_FAILED(status))
+ if (status)
pr_err("%s: hibernate cmd failed 0x%x\n",
__func__, status);
} else if (parg[0] == MBX_PM_OPP_REQ) {
@@ -861,16 +861,16 @@ static void io_dispatch_pm(struct io_mgr *pio_mgr)
status = pio_mgr->intf_fxns->
pfn_dev_cntrl(pio_mgr->hbridge_context,
BRDIOCTL_CONSTRAINT_REQUEST, parg);
- if (DSP_FAILED(status))
+ if (status)
dev_dbg(bridge, "PM: Failed to set constraint "
- "= 0x%x \n", parg[1]);
+ "= 0x%x\n", parg[1]);
} else {
dev_dbg(bridge, "PM: clk control value of msg = 0x%x\n",
parg[0]);
status = pio_mgr->intf_fxns->
pfn_dev_cntrl(pio_mgr->hbridge_context,
BRDIOCTL_CLK_CTRL, parg);
- if (DSP_FAILED(status))
+ if (status)
dev_dbg(bridge, "PM: Failed to ctrl the DSP clk"
"= 0x%x\n", *parg);
}
@@ -1849,7 +1849,7 @@ int print_dsp_trace_buffer(struct bridge_dev_context *hbridge_context)
status = cod_get_sym_value(cod_mgr, COD_TRACECURPOS,
&trace_cur_pos);

- if (DSP_FAILED(status))
+ if (status)
goto func_end;

ul_num_bytes = (ul_trace_end - ul_trace_begin);
@@ -1857,7 +1857,7 @@ int print_dsp_trace_buffer(struct bridge_dev_context *hbridge_context)
ul_num_words = ul_num_bytes * ul_word_size;
status = dev_get_intf_fxns(dev_obj, &intf_fxns);

- if (DSP_FAILED(status))
+ if (status)
goto func_end;

psz_buf = kzalloc(ul_num_bytes + 2, GFP_ATOMIC);
@@ -1867,7 +1867,7 @@ int print_dsp_trace_buffer(struct bridge_dev_context *hbridge_context)
(u8 *)psz_buf, (u32)ul_trace_begin,
ul_num_bytes, 0);

- if (DSP_FAILED(status))
+ if (status)
goto func_end;

/* Pack and do newline conversion */
@@ -1881,7 +1881,7 @@ int print_dsp_trace_buffer(struct bridge_dev_context *hbridge_context)
status = (*intf_fxns->pfn_brd_read)(pbridge_context,
(u8 *)&trace_cur_pos, (u32)trace_cur_pos,
4, 0);
- if (DSP_FAILED(status))
+ if (status)
goto func_end;
/* Pack and do newline conversion */
pr_info("DSP Trace Buffer Begin:\n"
@@ -1967,7 +1967,7 @@ int print_dsp_trace_buffer(struct bridge_dev_context *hbridge_context)
status = -ENOMEM;
}
func_end:
- if (DSP_FAILED(status))
+ if (status)
dev_dbg(bridge, "%s Failed, status 0x%x\n", __func__, status);
return status;
}
@@ -2025,7 +2025,7 @@ int dump_dsp_stack(struct bridge_dev_context *bridge_context)
cod_get_sym_value(code_mgr, COD_TRACEBEG, &trace_begin);
pr_debug("%s: trace_begin Value 0x%x\n",
__func__, trace_begin);
- if (DSP_FAILED(status))
+ if (status)
pr_debug("%s: Failed on cod_get_sym_value.\n",
__func__);
}
@@ -2049,7 +2049,7 @@ int dump_dsp_stack(struct bridge_dev_context *bridge_context)
(u8 *)&mmu_fault_dbg_info, (u32)trace_begin,
sizeof(mmu_fault_dbg_info), 0);

- if (DSP_FAILED(status))
+ if (status)
break;

poll_cnt++;
@@ -2084,7 +2084,7 @@ int dump_dsp_stack(struct bridge_dev_context *bridge_context)
status = (*intf_fxns->pfn_brd_read)(bridge_context,
(u8 *)buffer, (u32)trace_begin,
total_size, 0);
- if (DSP_FAILED(status)) {
+ if (status) {
pr_debug("%s: Failed to Read Trace Buffer.\n",
__func__);
goto func_end;
@@ -2101,7 +2101,7 @@ int dump_dsp_stack(struct bridge_dev_context *bridge_context)

status =
cod_get_sym_value(code_mgr, DYNEXTBASE, &dyn_ext_base);
- if (DSP_FAILED(status)) {
+ if (status) {
status = -EFAULT;
goto func_end;
}
@@ -2219,7 +2219,7 @@ void dump_dl_modules(struct bridge_dev_context *bridge_context)
int status = 0;

status = dev_get_intf_fxns(dev_object, &intf_fxns);
- if (DSP_FAILED(status)) {
+ if (status) {
pr_debug("%s: Failed on dev_get_intf_fxns.\n", __func__);
goto func_end;
}
@@ -2233,7 +2233,7 @@ void dump_dl_modules(struct bridge_dev_context *bridge_context)

/* Lookup the address of the modules_header structure */
status = cod_get_sym_value(code_mgr, "_DLModules", &module_dsp_addr);
- if (DSP_FAILED(status)) {
+ if (status) {
pr_debug("%s: Failed on cod_get_sym_value for _DLModules.\n",
__func__);
goto func_end;
@@ -2245,7 +2245,7 @@ void dump_dl_modules(struct bridge_dev_context *bridge_context)
status = (*intf_fxns->pfn_brd_read)(bridge_context, (u8 *) &modules_hdr,
(u32) module_dsp_addr, sizeof(modules_hdr), 0);

- if (DSP_FAILED(status)) {
+ if (status) {
pr_debug("%s: Failed failed to read modules header.\n",
__func__);
goto func_end;
@@ -2280,7 +2280,7 @@ void dump_dl_modules(struct bridge_dev_context *bridge_context)
status = (*intf_fxns->pfn_brd_read)(bridge_context,
(u8 *)module_struct, module_dsp_addr, module_size, 0);

- if (DSP_FAILED(status)) {
+ if (status) {
pr_debug(
"%s: Failed to read dll_module stuct for 0x%x.\n",
__func__, module_dsp_addr);
diff --git a/drivers/staging/tidspbridge/core/msg_sm.c b/drivers/staging/tidspbridge/core/msg_sm.c
index 85ca448..87712e2 100644
--- a/drivers/staging/tidspbridge/core/msg_sm.c
+++ b/drivers/staging/tidspbridge/core/msg_sm.c
@@ -210,7 +210,7 @@ int bridge_msg_create_queue(struct msg_mgr *hmsg_mgr,
status = add_new_msg(msg_q->msg_free_list);
}
}
- if (DSP_FAILED(status)) {
+ if (status) {
/* Stay inside CS to prevent others from taking any
* of the newly allocated message frames. */
delete_msg_queue(msg_q, num_allocated);
@@ -439,7 +439,7 @@ int bridge_msg_put(struct msg_queue *msg_queue_obj,
syncs[1] = msg_queue_obj->sync_done;
status = sync_wait_on_multiple_events(syncs, 2, utimeout,
&index);
- if (DSP_FAILED(status))
+ if (status)
goto func_end;
/* Enter critical section */
spin_lock_bh(&hmsg_mgr->msg_mgr_lock);
diff --git a/drivers/staging/tidspbridge/core/tiomap3430.c b/drivers/staging/tidspbridge/core/tiomap3430.c
index 8f25a05..9673acb 100644
--- a/drivers/staging/tidspbridge/core/tiomap3430.c
+++ b/drivers/staging/tidspbridge/core/tiomap3430.c
@@ -1318,7 +1318,7 @@ static int bridge_brd_mem_map(struct bridge_dev_context *dev_ctxt,
}
status = pte_set(dev_context->pt_attrs, pa,
va, HW_PAGE_SIZE4KB, &hw_attrs);
- if (DSP_FAILED(status))
+ if (status)
break;

va += HW_PAGE_SIZE4KB;
@@ -1344,7 +1344,7 @@ static int bridge_brd_mem_map(struct bridge_dev_context *dev_ctxt,
status = pte_set(dev_context->pt_attrs,
page_to_phys(mapped_page), va,
HW_PAGE_SIZE4KB, &hw_attrs);
- if (DSP_FAILED(status))
+ if (status)
break;

if (mapped_pages)
diff --git a/drivers/staging/tidspbridge/core/tiomap3430_pwr.c b/drivers/staging/tidspbridge/core/tiomap3430_pwr.c
index d938645..b789f8f 100644
--- a/drivers/staging/tidspbridge/core/tiomap3430_pwr.c
+++ b/drivers/staging/tidspbridge/core/tiomap3430_pwr.c
@@ -228,7 +228,7 @@ int sleep_dsp(struct bridge_dev_context *dev_context, u32 dw_cmd,

/* Turn off DSP Peripheral clocks */
status = dsp_clock_disable_all(dev_context->dsp_per_clks);
- if (DSP_FAILED(status))
+ if (status)
return status;
#ifdef CONFIG_TIDSPBRIDGE_DVFS
else if (target_pwr_state == PWRDM_POWER_OFF) {
--
1.5.4.5

2010-07-28 14:41:43

by Ernesto Ramos

[permalink] [raw]
Subject: [PATCH 08/10] staging:ti dspbridge: remove DSP_FAILED macro from rmgr

Since status succeeded is 0, DSP_FAILED macro
is not necessary anymore.

Signed-off-by: Ernesto Ramos <[email protected]>
---
drivers/staging/tidspbridge/rmgr/dbdcd.c | 24 ++++----
drivers/staging/tidspbridge/rmgr/disp.c | 28 ++++----
drivers/staging/tidspbridge/rmgr/drv.c | 8 +-
drivers/staging/tidspbridge/rmgr/drv_interface.c | 8 +-
drivers/staging/tidspbridge/rmgr/dspdrv.c | 8 +-
drivers/staging/tidspbridge/rmgr/mgr.c | 12 ++--
drivers/staging/tidspbridge/rmgr/nldr.c | 15 ++--
drivers/staging/tidspbridge/rmgr/node.c | 75 +++++++++++-----------
drivers/staging/tidspbridge/rmgr/proc.c | 42 ++++++------
drivers/staging/tidspbridge/rmgr/pwr.c | 8 +-
drivers/staging/tidspbridge/rmgr/rmm.c | 4 +-
drivers/staging/tidspbridge/rmgr/strm.c | 29 ++++----
12 files changed, 129 insertions(+), 132 deletions(-)

diff --git a/drivers/staging/tidspbridge/rmgr/dbdcd.c b/drivers/staging/tidspbridge/rmgr/dbdcd.c
index 12d2d41..f71e860 100644
--- a/drivers/staging/tidspbridge/rmgr/dbdcd.c
+++ b/drivers/staging/tidspbridge/rmgr/dbdcd.c
@@ -135,7 +135,7 @@ int dcd_create_manager(char *sz_zl_dll_name,
DBC_REQUIRE(dcd_mgr);

status = cod_create(&cod_mgr, sz_zl_dll_name, NULL);
- if (DSP_FAILED(status))
+ if (status)
goto func_end;

/* Create a DCD object. */
@@ -464,7 +464,7 @@ int dcd_get_object_def(struct dcd_manager *hdcd_mgr,
/* Open COFF file. */
status = cod_open(dcd_mgr_obj->cod_mgr, dcd_key->path,
COD_NOLOAD, &lib);
- if (DSP_FAILED(status)) {
+ if (status) {
status = -EACCES;
goto func_end;
}
@@ -480,7 +480,7 @@ int dcd_get_object_def(struct dcd_manager *hdcd_mgr,

/* Get section information. */
status = cod_get_section(lib, sz_sect_name, &ul_addr, &ul_len);
- if (DSP_FAILED(status)) {
+ if (status) {
status = -EACCES;
goto func_end;
}
@@ -513,7 +513,7 @@ int dcd_get_object_def(struct dcd_manager *hdcd_mgr,
/* Parse the content of the COFF buffer. */
status =
get_attrs_from_buf(psz_coff_buf, ul_len, obj_type, obj_def);
- if (DSP_FAILED(status))
+ if (status)
status = -EACCES;
} else {
status = -EACCES;
@@ -557,14 +557,14 @@ int dcd_get_objects(struct dcd_manager *hdcd_mgr,

/* Open DSP coff file, don't load symbols. */
status = cod_open(dcd_mgr_obj->cod_mgr, sz_coff_path, COD_NOLOAD, &lib);
- if (DSP_FAILED(status)) {
+ if (status) {
status = -EACCES;
goto func_cont;
}

/* Get DCD_RESIGER_SECTION section information. */
status = cod_get_section(lib, DCD_REGISTER_SECTION, &ul_addr, &ul_len);
- if (DSP_FAILED(status) || !(ul_len > 0)) {
+ if (status || !(ul_len > 0)) {
status = -EACCES;
goto func_cont;
}
@@ -617,7 +617,7 @@ int dcd_get_objects(struct dcd_manager *hdcd_mgr,
*/
status =
register_fxn(&dsp_uuid_obj, object_type, handle);
- if (DSP_FAILED(status)) {
+ if (status) {
/* if error occurs, break from while loop. */
break;
}
@@ -729,7 +729,7 @@ int dcd_get_library_name(struct dcd_manager *hdcd_mgr,
status = -ENOKEY;

/* If can't find, phases might be registered as generic LIBRARYTYPE */
- if (DSP_FAILED(status) && phase != NLDR_NOPHASE) {
+ if (status && phase != NLDR_NOPHASE) {
if (phase_split)
*phase_split = false;

@@ -872,7 +872,7 @@ int dcd_register_object(struct dsp_uuid *uuid_obj,
status = -EPERM;
}

- if (DSP_FAILED(status))
+ if (status)
goto func_end;

/*
@@ -1449,14 +1449,14 @@ static int get_dep_lib_info(struct dcd_manager *hdcd_mgr,
/* Get dependent library section information. */
status = cod_get_section(lib, DEPLIBSECT, &ul_addr, &ul_len);

- if (DSP_FAILED(status)) {
+ if (status) {
/* Ok, no dependent libraries */
ul_len = 0;
status = 0;
}
}

- if (DSP_FAILED(status) || !(ul_len > 0))
+ if (status || !(ul_len > 0))
goto func_cont;

/* Allocate zeroed buffer. */
@@ -1466,7 +1466,7 @@ static int get_dep_lib_info(struct dcd_manager *hdcd_mgr,

/* Read section contents. */
status = cod_read_section(lib, DEPLIBSECT, psz_coff_buf, ul_len);
- if (DSP_FAILED(status))
+ if (status)
goto func_cont;

/* Compress and format DSP buffer to conform to PC format. */
diff --git a/drivers/staging/tidspbridge/rmgr/disp.c b/drivers/staging/tidspbridge/rmgr/disp.c
index 2d479b2..b7ce435 100644
--- a/drivers/staging/tidspbridge/rmgr/disp.c
+++ b/drivers/staging/tidspbridge/rmgr/disp.c
@@ -121,12 +121,12 @@ int disp_create(struct disp_object **dispatch_obj,

/* check device type and decide if streams or messag'ing is used for
* RMS/EDS */
- if (DSP_FAILED(status))
+ if (status)
goto func_cont;

status = dev_get_dev_type(hdev_obj, &dev_type);

- if (DSP_FAILED(status))
+ if (status)
goto func_cont;

if (dev_type != DSP_UNIT) {
@@ -168,7 +168,7 @@ func_cont:
else
delete_disp(disp_obj);

- DBC_ENSURE(((DSP_FAILED(status)) && ((*dispatch_obj == NULL))) ||
+ DBC_ENSURE((status && *dispatch_obj == NULL) ||
(!status && *dispatch_obj));
return status;
}
@@ -284,7 +284,7 @@ int disp_node_create(struct disp_object *disp_obj,

status = dev_get_dev_type(disp_obj->hdev_obj, &dev_type);

- if (DSP_FAILED(status))
+ if (status)
goto func_end;

if (dev_type != DSP_UNIT) {
@@ -377,7 +377,7 @@ int disp_node_create(struct disp_object *disp_obj,
node_msg_args.arg_length);
total += dw_length;
}
- if (DSP_FAILED(status))
+ if (status)
goto func_end;

/* If node is a task node, copy task create arguments into buffer */
@@ -425,7 +425,7 @@ int disp_node_create(struct disp_object *disp_obj,
/* Fill SIO defs and offsets */
offset = sio_defs_offset;
for (i = 0; i < task_arg_obj.num_inputs; i++) {
- if (DSP_FAILED(status))
+ if (status)
break;

pdw_buf[sio_in_def_offset + i] =
@@ -467,7 +467,7 @@ int disp_node_create(struct disp_object *disp_obj,
* on the DSP-side
*/
status = (((rms_word *) (disp_obj->pbuf))[0]);
- if (DSP_FAILED(status))
+ if (status < 0)
dev_dbg(bridge, "%s: DSP-side failed: 0x%x\n",
__func__, status);
}
@@ -520,7 +520,7 @@ int disp_node_delete(struct disp_object *disp_obj,
* function on the DSP-side
*/
status = (((rms_word *) (disp_obj->pbuf))[0]);
- if (DSP_FAILED(status))
+ if (status < 0)
dev_dbg(bridge, "%s: DSP-side failed: "
"0x%x\n", __func__, status);
}
@@ -573,7 +573,7 @@ int disp_node_run(struct disp_object *disp_obj,
* function on the DSP-side
*/
status = (((rms_word *) (disp_obj->pbuf))[0]);
- if (DSP_FAILED(status))
+ if (status < 0)
dev_dbg(bridge, "%s: DSP-side failed: "
"0x%x\n", __func__, status);
}
@@ -603,7 +603,7 @@ static void delete_disp(struct disp_object *disp_obj)
* is invalid. */
status = (*intf_fxns->pfn_chnl_close)
(disp_obj->chnl_from_dsp);
- if (DSP_FAILED(status)) {
+ if (status) {
dev_dbg(bridge, "%s: Failed to close channel "
"from RMS: 0x%x\n", __func__, status);
}
@@ -612,7 +612,7 @@ static void delete_disp(struct disp_object *disp_obj)
status =
(*intf_fxns->pfn_chnl_close) (disp_obj->
chnl_to_dsp);
- if (DSP_FAILED(status)) {
+ if (status) {
dev_dbg(bridge, "%s: Failed to close channel to"
" RMS: 0x%x\n", __func__, status);
}
@@ -704,7 +704,7 @@ static int send_message(struct disp_object *disp_obj, u32 timeout,
/* Send the command */
status = (*intf_fxns->pfn_chnl_add_io_req) (chnl_obj, pbuf, ul_bytes, 0,
0L, dw_arg);
- if (DSP_FAILED(status))
+ if (status)
goto func_end;

status =
@@ -718,14 +718,14 @@ static int send_message(struct disp_object *disp_obj, u32 timeout,
}
}
/* Get the reply */
- if (DSP_FAILED(status))
+ if (status)
goto func_end;

chnl_obj = disp_obj->chnl_from_dsp;
ul_bytes = REPLYSIZE;
status = (*intf_fxns->pfn_chnl_add_io_req) (chnl_obj, pbuf, ul_bytes,
0, 0L, dw_arg);
- if (DSP_FAILED(status))
+ if (status)
goto func_end;

status =
diff --git a/drivers/staging/tidspbridge/rmgr/drv.c b/drivers/staging/tidspbridge/rmgr/drv.c
index 93e9369..12c270a 100644
--- a/drivers/staging/tidspbridge/rmgr/drv.c
+++ b/drivers/staging/tidspbridge/rmgr/drv.c
@@ -180,7 +180,7 @@ int drv_remove_all_dmm_res_elements(void *process_ctxt)
list_for_each_entry_safe(map_obj, temp_map, &ctxt->dmm_map_list, link) {
status = proc_un_map(ctxt->hprocessor,
(void *)map_obj->dsp_addr, ctxt);
- if (DSP_FAILED(status))
+ if (status)
pr_err("%s: proc_un_map failed!"
" status = 0x%xn", __func__, status);
}
@@ -190,7 +190,7 @@ int drv_remove_all_dmm_res_elements(void *process_ctxt)
status = proc_un_reserve_memory(ctxt->hprocessor, (void *)
rsv_obj->dsp_reserved_addr,
ctxt);
- if (DSP_FAILED(status))
+ if (status)
pr_err("%s: proc_un_reserve_memory failed!"
" status = 0x%xn", __func__, status);
}
@@ -464,7 +464,7 @@ int drv_create(struct drv_object **drv_obj)
kfree(pdrv_object);
}

- DBC_ENSURE(DSP_FAILED(status) || pdrv_object);
+ DBC_ENSURE(status || pdrv_object);
return status;
}

@@ -767,7 +767,7 @@ int drv_request_resources(u32 dw_context, u32 *dev_node_strg)

DBC_ENSURE((!status && dev_node_strg != NULL &&
!LST_IS_EMPTY(pdrv_object->dev_node_string)) ||
- (DSP_FAILED(status) && *dev_node_strg == 0));
+ (status && *dev_node_strg == 0));

return status;
}
diff --git a/drivers/staging/tidspbridge/rmgr/drv_interface.c b/drivers/staging/tidspbridge/rmgr/drv_interface.c
index b1dcf4a..aec7cf7 100644
--- a/drivers/staging/tidspbridge/rmgr/drv_interface.c
+++ b/drivers/staging/tidspbridge/rmgr/drv_interface.c
@@ -201,7 +201,7 @@ static void bridge_recover(struct work_struct *work)
}
dev = dev_get_first();
dev_get_dev_node(dev, &dev_node);
- if (!dev_node || DSP_FAILED(proc_auto_start(dev_node, dev)))
+ if (!dev_node || proc_auto_start(dev_node, dev))
pr_err("DSP could not be restarted\n");
recover = false;
complete_all(&bridge_open_comp);
@@ -397,7 +397,7 @@ static int __devexit omap34_xx_bridge_remove(struct platform_device *pdev)
void *hdrv_obj = NULL;

status = cfg_get_object((u32 *) &hdrv_obj, REG_DRV_OBJECT);
- if (DSP_FAILED(status))
+ if (status)
goto func_cont;

#ifdef CONFIG_TIDSPBRIDGE_DVFS
@@ -439,7 +439,7 @@ static int BRIDGE_SUSPEND(struct platform_device *pdev, pm_message_t state)
u32 command = PWR_EMERGENCYDEEPSLEEP;

status = pwr_sleep_dsp(command, time_out);
- if (DSP_FAILED(status))
+ if (status)
return -1;

bridge_suspend_data.suspended = 1;
@@ -451,7 +451,7 @@ static int BRIDGE_RESUME(struct platform_device *pdev)
u32 status;

status = pwr_wake_dsp(time_out);
- if (DSP_FAILED(status))
+ if (status)
return -1;

bridge_suspend_data.suspended = 0;
diff --git a/drivers/staging/tidspbridge/rmgr/dspdrv.c b/drivers/staging/tidspbridge/rmgr/dspdrv.c
index 0a10d88..714f348 100644
--- a/drivers/staging/tidspbridge/rmgr/dspdrv.c
+++ b/drivers/staging/tidspbridge/rmgr/dspdrv.c
@@ -56,7 +56,7 @@ u32 dsp_init(u32 *init_status)
goto func_cont;

status = drv_create(&drv_obj);
- if (DSP_FAILED(status)) {
+ if (status) {
api_exit();
goto func_cont;
}
@@ -68,7 +68,7 @@ u32 dsp_init(u32 *init_status)
/* Attempt to Start the Device */
status = dev_start_device((struct cfg_devnode *)
device_node_string);
- if (DSP_FAILED(status))
+ if (status)
(void)drv_release_resources
((u32) device_node_string, drv_obj);
} else {
@@ -77,7 +77,7 @@ u32 dsp_init(u32 *init_status)
}

/* Unwind whatever was loaded */
- if (DSP_FAILED(status)) {
+ if (status) {
/* irrespective of the status of dev_remove_device we conitinue
* unloading. Get the Driver Object iterate through and remove.
* Reset the status to E_FAIL to avoid going through
@@ -106,7 +106,7 @@ func_cont:
dev_dbg(bridge, "%s: Failed\n", __func__);
} /* End api_init_complete2 */
DBC_ENSURE((!status && drv_obj != NULL) ||
- (DSP_FAILED(status) && drv_obj == NULL));
+ (status && drv_obj == NULL));
*init_status = status;
/* Return the Driver Object */
return (u32) drv_obj;
diff --git a/drivers/staging/tidspbridge/rmgr/mgr.c b/drivers/staging/tidspbridge/rmgr/mgr.c
index 57ae807..57a39b9 100644
--- a/drivers/staging/tidspbridge/rmgr/mgr.c
+++ b/drivers/staging/tidspbridge/rmgr/mgr.c
@@ -82,7 +82,7 @@ int mgr_create(struct mgr_object **mgr_obj,
status = -ENOMEM;
}

- DBC_ENSURE(DSP_FAILED(status) || pmgr_obj);
+ DBC_ENSURE(status || pmgr_obj);
return status;
}

@@ -132,7 +132,7 @@ int mgr_enum_node_info(u32 node_id, struct dsp_ndbprops *pndb_props,
*pu_num_nodes = 0;
/* Get The Manager Object from the Registry */
status = cfg_get_object((u32 *) &pmgr_obj, REG_MGR_OBJECT);
- if (DSP_FAILED(status))
+ if (status)
goto func_cont;

DBC_ASSERT(pmgr_obj);
@@ -167,7 +167,7 @@ int mgr_enum_node_info(u32 node_id, struct dsp_ndbprops *pndb_props,

func_cont:
DBC_ENSURE((!status && *pu_num_nodes > 0) ||
- (DSP_FAILED(status) && *pu_num_nodes == 0));
+ (status && *pu_num_nodes == 0));

return status;
}
@@ -216,11 +216,11 @@ int mgr_enum_processor_info(u32 processor_id,
processor_info->processor_type = DSPTYPE64;
}
}
- if (DSP_FAILED(status))
+ if (status)
goto func_end;

/* Get The Manager Object from the Registry */
- if (DSP_FAILED(cfg_get_object((u32 *) &pmgr_obj, REG_MGR_OBJECT))) {
+ if (cfg_get_object((u32 *) &pmgr_obj, REG_MGR_OBJECT)) {
dev_dbg(bridge, "%s: Failed to get MGR Object\n", __func__);
goto func_end;
}
@@ -319,7 +319,7 @@ int mgr_get_dcd_handle(struct mgr_object *mgr_handle,
status = 0;
}
DBC_ENSURE((!status && *dcd_handle != (u32) NULL) ||
- (DSP_FAILED(status) && *dcd_handle == (u32) NULL));
+ (status && *dcd_handle == (u32) NULL));

return status;
}
diff --git a/drivers/staging/tidspbridge/rmgr/nldr.c b/drivers/staging/tidspbridge/rmgr/nldr.c
index 3b83fc3..d8f4eeb 100644
--- a/drivers/staging/tidspbridge/rmgr/nldr.c
+++ b/drivers/staging/tidspbridge/rmgr/nldr.c
@@ -399,11 +399,11 @@ int nldr_allocate(struct nldr_object *nldr_obj, void *priv_ref,
*nldr_nodeobj = (struct nldr_nodeobject *)nldr_node_obj;
}
/* Cleanup on failure */
- if (DSP_FAILED(status) && nldr_node_obj)
+ if (status && nldr_node_obj)
kfree(nldr_node_obj);

DBC_ENSURE((!status && *nldr_nodeobj)
- || (DSP_FAILED(status) && *nldr_nodeobj == NULL));
+ || (status && *nldr_nodeobj == NULL));
return status;
}

@@ -587,8 +587,7 @@ int nldr_create(struct nldr_object **nldr,
*nldr = NULL;
}
/* FIXME:Temp. Fix. Must be removed */
- DBC_ENSURE((!status && *nldr)
- || (DSP_FAILED(status) && (*nldr == NULL)));
+ DBC_ENSURE((!status && *nldr) || (status && *nldr == NULL));
return status;
}

@@ -1012,7 +1011,7 @@ static int add_ovly_node(struct dsp_uuid *uuid_obj,
status =
dcd_get_object_def(nldr_obj->hdcd_mgr, uuid_obj, obj_type,
&obj_def);
- if (DSP_FAILED(status))
+ if (status)
goto func_end;

/* If overlay node, add to the list */
@@ -1422,7 +1421,7 @@ static int load_lib(struct nldr_nodeobject *nldr_node_obj,
* were loaded, and close the root library.
* (Persistent libraries are unloaded from the very top)
*/
- if (DSP_FAILED(status)) {
+ if (status) {
if (phase != NLDR_EXECUTE) {
for (i = 0; i < nldr_node_obj->pers_libs; i++)
unload_lib(nldr_node_obj,
@@ -1593,7 +1592,7 @@ static int load_ovly(struct nldr_nodeobject *nldr_node_obj,
}
}
}
- if (DSP_FAILED(status)) {
+ if (status) {
/* 'Deallocate' memory */
free_sects(nldr_obj, phase_sects, alloc_num);
free_sects(nldr_obj, other_sects_list, other_alloc);
@@ -1684,7 +1683,7 @@ static int remote_alloc(void **ref, u16 mem_sect, u32 size,
rmm_addr_obj->segid = segid;
status =
rmm_alloc(rmm, segid, word_size, align, dsp_address, false);
- if (DSP_FAILED(status)) {
+ if (status) {
dev_dbg(bridge, "%s: Unable allocate from segment %d\n",
__func__, segid);
}
diff --git a/drivers/staging/tidspbridge/rmgr/node.c b/drivers/staging/tidspbridge/rmgr/node.c
index d8593fd..e2d02c4 100644
--- a/drivers/staging/tidspbridge/rmgr/node.c
+++ b/drivers/staging/tidspbridge/rmgr/node.c
@@ -345,7 +345,7 @@ int node_allocate(struct proc_object *hprocessor,

}

- if (DSP_FAILED(status))
+ if (status)
goto func_end;

status = dev_get_bridge_context(hdev_obj, &pbridge_context);
@@ -356,7 +356,7 @@ int node_allocate(struct proc_object *hprocessor,

status = proc_get_state(hprocessor, &proc_state,
sizeof(struct dsp_processorstate));
- if (DSP_FAILED(status))
+ if (status)
goto func_end;
/* If processor is in error state then don't attempt
to send the message */
@@ -380,7 +380,7 @@ int node_allocate(struct proc_object *hprocessor,
}
}
/* Allocate node object and fill in */
- if (DSP_FAILED(status))
+ if (status)
goto func_end;

pnode = kzalloc(sizeof(struct node_object), GFP_KERNEL);
@@ -395,7 +395,7 @@ int node_allocate(struct proc_object *hprocessor,
/* Get dsp_ndbprops from node database */
status = get_node_props(hnode_mgr->hdcd_mgr, pnode, node_uuid,
&(pnode->dcd_props));
- if (DSP_FAILED(status))
+ if (status)
goto func_cont;

pnode->node_uuid = *node_uuid;
@@ -428,7 +428,7 @@ int node_allocate(struct proc_object *hprocessor,
pnode->create_args.asa.task_arg_obj.ugpp_heap_addr =
(u32) attr_in->pgpp_virt_addr;
}
- if (DSP_FAILED(status))
+ if (status)
goto func_cont;

status = proc_reserve_memory(hprocessor,
@@ -437,7 +437,7 @@ int node_allocate(struct proc_object *hprocessor,
(void **)&(pnode->create_args.asa.
task_arg_obj.udsp_heap_res_addr),
pr_ctxt);
- if (DSP_FAILED(status)) {
+ if (status) {
pr_err("%s: Failed to reserve memory for heap: 0x%x\n",
__func__, status);
goto func_cont;
@@ -460,7 +460,7 @@ int node_allocate(struct proc_object *hprocessor,
(void *)pnode->create_args.asa.task_arg_obj.
udsp_heap_res_addr, (void **)&mapped_addr, map_attrs,
pr_ctxt);
- if (DSP_FAILED(status))
+ if (status)
pr_err("%s: Failed to map memory for Heap: 0x%x\n",
__func__, status);
else
@@ -597,7 +597,7 @@ func_cont:
hnode_mgr->nldr_fxns.
pfn_get_fxn_addr(pnode->nldr_node_obj, "DYNEXT_BEG",
&dynext_base);
- if (DSP_FAILED(status))
+ if (status)
pr_err("%s: Failed to get addr for DYNEXT_BEG"
" status = 0x%x\n", __func__, status);

@@ -606,7 +606,7 @@ func_cont:
pfn_get_fxn_addr(pnode->nldr_node_obj,
"L1DSRAM_HEAP", &pul_value);

- if (DSP_FAILED(status))
+ if (status)
pr_err("%s: Failed to get addr for L1DSRAM_HEAP"
" status = 0x%x\n", __func__, status);

@@ -614,7 +614,7 @@ func_cont:
if (!host_res)
status = -EPERM;

- if (DSP_FAILED(status)) {
+ if (status) {
pr_err("%s: Failed to get host resource, status"
" = 0x%x\n", __func__, status);
goto func_end;
@@ -670,7 +670,7 @@ func_cont:
drv_proc_node_update_heap_status(node_res, true);
drv_proc_node_update_status(node_res, true);
}
- DBC_ENSURE((DSP_FAILED(status) && (*ph_node == NULL)) ||
+ DBC_ENSURE((status && (*ph_node == NULL)) ||
(!status && *ph_node));
func_end:
dev_dbg(bridge, "%s: hprocessor: %p node_uuid: %p pargs: %p attr_in:"
@@ -704,7 +704,7 @@ DBAPI node_alloc_msg_buf(struct node_object *hnode, u32 usize,
else if (node_get_type(pnode) == NODE_DEVICE)
status = -EPERM;

- if (DSP_FAILED(status))
+ if (status)
goto func_end;

if (pattr == NULL)
@@ -792,7 +792,7 @@ int node_change_priority(struct node_object *hnode, s32 prio)
else if (prio < hnode_mgr->min_pri || prio > hnode_mgr->max_pri)
status = -EDOM;
}
- if (DSP_FAILED(status))
+ if (status)
goto func_end;

/* Enter critical section */
@@ -905,7 +905,7 @@ int node_connect(struct node_object *node1, u32 stream1,
status = -EPERM; /* illegal stream mode */

}
- if (DSP_FAILED(status))
+ if (status)
goto func_end;

if (node1_type != NODE_GPP) {
@@ -1167,7 +1167,7 @@ int node_create(struct node_object *hnode)
hprocessor = hnode->hprocessor;
status = proc_get_state(hprocessor, &proc_state,
sizeof(struct dsp_processorstate));
- if (DSP_FAILED(status))
+ if (status)
goto func_end;
/* If processor is in error state then don't attempt to create
new node */
@@ -1190,7 +1190,7 @@ int node_create(struct node_object *hnode)
if (!status)
status = proc_get_processor_id(pnode->hprocessor, &proc_id);

- if (DSP_FAILED(status))
+ if (status)
goto func_cont2;

if (proc_id != DSP_UNIT)
@@ -1267,7 +1267,7 @@ int node_create(struct node_object *hnode)
NLDR_CREATE);
hnode->loaded = false;
}
- if (DSP_FAILED(status1))
+ if (status1)
pr_err("%s: Failed to unload create code: 0x%x\n",
__func__, status1);
func_cont2:
@@ -1421,8 +1421,7 @@ int node_create_mgr(struct node_mgr **node_man,
else
delete_node_mgr(node_mgr_obj);

- DBC_ENSURE((DSP_FAILED(status) && (*node_man == NULL)) ||
- (!status && *node_man));
+ DBC_ENSURE((status && *node_man == NULL) || (!status && *node_man));

return status;
}
@@ -1478,7 +1477,7 @@ int node_delete(struct node_object *hnode,
if (!(state == NODE_ALLOCATED && hnode->node_env == (u32) NULL) &&
node_type != NODE_DEVICE) {
status = proc_get_processor_id(pnode->hprocessor, &proc_id);
- if (DSP_FAILED(status))
+ if (status)
goto func_cont1;

if (proc_id == DSP_UNIT || proc_id == IVA_UNIT) {
@@ -1549,7 +1548,7 @@ func_cont1:
pfn_unload(hnode->nldr_node_obj,
NLDR_EXECUTE);
}
- if (DSP_FAILED(status1))
+ if (status1)
pr_err("%s: fail - unload execute code:"
" 0x%x\n", __func__, status1);

@@ -1558,7 +1557,7 @@ func_cont1:
nldr_node_obj,
NLDR_DELETE);
hnode->loaded = false;
- if (DSP_FAILED(status1))
+ if (status1)
pr_err("%s: fail - unload delete code: "
"0x%x\n", __func__, status1);
}
@@ -1822,7 +1821,7 @@ int node_get_message(struct node_object *hnode,
hprocessor = hnode->hprocessor;
status = proc_get_state(hprocessor, &proc_state,
sizeof(struct dsp_processorstate));
- if (DSP_FAILED(status))
+ if (status)
goto func_end;
/* If processor is in error state then don't attempt to get the
message */
@@ -1846,7 +1845,7 @@ int node_get_message(struct node_object *hnode,
status =
(*intf_fxns->pfn_msg_get) (hnode->msg_queue_obj, message, utimeout);
/* Check if message contains SM descriptor */
- if (DSP_FAILED(status) || !(message->dw_cmd & DSP_RMSBUFDESC))
+ if (status || !(message->dw_cmd & DSP_RMSBUFDESC))
goto func_end;

/* Translate DSP byte addr to GPP Va. */
@@ -2030,7 +2029,7 @@ int node_pause(struct node_object *hnode)
if (node_type != NODE_TASK && node_type != NODE_DAISSOCKET)
status = -EPERM;
}
- if (DSP_FAILED(status))
+ if (status)
goto func_end;

status = proc_get_processor_id(pnode->hprocessor, &proc_id);
@@ -2048,12 +2047,12 @@ int node_pause(struct node_object *hnode)
if (state != NODE_RUNNING)
status = -EBADR;

- if (DSP_FAILED(status))
+ if (status)
goto func_cont;
hprocessor = hnode->hprocessor;
status = proc_get_state(hprocessor, &proc_state,
sizeof(struct dsp_processorstate));
- if (DSP_FAILED(status))
+ if (status)
goto func_cont;
/* If processor is in error state then don't attempt
to send the message */
@@ -2115,7 +2114,7 @@ int node_put_message(struct node_object *hnode,
hprocessor = hnode->hprocessor;
status = proc_get_state(hprocessor, &proc_state,
sizeof(struct dsp_processorstate));
- if (DSP_FAILED(status))
+ if (status)
goto func_end;
/* If processor is in bad state then don't attempt sending the
message */
@@ -2145,7 +2144,7 @@ int node_put_message(struct node_object *hnode,
/* end of sync_enter_cs */
mutex_unlock(&hnode_mgr->node_mgr_lock);
}
- if (DSP_FAILED(status))
+ if (status)
goto func_end;

/* assign pmsg values to new msg */
@@ -2267,7 +2266,7 @@ int node_run(struct node_object *hnode)
hprocessor = hnode->hprocessor;
status = proc_get_state(hprocessor, &proc_state,
sizeof(struct dsp_processorstate));
- if (DSP_FAILED(status))
+ if (status)
goto func_end;
/* If processor is in error state then don't attempt to run the node */
if (proc_state.proc_state == PROC_ERROR) {
@@ -2277,7 +2276,7 @@ int node_run(struct node_object *hnode)
node_type = node_get_type(hnode);
if (node_type == NODE_DEVICE)
status = -EPERM;
- if (DSP_FAILED(status))
+ if (status)
goto func_end;

hnode_mgr = hnode->hnode_mgr;
@@ -2296,7 +2295,7 @@ int node_run(struct node_object *hnode)
if (!status)
status = proc_get_processor_id(pnode->hprocessor, &proc_id);

- if (DSP_FAILED(status))
+ if (status)
goto func_cont1;

if ((proc_id != DSP_UNIT) && (proc_id != IVA_UNIT))
@@ -2420,7 +2419,7 @@ int node_terminate(struct node_object *hnode, int *pstatus)
*/
status = proc_get_state(pnode->hprocessor, &proc_state,
sizeof(struct dsp_processorstate));
- if (DSP_FAILED(status))
+ if (status)
goto func_cont;
/* If processor is in error state then don't attempt to send
* A kill task command */
@@ -2442,7 +2441,7 @@ int node_terminate(struct node_object *hnode, int *pstatus)

status = (*intf_fxns->pfn_msg_put) (hnode->msg_queue_obj, &msg,
hnode->utimeout);
- if (DSP_FAILED(status))
+ if (status)
goto func_cont;

/*
@@ -2458,11 +2457,11 @@ int node_terminate(struct node_object *hnode, int *pstatus)

status = (*intf_fxns->pfn_msg_put)(hnode->msg_queue_obj,
&killmsg, hnode->utimeout);
- if (DSP_FAILED(status))
+ if (status)
goto func_cont;
status = sync_wait_on_event(hnode->sync_done,
kill_time_out / 2);
- if (DSP_FAILED(status)) {
+ if (status) {
/*
* Here it goes the part of the simulation of
* the DSP exception.
@@ -3022,7 +3021,7 @@ int node_get_uuid_props(void *hprocessor,
}
status = proc_get_state(hprocessor, &proc_state,
sizeof(struct dsp_processorstate));
- if (DSP_FAILED(status))
+ if (status)
goto func_end;
/* If processor is in error state then don't attempt
to send the message */
@@ -3099,7 +3098,7 @@ static int get_rms_fxns(struct node_mgr *hnode_mgr)
for (i = 0; i < NUMRMSFXNS; i++) {
status = dev_get_symbol(dev_obj, psz_fxns[i],
&(hnode_mgr->ul_fxn_addrs[i]));
- if (DSP_FAILED(status)) {
+ if (status) {
if (status == -ESPIPE) {
/*
* May be loaded dynamically (in the future),
diff --git a/drivers/staging/tidspbridge/rmgr/proc.c b/drivers/staging/tidspbridge/rmgr/proc.c
index 570927f..6258d8b 100644
--- a/drivers/staging/tidspbridge/rmgr/proc.c
+++ b/drivers/staging/tidspbridge/rmgr/proc.c
@@ -302,7 +302,7 @@ proc_attach(u32 processor_id,
if (!status)
status = dev_get_dev_type(hdev_obj, &dev_type);

- if (DSP_FAILED(status))
+ if (status)
goto func_end;

/* If we made it this far, create the Proceesor object: */
@@ -329,12 +329,12 @@ proc_attach(u32 processor_id,
if (!status) {
status = dev_get_bridge_context(hdev_obj,
&p_proc_object->hbridge_context);
- if (DSP_FAILED(status))
+ if (status)
kfree(p_proc_object);
} else
kfree(p_proc_object);

- if (DSP_FAILED(status))
+ if (status)
goto func_end;

/* Create the Notification Object */
@@ -376,7 +376,7 @@ proc_attach(u32 processor_id,
DSP_PROCESSORATTACH);
}
} else {
- /* Don't leak memory if DSP_FAILED */
+ /* Don't leak memory if status is failed */
kfree(p_proc_object);
}
func_end:
@@ -437,7 +437,7 @@ int proc_auto_start(struct cfg_devnode *dev_node_obj,

/* Create a Dummy PROC Object */
status = cfg_get_object((u32 *) &hmgr_obj, REG_MGR_OBJECT);
- if (DSP_FAILED(status))
+ if (status)
goto func_end;

p_proc_object = kzalloc(sizeof(struct proc_object), GFP_KERNEL);
@@ -451,13 +451,13 @@ int proc_auto_start(struct cfg_devnode *dev_node_obj,
if (!status)
status = dev_get_bridge_context(hdev_obj,
&p_proc_object->hbridge_context);
- if (DSP_FAILED(status))
+ if (status)
goto func_cont;

/* Stop the Device, put it into standby mode */
status = proc_stop(p_proc_object);

- if (DSP_FAILED(status))
+ if (status)
goto func_cont;

/* Get the default executable for this board... */
@@ -953,7 +953,7 @@ int proc_get_dev_object(void *hprocessor,
}

DBC_ENSURE((!status && *device_obj != NULL) ||
- (DSP_FAILED(status) && *device_obj == NULL));
+ (status && *device_obj == NULL));

return status;
}
@@ -1103,12 +1103,12 @@ int proc_load(void *hprocessor, const s32 argc_index,
goto func_end;
}
status = proc_stop(hprocessor);
- if (DSP_FAILED(status))
+ if (status)
goto func_end;

/* Place the board in the monitor state. */
status = proc_monitor(hprocessor);
- if (DSP_FAILED(status))
+ if (status)
goto func_end;

/* Save ptr to original argv[0]. */
@@ -1174,7 +1174,7 @@ int proc_load(void *hprocessor, const s32 argc_index,
if (status == -EACCES)
status = 0;

- if (DSP_FAILED(status)) {
+ if (status) {
status = -EPERM;
} else {
DBC_ASSERT(p_proc_object->psz_last_coff ==
@@ -1225,7 +1225,7 @@ int proc_load(void *hprocessor, const s32 argc_index,
status = cod_load_base(cod_mgr, argc_index, (char **)user_args,
dev_brd_write_fxn,
p_proc_object->hdev_obj, NULL);
- if (DSP_FAILED(status)) {
+ if (status) {
if (status == -EBADF) {
dev_dbg(bridge, "%s: Failure to Load the EXE\n",
__func__);
@@ -1302,12 +1302,12 @@ int proc_load(void *hprocessor, const s32 argc_index,
}

func_end:
- if (DSP_FAILED(status))
+ if (status)
pr_err("%s: Processor failed to load\n", __func__);

DBC_ENSURE((!status
&& p_proc_object->proc_state == PROC_LOADED)
- || DSP_FAILED(status));
+ || status);
#ifdef OPT_LOAD_TIME_INSTRUMENTATION
do_gettimeofday(&tv2);
if (tv2.tv_usec < tv1.tv_usec) {
@@ -1391,7 +1391,7 @@ int proc_map(void *hprocessor, void *pmpu_addr, u32 ul_size,
}
mutex_unlock(&proc_lock);

- if (DSP_FAILED(status))
+ if (status)
goto func_end;

func_end:
@@ -1454,7 +1454,7 @@ int proc_register_notify(void *hprocessor, u32 event_mask,
* so if we're trying to deregister and ntfy_register
* failed, we'll give the deh manager a shot.
*/
- if ((event_mask == 0) && DSP_FAILED(status)) {
+ if ((event_mask == 0) && status) {
status =
dev_get_deh_mgr(p_proc_object->hdev_obj,
&hdeh_mgr);
@@ -1558,12 +1558,12 @@ int proc_start(void *hprocessor)
}

status = cod_get_entry(cod_mgr, &dw_dsp_addr);
- if (DSP_FAILED(status))
+ if (status)
goto func_cont;

status = (*p_proc_object->intf_fxns->pfn_brd_start)
(p_proc_object->hbridge_context, dw_dsp_addr);
- if (DSP_FAILED(status))
+ if (status)
goto func_cont;

/* Call dev_create2 */
@@ -1598,7 +1598,7 @@ func_cont:

func_end:
DBC_ENSURE((!status && p_proc_object->proc_state ==
- PROC_RUNNING) || DSP_FAILED(status));
+ PROC_RUNNING) || status);
return status;
}

@@ -1705,7 +1705,7 @@ int proc_un_map(void *hprocessor, void *map_addr,
}

mutex_unlock(&proc_lock);
- if (DSP_FAILED(status))
+ if (status)
goto func_end;

/*
@@ -1817,7 +1817,7 @@ static int proc_monitor(struct proc_object *proc_obj)
}

DBC_ENSURE((!status && brd_state == BRD_IDLE) ||
- DSP_FAILED(status));
+ status);
return status;
}

diff --git a/drivers/staging/tidspbridge/rmgr/pwr.c b/drivers/staging/tidspbridge/rmgr/pwr.c
index 69c2e19..85cb1a2 100644
--- a/drivers/staging/tidspbridge/rmgr/pwr.c
+++ b/drivers/staging/tidspbridge/rmgr/pwr.c
@@ -49,14 +49,14 @@ int pwr_sleep_dsp(const u32 sleep_code, const u32 timeout)
hdev_obj != NULL;
hdev_obj =
(struct dev_object *)drv_get_next_dev_object((u32) hdev_obj)) {
- if (DSP_FAILED(dev_get_bridge_context(hdev_obj,
+ if (dev_get_bridge_context(hdev_obj,
(struct bridge_dev_context **)
- &dw_context))) {
+ &dw_context)) {
continue;
}
- if (DSP_FAILED(dev_get_intf_fxns(hdev_obj,
+ if (dev_get_intf_fxns(hdev_obj,
(struct bridge_drv_interface **)
- &intf_fxns))) {
+ &intf_fxns)) {
continue;
}
if (sleep_code == PWR_DEEPSLEEP)
diff --git a/drivers/staging/tidspbridge/rmgr/rmm.c b/drivers/staging/tidspbridge/rmgr/rmm.c
index 633d441..761e8f4 100644
--- a/drivers/staging/tidspbridge/rmgr/rmm.c
+++ b/drivers/staging/tidspbridge/rmgr/rmm.c
@@ -186,7 +186,7 @@ int rmm_create(struct rmm_target_obj **target_obj,
if (target == NULL)
status = -ENOMEM;

- if (DSP_FAILED(status))
+ if (status)
goto func_cont;

target->num_segs = num_segs;
@@ -249,7 +249,7 @@ func_cont:
}

DBC_ENSURE((!status && *target_obj)
- || (DSP_FAILED(status) && *target_obj == NULL));
+ || (status && *target_obj == NULL));

return status;
}
diff --git a/drivers/staging/tidspbridge/rmgr/strm.c b/drivers/staging/tidspbridge/rmgr/strm.c
index 35d6378..df8458e 100644
--- a/drivers/staging/tidspbridge/rmgr/strm.c
+++ b/drivers/staging/tidspbridge/rmgr/strm.c
@@ -120,7 +120,7 @@ int strm_allocate_buffer(struct strm_object *stream_obj, u32 usize,
status = -EFAULT;
}

- if (DSP_FAILED(status))
+ if (status)
goto func_end;

for (i = 0; i < num_bufs; i++) {
@@ -133,10 +133,10 @@ int strm_allocate_buffer(struct strm_object *stream_obj, u32 usize,
break;
}
}
- if (DSP_FAILED(status))
+ if (status)
strm_free_buffer(stream_obj, ap_buffer, alloc_cnt, pr_ctxt);

- if (DSP_FAILED(status))
+ if (status)
goto func_end;

if (drv_get_strm_res_element(stream_obj, &hstrm_res, pr_ctxt) !=
@@ -180,7 +180,7 @@ int strm_close(struct strm_object *stream_obj,
status = delete_strm(stream_obj);
}

- if (DSP_FAILED(status))
+ if (status)
goto func_end;

if (drv_get_strm_res_element(stream_obj, &hstrm_res, pr_ctxt) !=
@@ -233,8 +233,7 @@ int strm_create(struct strm_mgr **strm_man,
else
kfree(strm_mgr_obj);

- DBC_ENSURE((!status && *strm_man) ||
- (DSP_FAILED(status) && *strm_man == NULL));
+ DBC_ENSURE((!status && *strm_man) || (status && *strm_man == NULL));

return status;
}
@@ -291,7 +290,7 @@ int strm_free_buffer(struct strm_object *stream_obj, u8 ** ap_buffer,
status =
cmm_xlator_free_buf(stream_obj->xlator,
ap_buffer[i]);
- if (DSP_FAILED(status))
+ if (status)
break;
ap_buffer[i] = NULL;
}
@@ -329,14 +328,14 @@ int strm_get_info(struct strm_object *stream_obj,
status = -EINVAL;
}
}
- if (DSP_FAILED(status))
+ if (status)
goto func_end;

intf_fxns = stream_obj->strm_mgr_obj->intf_fxns;
status =
(*intf_fxns->pfn_chnl_get_info) (stream_obj->chnl_obj,
&chnl_info_obj);
- if (DSP_FAILED(status))
+ if (status)
goto func_end;

if (stream_obj->xlator) {
@@ -540,7 +539,7 @@ int strm_open(struct node_object *hnode, u32 dir, u32 index,

}
}
- if (DSP_FAILED(status))
+ if (status)
goto func_cont;

if ((pattr->virt_base == NULL) || !(pattr->ul_virt_size > 0))
@@ -572,7 +571,7 @@ func_cont:
strm_mgr_obj->hchnl_mgr,
chnl_mode, ul_chnl_id,
&chnl_attr_obj);
- if (DSP_FAILED(status)) {
+ if (status) {
/*
* over-ride non-returnable status codes so we return
* something documented
@@ -767,7 +766,7 @@ int strm_select(struct strm_object **strm_tab, u32 strms,
break;
}
}
- if (DSP_FAILED(status))
+ if (status)
goto func_end;

/* Determine which channels have IO ready */
@@ -775,7 +774,7 @@ int strm_select(struct strm_object **strm_tab, u32 strms,
intf_fxns = strm_tab[i]->strm_mgr_obj->intf_fxns;
status = (*intf_fxns->pfn_chnl_get_info) (strm_tab[i]->chnl_obj,
&chnl_info_obj);
- if (DSP_FAILED(status)) {
+ if (status) {
break;
} else {
if (chnl_info_obj.cio_cs > 0)
@@ -796,7 +795,7 @@ int strm_select(struct strm_object **strm_tab, u32 strms,
strm_tab[i]->strm_mgr_obj->intf_fxns;
status = (*intf_fxns->pfn_chnl_get_info)
(strm_tab[i]->chnl_obj, &chnl_info_obj);
- if (DSP_FAILED(status))
+ if (status)
break;
else
sync_events[i] =
@@ -820,7 +819,7 @@ func_end:
kfree(sync_events);

DBC_ENSURE((!status && (*pmask != 0 || utimeout == 0)) ||
- (DSP_FAILED(status) && *pmask == 0));
+ (status && *pmask == 0));

return status;
}
--
1.5.4.5

2010-07-28 14:41:48

by Ernesto Ramos

[permalink] [raw]
Subject: [PATCH 07/10] staging:ti dspbridge: remove DSP_FAILED macro from pmgr

Since status succeeded is 0, DSP_FAILED macro
is not necessary anymore.

Signed-off-by: Ernesto Ramos <[email protected]>
---
drivers/staging/tidspbridge/pmgr/chnl.c | 2 +-
drivers/staging/tidspbridge/pmgr/cmm.c | 2 +-
drivers/staging/tidspbridge/pmgr/cod.c | 8 +++---
drivers/staging/tidspbridge/pmgr/dbll.c | 12 +++++-----
drivers/staging/tidspbridge/pmgr/dev.c | 24 ++++++++++------------
drivers/staging/tidspbridge/pmgr/dmm.c | 2 +-
drivers/staging/tidspbridge/pmgr/dspapi.c | 30 ++++++++++++++--------------
7 files changed, 39 insertions(+), 41 deletions(-)

diff --git a/drivers/staging/tidspbridge/pmgr/chnl.c b/drivers/staging/tidspbridge/pmgr/chnl.c
index 626a993..90317b5 100644
--- a/drivers/staging/tidspbridge/pmgr/chnl.c
+++ b/drivers/staging/tidspbridge/pmgr/chnl.c
@@ -100,7 +100,7 @@ int chnl_create(struct chnl_mgr **channel_mgr,
}
}

- DBC_ENSURE(DSP_FAILED(status) || chnl_mgr_obj);
+ DBC_ENSURE(status || chnl_mgr_obj);

return status;
}
diff --git a/drivers/staging/tidspbridge/pmgr/cmm.c b/drivers/staging/tidspbridge/pmgr/cmm.c
index 2f974c5..ce3dc88 100644
--- a/drivers/staging/tidspbridge/pmgr/cmm.c
+++ b/drivers/staging/tidspbridge/pmgr/cmm.c
@@ -1042,7 +1042,7 @@ int cmm_xlator_free_buf(struct cmm_xlatorobject *xlator, void *buf_va)
if (buf_pa) {
status = cmm_free_buf(xlator_obj->hcmm_mgr, buf_pa,
xlator_obj->ul_seg_id);
- if (DSP_FAILED(status)) {
+ if (status) {
/* Uh oh, this shouldn't happen. Descriptor
* gone! */
DBC_ASSERT(false); /* CMM is leaking mem */
diff --git a/drivers/staging/tidspbridge/pmgr/cod.c b/drivers/staging/tidspbridge/pmgr/cod.c
index 9f902de..52989ab 100644
--- a/drivers/staging/tidspbridge/pmgr/cod.c
+++ b/drivers/staging/tidspbridge/pmgr/cod.c
@@ -257,7 +257,7 @@ int cod_create(struct cod_manager **mgr, char *str_zl_file,

status = mgr_new->fxns.create_fxn(&mgr_new->target, &zl_attrs);

- if (DSP_FAILED(status)) {
+ if (status) {
cod_delete(mgr_new);
return -ESPIPE;
}
@@ -529,7 +529,7 @@ int cod_load_base(struct cod_manager *cod_mgr_obj, u32 num_argc, char *args[],
status = cod_mgr_obj->fxns.load_fxn(cod_mgr_obj->base_lib, flags,
&new_attrs,
&cod_mgr_obj->ul_entry);
- if (DSP_FAILED(status))
+ if (status)
cod_mgr_obj->fxns.close_fxn(cod_mgr_obj->base_lib);

if (!status)
@@ -570,7 +570,7 @@ int cod_open(struct cod_manager *hmgr, char *sz_coff_path,
*lib_obj = lib;
}

- if (DSP_FAILED(status))
+ if (status)
pr_err("%s: error status 0x%x, sz_coff_path: %s flags: 0x%x\n",
__func__, status, sz_coff_path, flags);
return status;
@@ -608,7 +608,7 @@ int cod_open_base(struct cod_manager *hmgr, char *sz_coff_path,
hmgr->sz_zl_file[COD_MAXPATHLENGTH - 1] = '\0';
}

- if (DSP_FAILED(status))
+ if (status)
pr_err("%s: error status 0x%x sz_coff_path: %s\n", __func__,
status, sz_coff_path);
return status;
diff --git a/drivers/staging/tidspbridge/pmgr/dbll.c b/drivers/staging/tidspbridge/pmgr/dbll.c
index ea27824..2340638 100644
--- a/drivers/staging/tidspbridge/pmgr/dbll.c
+++ b/drivers/staging/tidspbridge/pmgr/dbll.c
@@ -256,7 +256,7 @@ int dbll_create(struct dbll_tar_obj **target_obj,
*target_obj = (struct dbll_tar_obj *)pzl_target;
}
DBC_ENSURE((!status && *target_obj) ||
- (DSP_FAILED(status) && *target_obj == NULL));
+ (status && *target_obj == NULL));
}

return status;
@@ -559,7 +559,7 @@ int dbll_load(struct dbll_library_obj *lib, dbll_flags flags,
if (opened_doff)
dof_close(zl_lib);

- DBC_ENSURE(DSP_FAILED(status) || zl_lib->load_ref > 0);
+ DBC_ENSURE(status || zl_lib->load_ref > 0);

dev_dbg(bridge, "%s: lib: %p flags: 0x%x entry: %p, status 0x%x\n",
__func__, lib, flags, entry, status);
@@ -631,7 +631,7 @@ int dbll_open(struct dbll_tar_obj *target, char *file, dbll_flags flags,
/*
* Set up objects needed by the dynamic loader
*/
- if (DSP_FAILED(status))
+ if (status)
goto func_cont;

/* Stream */
@@ -713,7 +713,7 @@ func_cont:

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

dev_dbg(bridge, "%s: target: %p file: %s lib_obj: %p, status 0x%x\n",
__func__, target, file, lib_obj, status);
@@ -756,7 +756,7 @@ int dbll_read_sect(struct dbll_library_obj *lib, char *name,
} else {
status = -EFAULT;
}
- if (DSP_FAILED(status))
+ if (status)
goto func_cont;

byte_size = 1;
@@ -1314,7 +1314,7 @@ func_cont:
(u32 *) &rmm_addr_obj,
seg_id, req, false);
}
- if (DSP_FAILED(status)) {
+ if (status) {
ret = false;
} else {
/* RMM gives word address. Need to convert to byte address */
diff --git a/drivers/staging/tidspbridge/pmgr/dev.c b/drivers/staging/tidspbridge/pmgr/dev.c
index 8f1e56a..4ddf03d 100644
--- a/drivers/staging/tidspbridge/pmgr/dev.c
+++ b/drivers/staging/tidspbridge/pmgr/dev.c
@@ -150,7 +150,7 @@ int dev_create_device(struct dev_object **device_obj,

status = drv_request_bridge_res_dsp((void *)&host_res);

- if (DSP_FAILED(status)) {
+ if (status) {
dev_dbg(bridge, "%s: Failed to reserve bridge resources\n",
__func__);
goto leave;
@@ -158,7 +158,7 @@ int dev_create_device(struct dev_object **device_obj,

/* Get the Bridge driver interface functions */
bridge_drv_entry(&drv_fxns, driver_file_name);
- if (DSP_FAILED(cfg_get_object((u32 *) &hdrv_obj, REG_DRV_OBJECT))) {
+ if (cfg_get_object((u32 *) &hdrv_obj, REG_DRV_OBJECT)) {
/* don't propogate CFG errors from this PROC function */
status = -EPERM;
}
@@ -189,7 +189,7 @@ int dev_create_device(struct dev_object **device_obj,
(&dev_obj->hbridge_context, dev_obj,
host_res);
/* Assert bridge_dev_create()'s ensure clause: */
- DBC_ASSERT(DSP_FAILED(status)
+ DBC_ASSERT(status
|| (dev_obj->hbridge_context != NULL));
} else {
status = -ENOMEM;
@@ -276,8 +276,7 @@ leave:
*device_obj = NULL;
}

- DBC_ENSURE((!status && *device_obj) ||
- (DSP_FAILED(status) && !*device_obj));
+ DBC_ENSURE((!status && *device_obj) || (status && !*device_obj));
return status;
}

@@ -299,11 +298,11 @@ int dev_create2(struct dev_object *hdev_obj)
/* There can be only one Node Manager per DEV object */
DBC_ASSERT(!dev_obj->hnode_mgr);
status = node_create_mgr(&dev_obj->hnode_mgr, hdev_obj);
- if (DSP_FAILED(status))
+ if (status)
dev_obj->hnode_mgr = NULL;

DBC_ENSURE((!status && dev_obj->hnode_mgr != NULL)
- || (DSP_FAILED(status) && dev_obj->hnode_mgr == NULL));
+ || (status && dev_obj->hnode_mgr == NULL));
return status;
}

@@ -321,15 +320,14 @@ int dev_destroy2(struct dev_object *hdev_obj)
DBC_REQUIRE(hdev_obj);

if (dev_obj->hnode_mgr) {
- if (DSP_FAILED(node_delete_mgr(dev_obj->hnode_mgr)))
+ if (node_delete_mgr(dev_obj->hnode_mgr))
status = -EPERM;
else
dev_obj->hnode_mgr = NULL;

}

- DBC_ENSURE((!status && dev_obj->hnode_mgr == NULL) ||
- DSP_FAILED(status));
+ DBC_ENSURE((!status && dev_obj->hnode_mgr == NULL) || status);
return status;
}

@@ -847,7 +845,7 @@ int dev_set_chnl_mgr(struct dev_object *hdev_obj,
else
status = -EFAULT;

- DBC_ENSURE(DSP_FAILED(status) || (dev_obj->hchnl_mgr == hmgr));
+ DBC_ENSURE(status || (dev_obj->hchnl_mgr == hmgr));
return status;
}

@@ -885,7 +883,7 @@ int dev_start_device(struct cfg_devnode *dev_node_obj)
if (!status) {
/* Store away the hdev_obj with the DEVNODE */
status = cfg_set_dev_object(dev_node_obj, (u32) hdev_obj);
- if (DSP_FAILED(status)) {
+ if (status) {
/* Clean up */
dev_destroy_device(hdev_obj);
hdev_obj = NULL;
@@ -895,7 +893,7 @@ int dev_start_device(struct cfg_devnode *dev_node_obj)
/* Create the Manager Object */
status = mgr_create(&hmgr_obj, dev_node_obj);
}
- if (DSP_FAILED(status)) {
+ if (status) {
if (hdev_obj)
dev_destroy_device(hdev_obj);

diff --git a/drivers/staging/tidspbridge/pmgr/dmm.c b/drivers/staging/tidspbridge/pmgr/dmm.c
index ef28748..8685233 100644
--- a/drivers/staging/tidspbridge/pmgr/dmm.c
+++ b/drivers/staging/tidspbridge/pmgr/dmm.c
@@ -106,7 +106,7 @@ int dmm_create_tables(struct dmm_object *dmm_mgr, u32 addr, u32 size)
}
}

- if (DSP_FAILED(status))
+ if (status)
pr_err("%s: failure, status 0x%x\n", __func__, status);

return status;
diff --git a/drivers/staging/tidspbridge/pmgr/dspapi.c b/drivers/staging/tidspbridge/pmgr/dspapi.c
index 60d7410..1b0ab4a 100644
--- a/drivers/staging/tidspbridge/pmgr/dspapi.c
+++ b/drivers/staging/tidspbridge/pmgr/dspapi.c
@@ -170,7 +170,7 @@ static u8 size_cmd[] = {
static inline void _cp_fm_usr(void *to, const void __user * from,
int *err, unsigned long bytes)
{
- if (DSP_FAILED(*err))
+ if (*err)
return;

if (unlikely(!from)) {
@@ -188,7 +188,7 @@ static inline void _cp_fm_usr(void *to, const void __user * from,
static inline void _cp_to_usr(void __user *to, const void *from,
int *err, unsigned long bytes)
{
- if (DSP_FAILED(*err))
+ if (*err)
return;

if (unlikely(!to)) {
@@ -391,10 +391,10 @@ int api_init_complete2(void)
* requires KFILE. */
for (hdev_obj = dev_get_first(); hdev_obj != NULL;
hdev_obj = dev_get_next(hdev_obj)) {
- if (DSP_FAILED(dev_get_dev_node(hdev_obj, &dev_node)))
+ if (dev_get_dev_node(hdev_obj, &dev_node))
continue;

- if (DSP_FAILED(dev_get_dev_type(hdev_obj, &dev_type)))
+ if (dev_get_dev_type(hdev_obj, &dev_type))
continue;

if ((dev_type == DSP_UNIT) || (dev_type == IVA_UNIT))
@@ -486,7 +486,7 @@ u32 mgrwrap_register_object(union trapped_args *args, void *pr_ctxt)
int status = 0;

CP_FM_USR(&uuid_obj, args->args_mgr_registerobject.uuid_obj, status, 1);
- if (DSP_FAILED(status))
+ if (status)
goto func_end;
/* path_size is increased by 1 to accommodate NULL */
path_size = strlen_user((char *)
@@ -523,7 +523,7 @@ u32 mgrwrap_unregister_object(union trapped_args *args, void *pr_ctxt)
struct dsp_uuid uuid_obj;

CP_FM_USR(&uuid_obj, args->args_mgr_registerobject.uuid_obj, status, 1);
- if (DSP_FAILED(status))
+ if (status)
goto func_end;

status = dcd_unregister_object(&uuid_obj,
@@ -834,7 +834,7 @@ u32 procwrap_load(union trapped_args *args, void *pr_ctxt)
}

CP_FM_USR(argv, args->args_proc_load.user_args, status, count);
- if (DSP_FAILED(status)) {
+ if (status) {
kfree(argv);
argv = NULL;
goto func_cont;
@@ -850,7 +850,7 @@ u32 procwrap_load(union trapped_args *args, void *pr_ctxt)
argv[i] = kmalloc(len, GFP_KERNEL);
if (argv[i]) {
CP_FM_USR(argv[i], temp, status, len);
- if (DSP_FAILED(status)) {
+ if (status) {
kfree(argv[i]);
argv[i] = NULL;
goto func_cont;
@@ -876,7 +876,7 @@ u32 procwrap_load(union trapped_args *args, void *pr_ctxt)
}

CP_FM_USR(envp, args->args_proc_load.user_envp, status, count);
- if (DSP_FAILED(status)) {
+ if (status) {
kfree(envp);
envp = NULL;
goto func_cont;
@@ -890,7 +890,7 @@ u32 procwrap_load(union trapped_args *args, void *pr_ctxt)
envp[i] = kmalloc(len, GFP_KERNEL);
if (envp[i]) {
CP_FM_USR(envp[i], temp, status, len);
- if (DSP_FAILED(status)) {
+ if (status) {
kfree(envp[i]);
envp[i] = NULL;
goto func_cont;
@@ -1078,7 +1078,7 @@ u32 nodewrap_allocate(union trapped_args *args, void *pr_ctxt)
cb_data_size);
}
CP_FM_USR(&node_uuid, args->args_node_allocate.node_id_ptr, status, 1);
- if (DSP_FAILED(status))
+ if (status)
goto func_cont;
/* Optional argument */
if (args->args_node_allocate.attr_in) {
@@ -1097,7 +1097,7 @@ u32 nodewrap_allocate(union trapped_args *args, void *pr_ctxt)
}
if (!status) {
CP_TO_USR(args->args_node_allocate.ph_node, &hnode, status, 1);
- if (DSP_FAILED(status)) {
+ if (status) {
status = -EFAULT;
node_delete(hnode, pr_ctxt);
}
@@ -1179,7 +1179,7 @@ u32 nodewrap_connect(union trapped_args *args, void *pr_ctxt)
}
CP_FM_USR(pargs, args->args_node_connect.conn_param, status,
cb_data_size);
- if (DSP_FAILED(status))
+ if (status)
goto func_cont;
}
if (args->args_node_connect.pattrs) { /* Optional argument */
@@ -1378,7 +1378,7 @@ u32 nodewrap_get_uuid_props(union trapped_args *args, void *pr_ctxt)

CP_FM_USR(&node_uuid, args->args_node_getuuidprops.node_id_ptr, status,
1);
- if (DSP_FAILED(status))
+ if (status)
goto func_cont;
pnode_props = kmalloc(sizeof(struct dsp_ndbprops), GFP_KERNEL);
if (pnode_props != NULL) {
@@ -1416,7 +1416,7 @@ u32 strmwrap_allocate_buffer(union trapped_args *args, void *pr_ctxt)
if (!status) {
CP_TO_USR(args->args_strm_allocatebuffer.ap_buffer, ap_buffer,
status, num_bufs);
- if (DSP_FAILED(status)) {
+ if (status) {
status = -EFAULT;
strm_free_buffer(args->args_strm_allocatebuffer.hstream,
ap_buffer, num_bufs, pr_ctxt);
--
1.5.4.5

2010-07-28 14:41:47

by Ernesto Ramos

[permalink] [raw]
Subject: [PATCH 05/10] staging:ti dspbridge: remove DSP_SUCCEEDED macro definition

Since status succeeded is now 0 macro DSP_SUCCEEDED
is not necessary anymore. This patch removes this
define.

Signed-off-by: Ernesto Ramos <[email protected]>
---
.../staging/tidspbridge/include/dspbridge/dbdefs.h | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/tidspbridge/include/dspbridge/dbdefs.h b/drivers/staging/tidspbridge/include/dspbridge/dbdefs.h
index 397e2cb..2ccbfe1 100644
--- a/drivers/staging/tidspbridge/include/dspbridge/dbdefs.h
+++ b/drivers/staging/tidspbridge/include/dspbridge/dbdefs.h
@@ -91,8 +91,7 @@
#define DSPWORD unsigned char
#define DSPWORDSIZE sizeof(DSPWORD)

-/* Success & Failure macros */
-#define DSP_SUCCEEDED(status) likely((s32)(status) >= 0)
+/* Failure macro */
#define DSP_FAILED(status) unlikely((s32)(status) < 0)

/* Power control enumerations */
--
1.5.4.5

2010-07-28 14:41:50

by Ernesto Ramos

[permalink] [raw]
Subject: [PATCH 02/10] staging:ti dspbridge: remove DSP_SUCCEEDED macro from pmgr

Since status succeeded is now 0 macro DSP_SUCCEEDED
is not necessary anymore.

Signed-off-by: Ernesto Ramos <[email protected]>
---
drivers/staging/tidspbridge/pmgr/chnl.c | 8 +-
drivers/staging/tidspbridge/pmgr/cmm.c | 135 +++++++++++++----------------
drivers/staging/tidspbridge/pmgr/cod.c | 10 +-
drivers/staging/tidspbridge/pmgr/dbll.c | 20 ++--
drivers/staging/tidspbridge/pmgr/dev.c | 59 ++++++-------
drivers/staging/tidspbridge/pmgr/dmm.c | 10 +-
drivers/staging/tidspbridge/pmgr/dspapi.c | 52 ++++++------
drivers/staging/tidspbridge/pmgr/io.c | 4 +-
drivers/staging/tidspbridge/pmgr/msg.c | 2 +-
9 files changed, 139 insertions(+), 161 deletions(-)

diff --git a/drivers/staging/tidspbridge/pmgr/chnl.c b/drivers/staging/tidspbridge/pmgr/chnl.c
index d73c89c..626a993 100644
--- a/drivers/staging/tidspbridge/pmgr/chnl.c
+++ b/drivers/staging/tidspbridge/pmgr/chnl.c
@@ -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;
diff --git a/drivers/staging/tidspbridge/pmgr/cmm.c b/drivers/staging/tidspbridge/pmgr/cmm.c
index b7cba1b..2f974c5 100644
--- a/drivers/staging/tidspbridge/pmgr/cmm.c
+++ b/drivers/staging/tidspbridge/pmgr/cmm.c
@@ -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;
}
@@ -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) {
@@ -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);
@@ -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;
@@ -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 */
@@ -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;
}
@@ -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;
diff --git a/drivers/staging/tidspbridge/pmgr/cod.c b/drivers/staging/tidspbridge/pmgr/cod.c
index 81102d2..9f902de 100644
--- a/drivers/staging/tidspbridge/pmgr/cod.c
+++ b/drivers/staging/tidspbridge/pmgr/cod.c
@@ -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;
}
@@ -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;
@@ -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;
}

@@ -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);
diff --git a/drivers/staging/tidspbridge/pmgr/dbll.c b/drivers/staging/tidspbridge/pmgr/dbll.c
index d1806aa..ea27824 100644
--- a/drivers/staging/tidspbridge/pmgr/dbll.c
+++ b/drivers/staging/tidspbridge/pmgr/dbll.c
@@ -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));
}

@@ -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 {
@@ -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;
@@ -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 */
@@ -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 */
@@ -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);
@@ -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)
@@ -712,7 +712,7 @@ func_cont:
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",
@@ -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 {
diff --git a/drivers/staging/tidspbridge/pmgr/dev.c b/drivers/staging/tidspbridge/pmgr/dev.c
index 2039e6f..8f1e56a 100644
--- a/drivers/staging/tidspbridge/pmgr/dev.c
+++ b/drivers/staging/tidspbridge/pmgr/dev.c
@@ -118,7 +118,7 @@ u32 dev_brd_write_fxn(void *arb, u32 dsp_add, void *host_buf,
/* Special case of getting the address only */
if (ul_num_bytes == 0)
ul_num_bytes = 1;
- if (DSP_SUCCEEDED(status))
+ if (!status)
ul_written = ul_num_bytes;

}
@@ -164,7 +164,7 @@ int dev_create_device(struct dev_object **device_obj,
}
/* Create the device object, and pass a handle to the Bridge driver for
* storage. */
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
DBC_ASSERT(drv_fxns);
dev_obj = kzalloc(sizeof(struct dev_object), GFP_KERNEL);
if (dev_obj) {
@@ -196,11 +196,11 @@ int dev_create_device(struct dev_object **device_obj,
}
}
/* Attempt to create the COD manager for this device: */
- if (DSP_SUCCEEDED(status))
+ if (!status)
status = init_cod_mgr(dev_obj);

/* Attempt to create the channel manager for this device: */
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
mgr_attrs.max_channels = CHNL_MAXCHANNELS;
io_mgr_attrs.birq = host_res->birq_registers;
io_mgr_attrs.irq_shared =
@@ -231,12 +231,12 @@ int dev_create_device(struct dev_object **device_obj,
status = cmm_create(&dev_obj->hcmm_mgr,
(struct dev_object *)dev_obj, NULL);
/* Only create IO manager if we have a channel manager */
- if (DSP_SUCCEEDED(status) && dev_obj->hchnl_mgr) {
+ if (!status && dev_obj->hchnl_mgr) {
status = io_create(&dev_obj->hio_mgr, dev_obj,
&io_mgr_attrs);
}
/* Only create DEH manager if we have an IO manager */
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Instantiate the DEH module */
status = bridge_deh_create(&dev_obj->hdeh_mgr, dev_obj);
}
@@ -245,12 +245,12 @@ int dev_create_device(struct dev_object **device_obj,
(struct dev_object *)dev_obj, NULL);
}
/* Add the new DEV_Object to the global list: */
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
lst_init_elem(&dev_obj->link);
status = drv_insert_dev_object(hdrv_obj, dev_obj);
}
/* Create the Processor List */
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
dev_obj->proc_list = kzalloc(sizeof(struct lst_list),
GFP_KERNEL);
if (!(dev_obj->proc_list))
@@ -260,8 +260,8 @@ int dev_create_device(struct dev_object **device_obj,
}
leave:
/* If all went well, return a handle to the dev object;
- * else, cleanup and return NULL in the parameter. */
- if (DSP_SUCCEEDED(status)) {
+ * else, cleanup and return NULL in the OUT parameter. */
+ if (!status) {
*device_obj = dev_obj;
} else {
if (dev_obj) {
@@ -276,7 +276,7 @@ leave:
*device_obj = NULL;
}

- DBC_ENSURE((DSP_SUCCEEDED(status) && *device_obj) ||
+ DBC_ENSURE((!status && *device_obj) ||
(DSP_FAILED(status) && !*device_obj));
return status;
}
@@ -302,7 +302,7 @@ int dev_create2(struct dev_object *hdev_obj)
if (DSP_FAILED(status))
dev_obj->hnode_mgr = NULL;

- DBC_ENSURE((DSP_SUCCEEDED(status) && dev_obj->hnode_mgr != NULL)
+ DBC_ENSURE((!status && dev_obj->hnode_mgr != NULL)
|| (DSP_FAILED(status) && dev_obj->hnode_mgr == NULL));
return status;
}
@@ -328,7 +328,7 @@ int dev_destroy2(struct dev_object *hdev_obj)

}

- DBC_ENSURE((DSP_SUCCEEDED(status) && dev_obj->hnode_mgr == NULL) ||
+ DBC_ENSURE((!status && dev_obj->hnode_mgr == NULL) ||
DSP_FAILED(status));
return status;
}
@@ -394,7 +394,7 @@ int dev_destroy_device(struct dev_object *hdev_obj)
dev_obj->hbridge_context = NULL;
} else
status = -EPERM;
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
kfree(dev_obj->proc_list);
dev_obj->proc_list = NULL;

@@ -435,8 +435,7 @@ int dev_get_chnl_mgr(struct dev_object *hdev_obj,
status = -EFAULT;
}

- DBC_ENSURE(DSP_SUCCEEDED(status) || ((mgr != NULL) &&
- (*mgr == NULL)));
+ DBC_ENSURE(!status || (mgr != NULL && *mgr == NULL));
return status;
}

@@ -462,8 +461,7 @@ int dev_get_cmm_mgr(struct dev_object *hdev_obj,
status = -EFAULT;
}

- DBC_ENSURE(DSP_SUCCEEDED(status) || ((mgr != NULL) &&
- (*mgr == NULL)));
+ DBC_ENSURE(!status || (mgr != NULL && *mgr == NULL));
return status;
}

@@ -489,8 +487,7 @@ int dev_get_dmm_mgr(struct dev_object *hdev_obj,
status = -EFAULT;
}

- DBC_ENSURE(DSP_SUCCEEDED(status) || ((mgr != NULL) &&
- (*mgr == NULL)));
+ DBC_ENSURE(!status || (mgr != NULL && *mgr == NULL));
return status;
}

@@ -515,8 +512,7 @@ int dev_get_cod_mgr(struct dev_object *hdev_obj,
status = -EFAULT;
}

- DBC_ENSURE(DSP_SUCCEEDED(status) || ((cod_mgr != NULL) &&
- (*cod_mgr == NULL)));
+ DBC_ENSURE(!status || (cod_mgr != NULL && *cod_mgr == NULL));
return status;
}

@@ -561,8 +557,7 @@ int dev_get_dev_node(struct dev_object *hdev_obj,
status = -EFAULT;
}

- DBC_ENSURE(DSP_SUCCEEDED(status) || ((dev_nde != NULL) &&
- (*dev_nde == NULL)));
+ DBC_ENSURE(!status || (dev_nde != NULL && *dev_nde == NULL));
return status;
}

@@ -603,8 +598,7 @@ int dev_get_intf_fxns(struct dev_object *hdev_obj,
status = -EFAULT;
}

- DBC_ENSURE(DSP_SUCCEEDED(status) || ((if_fxns != NULL) &&
- (*if_fxns == NULL)));
+ DBC_ENSURE(!status || ((if_fxns != NULL) && (*if_fxns == NULL)));
return status;
}

@@ -682,8 +676,7 @@ int dev_get_node_manager(struct dev_object *hdev_obj,
status = -EFAULT;
}

- DBC_ENSURE(DSP_SUCCEEDED(status) || ((node_man != NULL) &&
- (*node_man == NULL)));
+ DBC_ENSURE(!status || (node_man != NULL && *node_man == NULL));
return status;
}

@@ -733,7 +726,7 @@ int dev_get_bridge_context(struct dev_object *hdev_obj,
status = -EFAULT;
}

- DBC_ENSURE(DSP_SUCCEEDED(status) || ((phbridge_context != NULL) &&
+ DBC_ENSURE(!status || ((phbridge_context != NULL) &&
(*phbridge_context == NULL)));
return status;
}
@@ -826,7 +819,7 @@ int dev_remove_device(struct cfg_devnode *dev_node_obj)
/* Retrieve the device object handle originaly stored with
* the dev_node: */
status = cfg_get_dev_object(dev_node_obj, (u32 *) &hdev_obj);
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Remove the Processor List */
dev_obj = (struct dev_object *)hdev_obj;
/* Destroy the device object. */
@@ -889,7 +882,7 @@ int dev_start_device(struct cfg_devnode *dev_node_obj)
/* Given all resources, create a device object. */
status = dev_create_device(&hdev_obj, bridge_file_name,
dev_node_obj);
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Store away the hdev_obj with the DEVNODE */
status = cfg_set_dev_object(dev_node_obj, (u32) hdev_obj);
if (DSP_FAILED(status)) {
@@ -898,7 +891,7 @@ int dev_start_device(struct cfg_devnode *dev_node_obj)
hdev_obj = NULL;
}
}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Create the Manager Object */
status = mgr_create(&hmgr_obj, dev_node_obj);
}
@@ -990,7 +983,7 @@ int dev_insert_proc_object(struct dev_object *hdev_obj,
/* Add DevObject to tail. */
lst_put_tail(dev_obj->proc_list, (struct list_head *)proc_obj);

- DBC_ENSURE(DSP_SUCCEEDED(status) && !LST_IS_EMPTY(dev_obj->proc_list));
+ DBC_ENSURE(!status && !LST_IS_EMPTY(dev_obj->proc_list));

return status;
}
diff --git a/drivers/staging/tidspbridge/pmgr/dmm.c b/drivers/staging/tidspbridge/pmgr/dmm.c
index e53700f..ef28748 100644
--- a/drivers/staging/tidspbridge/pmgr/dmm.c
+++ b/drivers/staging/tidspbridge/pmgr/dmm.c
@@ -88,7 +88,7 @@ int dmm_create_tables(struct dmm_object *dmm_mgr, u32 addr, u32 size)
int status = 0;

status = dmm_delete_tables(dmm_obj);
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
dyn_mem_map_beg = addr;
table_size = PG_ALIGN_HIGH(size, PG_SIZE4K) / PG_SIZE4K;
/* Create the free list */
@@ -152,7 +152,7 @@ int dmm_destroy(struct dmm_object *dmm_mgr)
DBC_REQUIRE(refs > 0);
if (dmm_mgr) {
status = dmm_delete_tables(dmm_obj);
- if (DSP_SUCCEEDED(status))
+ if (!status)
kfree(dmm_obj);
} else
status = -EFAULT;
@@ -209,7 +209,7 @@ int dmm_get_handle(void *hprocessor, struct dmm_object **dmm_manager)
else
hdev_obj = dev_get_first(); /* default */

- if (DSP_SUCCEEDED(status))
+ if (!status)
status = dev_get_dmm_mgr(hdev_obj, dmm_manager);

return status;
@@ -337,7 +337,7 @@ int dmm_un_map_memory(struct dmm_object *dmm_mgr, u32 addr, u32 *psize)
if (chunk == NULL)
status = -ENOENT;

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Unmap the region */
*psize = chunk->mapped_size * PG_SIZE4K;
chunk->mapped = false;
@@ -371,7 +371,7 @@ int dmm_un_reserve_memory(struct dmm_object *dmm_mgr, u32 rsv_addr)
if (chunk == NULL)
status = -ENOENT;

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Free all the mapped pages for this reserved region */
i = 0;
while (i < chunk->region_size) {
diff --git a/drivers/staging/tidspbridge/pmgr/dspapi.c b/drivers/staging/tidspbridge/pmgr/dspapi.c
index 78192a3..60d7410 100644
--- a/drivers/staging/tidspbridge/pmgr/dspapi.c
+++ b/drivers/staging/tidspbridge/pmgr/dspapi.c
@@ -425,7 +425,7 @@ u32 mgrwrap_enum_node_info(union trapped_args *args, void *pr_ctxt)
if (pndb_props == NULL)
status = -ENOMEM;

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
status =
mgr_enum_node_info(args->args_mgr_enumnode_info.node_id,
(struct dsp_ndbprops *)pndb_props, size,
@@ -457,7 +457,7 @@ u32 mgrwrap_enum_proc_info(union trapped_args *args, void *pr_ctxt)
if (processor_info == NULL)
status = -ENOMEM;

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
status =
mgr_enum_processor_info(args->args_mgr_enumproc_info.
processor_id,
@@ -554,12 +554,12 @@ u32 mgrwrap_wait_for_bridge_events(union trapped_args *args, void *pr_ctxt)
/* get the events */
for (i = 0; i < count; i++) {
CP_FM_USR(&notifications[i], anotifications[i], status, 1);
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* set the array of pointers to kernel structures */
anotifications[i] = &notifications[i];
}
}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
real_status = mgr_wait_for_bridge_events(anotifications, count,
&index,
args->args_mgr_wait.
@@ -592,7 +592,7 @@ u32 procwrap_attach(union trapped_args *args, void *pr_ctxt)
if (args->args_proc_attach.attr_in) {
CP_FM_USR(&proc_attr_in, args->args_proc_attach.attr_in, status,
1);
- if (DSP_SUCCEEDED(status))
+ if (!status)
attr_in = &proc_attr_in;
else
goto func_end;
@@ -630,7 +630,7 @@ u32 procwrap_ctrl(union trapped_args *args, void *pr_ctxt)
CP_FM_USR(pargs, args->args_proc_ctrl.pargs, status,
cb_data_size);
}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
status = proc_ctrl(args->args_proc_ctrl.hprocessor,
args->args_proc_ctrl.dw_cmd,
(struct dsp_cbdata *)pargs);
@@ -902,7 +902,7 @@ u32 procwrap_load(union trapped_args *args, void *pr_ctxt)
}
}

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
status = proc_load(args->args_proc_load.hprocessor,
args->args_proc_load.argc_index,
(const char **)argv, (const char **)envp);
@@ -943,7 +943,7 @@ u32 procwrap_map(union trapped_args *args, void *pr_ctxt)
args->args_proc_mapmem.ul_size,
args->args_proc_mapmem.req_addr, &map_addr,
args->args_proc_mapmem.ul_map_attr, pr_ctxt);
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
if (put_user(map_addr, args->args_proc_mapmem.pp_map_addr)) {
status = -EINVAL;
proc_un_map(args->args_proc_mapmem.hprocessor,
@@ -991,7 +991,7 @@ u32 procwrap_reserve_memory(union trapped_args *args, void *pr_ctxt)
status = proc_reserve_memory(args->args_proc_rsvmem.hprocessor,
args->args_proc_rsvmem.ul_size, &prsv_addr,
pr_ctxt);
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
if (put_user(prsv_addr, args->args_proc_rsvmem.pp_rsv_addr)) {
status = -EINVAL;
proc_un_reserve_memory(args->args_proc_rsvmem.
@@ -1068,7 +1068,7 @@ u32 nodewrap_allocate(union trapped_args *args, void *pr_ctxt)
status = -EPERM;

cb_data_size += sizeof(u32);
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
pargs = kmalloc(cb_data_size, GFP_KERNEL);
if (pargs == NULL)
status = -ENOMEM;
@@ -1084,18 +1084,18 @@ u32 nodewrap_allocate(union trapped_args *args, void *pr_ctxt)
if (args->args_node_allocate.attr_in) {
CP_FM_USR(&proc_attr_in, args->args_node_allocate.attr_in,
status, 1);
- if (DSP_SUCCEEDED(status))
+ if (!status)
attr_in = &proc_attr_in;
else
status = -ENOMEM;

}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
status = node_allocate(args->args_node_allocate.hprocessor,
&node_uuid, (struct dsp_cbdata *)pargs,
attr_in, &hnode, pr_ctxt);
}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
CP_TO_USR(args->args_node_allocate.ph_node, &hnode, status, 1);
if (DSP_FAILED(status)) {
status = -EFAULT;
@@ -1123,13 +1123,13 @@ u32 nodewrap_alloc_msg_buf(union trapped_args *args, void *pr_ctxt)

if (args->args_node_allocmsgbuf.pattr) { /* Optional argument */
CP_FM_USR(&attr, args->args_node_allocmsgbuf.pattr, status, 1);
- if (DSP_SUCCEEDED(status))
+ if (!status)
pattr = &attr;

}
/* argument */
CP_FM_USR(&pbuffer, args->args_node_allocmsgbuf.pbuffer, status, 1);
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
status = node_alloc_msg_buf(args->args_node_allocmsgbuf.hnode,
args->args_node_allocmsgbuf.usize,
pattr, &pbuffer);
@@ -1169,7 +1169,7 @@ u32 nodewrap_connect(union trapped_args *args, void *pr_ctxt)
status = -EPERM;

cb_data_size += sizeof(u32);
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
pargs = kmalloc(cb_data_size, GFP_KERNEL);
if (pargs == NULL) {
status = -ENOMEM;
@@ -1184,11 +1184,11 @@ u32 nodewrap_connect(union trapped_args *args, void *pr_ctxt)
}
if (args->args_node_connect.pattrs) { /* Optional argument */
CP_FM_USR(&attrs, args->args_node_connect.pattrs, status, 1);
- if (DSP_SUCCEEDED(status))
+ if (!status)
pattrs = &attrs;

}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
status = node_connect(args->args_node_connect.hnode,
args->args_node_connect.stream_id,
args->args_node_connect.other_node,
@@ -1235,7 +1235,7 @@ u32 nodewrap_free_msg_buf(union trapped_args *args, void *pr_ctxt)
struct dsp_bufferattr attr;
if (args->args_node_freemsgbuf.pattr) { /* Optional argument */
CP_FM_USR(&attr, args->args_node_freemsgbuf.pattr, status, 1);
- if (DSP_SUCCEEDED(status))
+ if (!status)
pattr = &attr;

}
@@ -1243,7 +1243,7 @@ u32 nodewrap_free_msg_buf(union trapped_args *args, void *pr_ctxt)
if (!args->args_node_freemsgbuf.pbuffer)
return -EFAULT;

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
status = node_free_msg_buf(args->args_node_freemsgbuf.hnode,
args->args_node_freemsgbuf.pbuffer,
pattr);
@@ -1305,7 +1305,7 @@ u32 nodewrap_put_message(union trapped_args *args, void *pr_ctxt)

CP_FM_USR(&msg, args->args_node_putmessage.message, status, 1);

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
status =
node_put_message(args->args_node_putmessage.hnode, &msg,
args->args_node_putmessage.utimeout);
@@ -1413,7 +1413,7 @@ u32 strmwrap_allocate_buffer(union trapped_args *args, void *pr_ctxt)
status = strm_allocate_buffer(args->args_strm_allocatebuffer.hstream,
args->args_strm_allocatebuffer.usize,
ap_buffer, num_bufs, pr_ctxt);
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
CP_TO_USR(args->args_strm_allocatebuffer.ap_buffer, ap_buffer,
status, num_bufs);
if (DSP_FAILED(status)) {
@@ -1454,7 +1454,7 @@ u32 strmwrap_free_buffer(union trapped_args *args, void *pr_ctxt)
CP_FM_USR(ap_buffer, args->args_strm_freebuffer.ap_buffer, status,
num_bufs);

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
status = strm_free_buffer(args->args_strm_freebuffer.hstream,
ap_buffer, num_bufs, pr_ctxt);
}
@@ -1490,7 +1490,7 @@ u32 strmwrap_get_info(union trapped_args *args, void *pr_ctxt)

strm_info.user_strm = &user;

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
status = strm_get_info(args->args_strm_getinfo.hstream,
&strm_info,
args->args_strm_getinfo.
@@ -1551,7 +1551,7 @@ u32 strmwrap_open(union trapped_args *args, void *pr_ctxt)

if (attr.stream_attr_in != NULL) { /* Optional argument */
CP_FM_USR(&strm_attr_in, attr.stream_attr_in, status, 1);
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
attr.stream_attr_in = &strm_attr_in;
if (attr.stream_attr_in->strm_mode == STRMMODE_LDMA)
return -ENOSYS;
@@ -1627,7 +1627,7 @@ u32 strmwrap_select(union trapped_args *args, void *pr_ctxt)

CP_FM_USR(strm_tab, args->args_strm_select.stream_tab, status,
args->args_strm_select.strm_num);
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
status = strm_select(strm_tab, args->args_strm_select.strm_num,
&mask, args->args_strm_select.utimeout);
}
diff --git a/drivers/staging/tidspbridge/pmgr/io.c b/drivers/staging/tidspbridge/pmgr/io.c
index 2c26f06..7970fe5 100644
--- a/drivers/staging/tidspbridge/pmgr/io.c
+++ b/drivers/staging/tidspbridge/pmgr/io.c
@@ -67,14 +67,14 @@ int io_create(struct io_mgr **io_man, struct dev_object *hdev_obj,
if (mgr_attrts->word_size == 0)
status = -EINVAL;

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
dev_get_intf_fxns(hdev_obj, &intf_fxns);

/* Let Bridge channel module finish the create: */
status = (*intf_fxns->pfn_io_create) (&hio_mgr, hdev_obj,
mgr_attrts);

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
pio_mgr = (struct io_mgr_ *)hio_mgr;
pio_mgr->intf_fxns = intf_fxns;
pio_mgr->hdev_obj = hdev_obj;
diff --git a/drivers/staging/tidspbridge/pmgr/msg.c b/drivers/staging/tidspbridge/pmgr/msg.c
index 884f8b5..abd4365 100644
--- a/drivers/staging/tidspbridge/pmgr/msg.c
+++ b/drivers/staging/tidspbridge/pmgr/msg.c
@@ -66,7 +66,7 @@ int msg_create(struct msg_mgr **msg_man,
status =
(*intf_fxns->pfn_msg_create) (&hmsg_mgr, hdev_obj, msg_callback);

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Fill in DSP API message module's fields of the msg_mgr
* structure */
msg_mgr_obj = (struct msg_mgr_ *)hmsg_mgr;
--
1.5.4.5

2010-07-28 14:41:39

by Ernesto Ramos

[permalink] [raw]
Subject: [PATCH 01/10] staging:ti dspbridge: remove DSP_SUCCEEDED macro from core

Since status succeeded is now 0 macro DSP_SUCCEEDED
is not necessary anymore.

Signed-off-by: Ernesto Ramos <[email protected]>
---
drivers/staging/tidspbridge/core/chnl_sm.c | 22 ++++----
drivers/staging/tidspbridge/core/dsp-clock.c | 4 +-
drivers/staging/tidspbridge/core/io_sm.c | 47 ++++++++---------
drivers/staging/tidspbridge/core/msg_sm.c | 22 ++++----
drivers/staging/tidspbridge/core/tiomap3430.c | 57 +++++++++------------
drivers/staging/tidspbridge/core/tiomap3430_pwr.c | 6 +-
drivers/staging/tidspbridge/core/tiomap_io.c | 41 +++++++--------
7 files changed, 91 insertions(+), 108 deletions(-)

diff --git a/drivers/staging/tidspbridge/core/chnl_sm.c b/drivers/staging/tidspbridge/core/chnl_sm.c
index 69c4784..1b23141 100644
--- a/drivers/staging/tidspbridge/core/chnl_sm.c
+++ b/drivers/staging/tidspbridge/core/chnl_sm.c
@@ -170,7 +170,7 @@ func_cont:
omap_mbox_disable_irq(dev_ctxt->mbox, IRQ_RX);
if (pchnl->chnl_type == CHNL_PCPY) {
/* This is a processor-copy channel. */
- if (DSP_SUCCEEDED(status) && CHNL_IS_OUTPUT(pchnl->chnl_mode)) {
+ if (!status && CHNL_IS_OUTPUT(pchnl->chnl_mode)) {
/* Check buffer size on output channels for fit. */
if (byte_size >
io_buf_size(pchnl->chnl_mgr_obj->hio_mgr))
@@ -178,7 +178,7 @@ func_cont:

}
}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Get a free chirp: */
chnl_packet_obj =
(struct chnl_irp *)lst_get_head(pchnl->free_packets_list);
@@ -186,7 +186,7 @@ func_cont:
status = -EIO;

}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Enqueue the chirp on the chnl's IORequest queue: */
chnl_packet_obj->host_user_buf = chnl_packet_obj->host_sys_buf =
host_buf;
@@ -330,7 +330,7 @@ int bridge_chnl_close(struct chnl_object *chnl_obj)
status = bridge_chnl_cancel_io(chnl_obj);
}
func_cont:
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Assert I/O on this channel is now cancelled: Protects
* from io_dpc. */
DBC_ASSERT((pchnl->dw_state & CHNL_STATECANCEL));
@@ -420,8 +420,7 @@ int bridge_chnl_create(struct chnl_mgr **channel_mgr,
chnl_mgr_obj->dw_output_mask = 0;
chnl_mgr_obj->dw_last_output = 0;
chnl_mgr_obj->hdev_obj = hdev_obj;
- if (DSP_SUCCEEDED(status))
- spin_lock_init(&chnl_mgr_obj->chnl_mgr_lock);
+ spin_lock_init(&chnl_mgr_obj->chnl_mgr_lock);
} else {
status = -ENOMEM;
}
@@ -499,7 +498,7 @@ int bridge_chnl_flush_io(struct chnl_object *chnl_obj, u32 timeout)
} else {
status = -EFAULT;
}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Note: Currently, if another thread continues to add IO
* requests to this channel, this function will continue to
* flush all such queued IO requests. */
@@ -507,8 +506,7 @@ int bridge_chnl_flush_io(struct chnl_object *chnl_obj, u32 timeout)
&& (pchnl->chnl_type == CHNL_PCPY)) {
/* Wait for IO completions, up to the specified
* timeout: */
- while (!LST_IS_EMPTY(pchnl->pio_requests) &&
- DSP_SUCCEEDED(status)) {
+ while (!LST_IS_EMPTY(pchnl->pio_requests) && !status) {
status = bridge_chnl_get_ioc(chnl_obj,
timeout, &chnl_ioc_obj);
if (DSP_FAILED(status))
@@ -833,7 +831,7 @@ int bridge_chnl_open(struct chnl_object **chnl,
else
status = -ENOMEM;

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
pchnl->ntfy_obj = kmalloc(sizeof(struct ntfy_object),
GFP_KERNEL);
if (pchnl->ntfy_obj)
@@ -842,7 +840,7 @@ int bridge_chnl_open(struct chnl_object **chnl,
status = -ENOMEM;
}

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
if (pchnl->pio_completions && pchnl->pio_requests &&
pchnl->free_packets_list) {
/* Initialize CHNL object fields: */
@@ -897,7 +895,7 @@ int bridge_chnl_open(struct chnl_object **chnl,
*chnl = pchnl;
}
func_end:
- DBC_ENSURE((DSP_SUCCEEDED(status) && pchnl) || (*chnl == NULL));
+ DBC_ENSURE((!status && pchnl) || (*chnl == NULL));
return status;
}

diff --git a/drivers/staging/tidspbridge/core/dsp-clock.c b/drivers/staging/tidspbridge/core/dsp-clock.c
index b474e83..5b1a0c5 100644
--- a/drivers/staging/tidspbridge/core/dsp-clock.c
+++ b/drivers/staging/tidspbridge/core/dsp-clock.c
@@ -285,7 +285,7 @@ int dsp_clk_enable(enum dsp_clk_id clk_id)
status = -EPERM;
}

- if (DSP_SUCCEEDED(status))
+ if (!status)
set_dsp_clk_active(&dsp_clocks, clk_id);

out:
@@ -354,7 +354,7 @@ int dsp_clk_disable(enum dsp_clk_id clk_id)
status = -EPERM;
}

- if (DSP_SUCCEEDED(status))
+ if (!status)
set_dsp_clk_inactive(&dsp_clocks, clk_id);

out:
diff --git a/drivers/staging/tidspbridge/core/io_sm.c b/drivers/staging/tidspbridge/core/io_sm.c
index e5e3684..1d433a9 100644
--- a/drivers/staging/tidspbridge/core/io_sm.c
+++ b/drivers/staging/tidspbridge/core/io_sm.c
@@ -230,11 +230,10 @@ int bridge_io_create(struct io_mgr **io_man,

spin_lock_init(&pio_mgr->dpc_lock);

- if (DSP_SUCCEEDED(status))
- status = dev_get_dev_node(hdev_obj, &dev_node_obj);
+ status = dev_get_dev_node(hdev_obj, &dev_node_obj);
}

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
pio_mgr->hbridge_context = hbridge_context;
pio_mgr->shared_irq = mgr_attrts->irq_shared;
if (dsp_wdt_init())
@@ -378,15 +377,13 @@ int bridge_io_on_loaded(struct io_mgr *hio_mgr)
dev_dbg(bridge, "%s: (proc)proccopy shmmem size: 0x%x bytes\n",
__func__, (ul_shm_length - sizeof(struct shm)));

- if (DSP_SUCCEEDED(status)) {
- /* Get start and length of message part of shared memory */
- status = cod_get_sym_value(cod_man, MSG_SHARED_BUFFER_BASE_SYM,
+ /* Get start and length of message part of shared memory */
+ status = cod_get_sym_value(cod_man, MSG_SHARED_BUFFER_BASE_SYM,
&ul_msg_base);
- }
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
status = cod_get_sym_value(cod_man, MSG_SHARED_BUFFER_LIMIT_SYM,
&ul_msg_limit);
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
if (ul_msg_limit <= ul_msg_base) {
status = -EINVAL;
} else {
@@ -409,7 +406,7 @@ int bridge_io_on_loaded(struct io_mgr *hio_mgr)
} else {
status = -EFAULT;
}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
#if defined(CONFIG_TIDSPBRIDGE_BACKTRACE) || defined(CONFIG_TIDSPBRIDGE_DEBUG)
status =
cod_get_sym_value(cod_man, DSP_TRACESEC_END, &shm0_end);
@@ -420,18 +417,18 @@ int bridge_io_on_loaded(struct io_mgr *hio_mgr)
if (DSP_FAILED(status))
status = -EFAULT;
}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
status =
cod_get_sym_value(cod_man, DYNEXTBASE, &ul_dyn_ext_base);
if (DSP_FAILED(status))
status = -EFAULT;
}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
status = cod_get_sym_value(cod_man, EXTEND, &ul_ext_end);
if (DSP_FAILED(status))
status = -EFAULT;
}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Get memory reserved in host resources */
(void)mgr_enum_processor_info(0, (struct dsp_processorinfo *)
&hio_mgr->ext_proc_info,
@@ -1551,7 +1548,7 @@ static int register_shm_segs(struct io_mgr *hio_mgr,
goto func_end;
}
/* Get end of 1st SM Heap region */
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Get start and length of message part of shared memory */
status = cod_get_sym_value(cod_man, SHM0_SHARED_END_SYM,
&shm0_end);
@@ -1561,7 +1558,7 @@ static int register_shm_segs(struct io_mgr *hio_mgr,
}
}
/* Start of Gpp reserved region */
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Get start and length of message part of shared memory */
status =
cod_get_sym_value(cod_man, SHM0_SHARED_RESERVED_BASE_SYM,
@@ -1572,15 +1569,15 @@ static int register_shm_segs(struct io_mgr *hio_mgr,
}
}
/* Register with CMM */
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
status = dev_get_cmm_mgr(hio_mgr->hdev_obj, &hio_mgr->hcmm_mgr);
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
status = cmm_un_register_gppsm_seg(hio_mgr->hcmm_mgr,
CMM_ALLSEGMENTS);
}
}
/* Register new SM region(s) */
- if (DSP_SUCCEEDED(status) && (shm0_end - ul_shm0_base) > 0) {
+ if (!status && (shm0_end - ul_shm0_base) > 0) {
/* Calc size (bytes) of SM the GPP can alloc from */
ul_rsrvd_size =
(shm0_end - ul_shm0_rsrvd_start + 1) * hio_mgr->word_size;
@@ -1843,11 +1840,11 @@ int print_dsp_trace_buffer(struct bridge_dev_context *hbridge_context)
} else {
status = -EFAULT;
}
- if (DSP_SUCCEEDED(status))
+ if (!status)
status =
cod_get_sym_value(cod_mgr, COD_TRACEEND, &ul_trace_end);

- if (DSP_SUCCEEDED(status))
+ if (!status)
/* trace_cur_pos will hold the address of a DSP pointer */
status = cod_get_sym_value(cod_mgr, COD_TRACECURPOS,
&trace_cur_pos);
@@ -2013,7 +2010,7 @@ int dump_dsp_stack(struct bridge_dev_context *bridge_context)
status = -EFAULT;
}

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
status = dev_get_node_manager(dev_object, &node_mgr);
if (!node_mgr) {
pr_debug("%s: Failed on dev_get_node_manager.\n",
@@ -2022,7 +2019,7 @@ int dump_dsp_stack(struct bridge_dev_context *bridge_context)
}
}

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Look for SYS_PUTCBEG/SYS_PUTCEND: */
status =
cod_get_sym_value(code_mgr, COD_TRACEBEG, &trace_begin);
@@ -2032,7 +2029,7 @@ int dump_dsp_stack(struct bridge_dev_context *bridge_context)
pr_debug("%s: Failed on cod_get_sym_value.\n",
__func__);
}
- if (DSP_SUCCEEDED(status))
+ if (!status)
status = dev_get_intf_fxns(dev_object, &intf_fxns);
/*
* Check for the "magic number" in the trace buffer. If it has
@@ -2041,7 +2038,7 @@ int dump_dsp_stack(struct bridge_dev_context *bridge_context)
*/
mmu_fault_dbg_info.head[0] = 0;
mmu_fault_dbg_info.head[1] = 0;
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
poll_cnt = 0;
while ((mmu_fault_dbg_info.head[0] != MMU_FAULT_HEAD1 ||
mmu_fault_dbg_info.head[1] != MMU_FAULT_HEAD2) &&
@@ -2066,7 +2063,7 @@ int dump_dsp_stack(struct bridge_dev_context *bridge_context)
}
}

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
total_size = mmu_fault_dbg_info.size;
/* Limit the size in case DSP went crazy */
if (total_size > MAX_MMU_DBGBUFF)
diff --git a/drivers/staging/tidspbridge/core/msg_sm.c b/drivers/staging/tidspbridge/core/msg_sm.c
index 7f44294..85ca448 100644
--- a/drivers/staging/tidspbridge/core/msg_sm.c
+++ b/drivers/staging/tidspbridge/core/msg_sm.c
@@ -102,7 +102,7 @@ int bridge_msg_create(struct msg_mgr **msg_man,
else
sync_init_event(msg_mgr_obj->sync_event);

- if (DSP_SUCCEEDED(status))
+ if (!status)
*msg_man = msg_mgr_obj;
else
delete_msg_mgr(msg_mgr_obj);
@@ -157,7 +157,7 @@ int bridge_msg_create_queue(struct msg_mgr *hmsg_mgr,

/* Create event that will be signalled when a message from
* the DSP is available. */
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
msg_q->sync_event = kzalloc(sizeof(struct sync_object),
GFP_KERNEL);
if (msg_q->sync_event)
@@ -167,7 +167,7 @@ int bridge_msg_create_queue(struct msg_mgr *hmsg_mgr,
}

/* Create a notification list for message ready notification. */
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
msg_q->ntfy_obj = kmalloc(sizeof(struct ntfy_object),
GFP_KERNEL);
if (msg_q->ntfy_obj)
@@ -181,7 +181,7 @@ int bridge_msg_create_queue(struct msg_mgr *hmsg_mgr,
* unblock threads in MSG_Put() or MSG_Get(). sync_done_ack
* will be set by the unblocked thread to signal that it
* is unblocked and will no longer reference the object. */
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
msg_q->sync_done = kzalloc(sizeof(struct sync_object),
GFP_KERNEL);
if (msg_q->sync_done)
@@ -190,7 +190,7 @@ int bridge_msg_create_queue(struct msg_mgr *hmsg_mgr,
status = -ENOMEM;
}

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
msg_q->sync_done_ack = kzalloc(sizeof(struct sync_object),
GFP_KERNEL);
if (msg_q->sync_done_ack)
@@ -199,13 +199,13 @@ int bridge_msg_create_queue(struct msg_mgr *hmsg_mgr,
status = -ENOMEM;
}

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Enter critical section */
spin_lock_bh(&hmsg_mgr->msg_mgr_lock);
/* Initialize message frames and put in appropriate queues */
- for (i = 0; i < max_msgs && DSP_SUCCEEDED(status); i++) {
+ for (i = 0; i < max_msgs && !status; i++) {
status = add_new_msg(hmsg_mgr->msg_free_list);
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
num_allocated++;
status = add_new_msg(msg_q->msg_free_list);
}
@@ -330,7 +330,7 @@ int bridge_msg_get(struct msg_queue *msg_queue_obj,
}
/* Exit critical section */
spin_unlock_bh(&hmsg_mgr->msg_mgr_lock);
- if (DSP_SUCCEEDED(status) && !got_msg) {
+ if (!status && !got_msg) {
/* Wait til message is available, timeout, or done. We don't
* have to schedule the DPC, since the DSP will send messages
* when they are available. */
@@ -349,7 +349,7 @@ int bridge_msg_get(struct msg_queue *msg_queue_obj,
(void)sync_set_event(msg_queue_obj->sync_done_ack);
status = -EPERM;
} else {
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
DBC_ASSERT(!LST_IS_EMPTY
(msg_queue_obj->msg_used_list));
/* Get msg from used list */
@@ -432,7 +432,7 @@ int bridge_msg_put(struct msg_queue *msg_queue_obj,

spin_unlock_bh(&hmsg_mgr->msg_mgr_lock);
}
- if (DSP_SUCCEEDED(status) && !put_msg) {
+ if (!status && !put_msg) {
/* Wait til a free message frame is available, timeout,
* or done */
syncs[0] = hmsg_mgr->sync_event;
diff --git a/drivers/staging/tidspbridge/core/tiomap3430.c b/drivers/staging/tidspbridge/core/tiomap3430.c
index ae1f394..8f25a05 100644
--- a/drivers/staging/tidspbridge/core/tiomap3430.c
+++ b/drivers/staging/tidspbridge/core/tiomap3430.c
@@ -262,7 +262,6 @@ void bridge_drv_entry(struct bridge_drv_interface **drv_intf,
*/
static int bridge_brd_monitor(struct bridge_dev_context *dev_ctxt)
{
- int status = 0;
struct bridge_dev_context *dev_context = dev_ctxt;
u32 temp;
struct dspbridge_platform_data *pdata =
@@ -291,11 +290,10 @@ static int bridge_brd_monitor(struct bridge_dev_context *dev_ctxt)
OMAP3430_IVA2_MOD, OMAP2_RM_RSTCTRL);
dsp_clk_enable(DSP_CLK_IVA2);

- if (DSP_SUCCEEDED(status)) {
- /* set the device state to IDLE */
- dev_context->dw_brd_state = BRD_IDLE;
- }
- return status;
+ /* set the device state to IDLE */
+ dev_context->dw_brd_state = BRD_IDLE;
+
+ return 0;
}

/*
@@ -406,13 +404,13 @@ static int bridge_brd_start(struct bridge_dev_context *dev_ctxt,
} else
__raw_writel(0xffffffff, dw_sync_addr);

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
resources = dev_context->resources;
if (!resources)
status = -EPERM;

/* Assert RST1 i.e only the RST only for DSP megacell */
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
(*pdata->dsp_prm_rmw_bits)(OMAP3430_RST1_IVA2_MASK,
OMAP3430_RST1_IVA2_MASK, OMAP3430_IVA2_MOD,
OMAP2_RM_RSTCTRL);
@@ -428,7 +426,7 @@ static int bridge_brd_start(struct bridge_dev_context *dev_ctxt,
OMAP343X_CONTROL_IVA2_BOOTMOD));
}
}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Reset and Unreset the RST2, so that BOOTADDR is copied to
* IVA2 SYSC register */
(*pdata->dsp_prm_rmw_bits)(OMAP3430_RST2_IVA2_MASK,
@@ -476,7 +474,7 @@ static int bridge_brd_start(struct bridge_dev_context *dev_ctxt,

/* Lock the above TLB entries and get the BIOS and load monitor timer
* information */
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
hw_mmu_num_locked_set(resources->dw_dmmu_base, itmp_entry_ndx);
hw_mmu_victim_num_set(resources->dw_dmmu_base, itmp_entry_ndx);
hw_mmu_ttb_set(resources->dw_dmmu_base,
@@ -499,7 +497,7 @@ static int bridge_brd_start(struct bridge_dev_context *dev_ctxt,
&ul_load_monitor_timer);
}

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
if (ul_load_monitor_timer != 0xFFFF) {
clk_cmd = (BPWR_ENABLE_CLOCK << MBX_PM_CLK_CMDSHIFT) |
ul_load_monitor_timer;
@@ -510,7 +508,7 @@ static int bridge_brd_start(struct bridge_dev_context *dev_ctxt,
}
}

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
if (ul_bios_gp_timer != 0xFFFF) {
clk_cmd = (BPWR_ENABLE_CLOCK << MBX_PM_CLK_CMDSHIFT) |
ul_bios_gp_timer;
@@ -521,7 +519,7 @@ static int bridge_brd_start(struct bridge_dev_context *dev_ctxt,
}
}

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Set the DSP clock rate */
(void)dev_get_symbol(dev_context->hdev_obj,
"_BRIDGEINIT_DSP_FREQ", &ul_dsp_clk_addr);
@@ -551,7 +549,7 @@ static int bridge_brd_start(struct bridge_dev_context *dev_ctxt,
}

}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
dev_context->mbox->rxq->callback = (int (*)(void *))io_mbox_msg;

/*PM_IVA2GRPSEL_PER = 0xC0;*/
@@ -908,7 +906,7 @@ static int bridge_dev_create(struct bridge_dev_context
else
status = -ENOMEM;

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
spin_lock_init(&pt_attrs->pg_lock);
dev_context->tc_word_swap_on = drv_datap->tc_wordswapon;

@@ -918,7 +916,7 @@ static int bridge_dev_create(struct bridge_dev_context
* resources struct */
dev_context->dw_dsp_mmu_base = resources->dw_dmmu_base;
}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
dev_context->hdev_obj = hdev_obj;
/* Store current board state. */
dev_context->dw_brd_state = BRD_STOPPED;
@@ -1111,13 +1109,13 @@ static int bridge_brd_mem_copy(struct bridge_dev_context *dev_ctxt,
u32 total_bytes = ul_num_bytes;
u8 host_buf[BUFFERSIZE];
struct bridge_dev_context *dev_context = dev_ctxt;
- while ((total_bytes > 0) && DSP_SUCCEEDED(status)) {
+ while (total_bytes > 0 && !status) {
copy_bytes =
total_bytes > BUFFERSIZE ? BUFFERSIZE : total_bytes;
/* Read from External memory */
status = read_ext_dsp_data(dev_ctxt, host_buf, src_addr,
copy_bytes, mem_type);
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
if (dest_addr < (dev_context->dw_dsp_start_add +
dev_context->dw_internal_size)) {
/* Write to Internal memory */
@@ -1149,7 +1147,7 @@ static int bridge_brd_mem_write(struct bridge_dev_context *dev_ctxt,
u32 ul_remain_bytes = 0;
u32 ul_bytes = 0;
ul_remain_bytes = ul_num_bytes;
- while (ul_remain_bytes > 0 && DSP_SUCCEEDED(status)) {
+ while (ul_remain_bytes > 0 && !status) {
ul_bytes =
ul_remain_bytes > BUFFERSIZE ? BUFFERSIZE : ul_remain_bytes;
if (dsp_addr < (dev_context->dw_dsp_start_add +
@@ -1369,9 +1367,7 @@ static int bridge_brd_mem_map(struct bridge_dev_context *dev_ctxt,
}
up_read(&mm->mmap_sem);
func_cont:
- if (DSP_SUCCEEDED(status)) {
- status = 0;
- } else {
+ if (status) {
/*
* Roll out the mapped pages incase it failed in middle of
* mapping
@@ -1433,7 +1429,7 @@ static int bridge_brd_mem_un_map(struct bridge_dev_context *dev_ctxt,
"pte_addr_l1 %x\n", __func__, dev_ctxt, virt_addr,
ul_num_bytes, l1_base_va, pte_addr_l1);

- while (rem_bytes && (DSP_SUCCEEDED(status))) {
+ while (rem_bytes && !status) {
u32 va_curr_orig = va_curr;
/* Find whether the L1 PTE points to a valid L2 PT */
pte_addr_l1 = hw_mmu_pte_addr_l1(l1_base_va, va_curr);
@@ -1472,7 +1468,7 @@ static int bridge_brd_mem_un_map(struct bridge_dev_context *dev_ctxt,
* entry. Similar checking is done for L1 PTEs too
* below
*/
- while (rem_bytes_l2 && (DSP_SUCCEEDED(status))) {
+ while (rem_bytes_l2 && !status) {
pte_val = *(u32 *) pte_addr_l2;
pte_size = hw_mmu_pte_size_l2(pte_val);
/* va_curr aligned to pte_size? */
@@ -1639,7 +1635,7 @@ static int pte_update(struct bridge_dev_context *dev_ctxt, u32 pa,
HW_PAGE_SIZE64KB, HW_PAGE_SIZE4KB
};

- while (num_bytes && DSP_SUCCEEDED(status)) {
+ while (num_bytes && !status) {
/* To find the max. page size with which both PA & VA are
* aligned */
all_bits = pa_curr | va_curr;
@@ -1736,7 +1732,7 @@ static int pte_set(struct pg_table_attrs *pt, u32 pa, u32 va,
* Should not overwrite it. */
status = -EPERM;
}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
pg_tbl_va = l2_base_va;
if (size == HW_PAGE_SIZE64KB)
pt->pg_info[l2_page_num].num_entries += 16;
@@ -1749,7 +1745,7 @@ static int pte_set(struct pg_table_attrs *pt, u32 pa, u32 va,
}
spin_unlock(&pt->pg_lock);
}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
dev_dbg(bridge, "PTE: pg_tbl_va %x, pa %x, va %x, size %x\n",
pg_tbl_va, pa, va, size);
dev_dbg(bridge, "PTE: endianism %x, element_size %x, "
@@ -1789,7 +1785,7 @@ static int mem_map_vmalloc(struct bridge_dev_context *dev_context,
va_curr = ul_mpu_addr;
page[0] = vmalloc_to_page((void *)va_curr);
pa_next = page_to_phys(page[0]);
- while (DSP_SUCCEEDED(status) && (i < num_pages)) {
+ while (!status && (i < num_pages)) {
/*
* Reuse pa_next from the previous iteraion to avoid
* an extra va2pa call
@@ -1827,11 +1823,6 @@ static int mem_map_vmalloc(struct bridge_dev_context *dev_context,
hw_attrs);
va_curr += size_curr;
}
- if (DSP_SUCCEEDED(status))
- status = 0;
- else
- status = -EPERM;
-
/*
* In any case, flush the TLB
* This is called from here instead from pte_update to avoid unnecessary
diff --git a/drivers/staging/tidspbridge/core/tiomap3430_pwr.c b/drivers/staging/tidspbridge/core/tiomap3430_pwr.c
index dc63b3a..d938645 100644
--- a/drivers/staging/tidspbridge/core/tiomap3430_pwr.c
+++ b/drivers/staging/tidspbridge/core/tiomap3430_pwr.c
@@ -112,7 +112,7 @@ int handle_hibernation_from_dsp(struct bridge_dev_context *dev_context)
/* Disable wdt on hibernation. */
dsp_wdt_enable(false);

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Update the Bridger Driver state */
dev_context->dw_brd_state = BRD_DSP_HIBERNATION;
#ifdef CONFIG_TIDSPBRIDGE_DVFS
@@ -310,7 +310,7 @@ int dsp_peripheral_clk_ctrl(struct bridge_dev_context *dev_context,
status = dsp_clk_disable(bpwr_clks[clk_id_index].clk);
dsp_clk_wakeup_event_ctrl(bpwr_clks[clk_id_index].clk_id,
false);
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
(dev_context->dsp_per_clks) &=
(~((u32) (1 << bpwr_clks[clk_id_index].clk)));
}
@@ -318,7 +318,7 @@ int dsp_peripheral_clk_ctrl(struct bridge_dev_context *dev_context,
case BPWR_ENABLE_CLOCK:
status = dsp_clk_enable(bpwr_clks[clk_id_index].clk);
dsp_clk_wakeup_event_ctrl(bpwr_clks[clk_id_index].clk_id, true);
- if (DSP_SUCCEEDED(status))
+ if (!status)
(dev_context->dsp_per_clks) |=
(1 << bpwr_clks[clk_id_index].clk);
break;
diff --git a/drivers/staging/tidspbridge/core/tiomap_io.c b/drivers/staging/tidspbridge/core/tiomap_io.c
index 742da05..190c028 100644
--- a/drivers/staging/tidspbridge/core/tiomap_io.c
+++ b/drivers/staging/tidspbridge/core/tiomap_io.c
@@ -70,19 +70,19 @@ int read_ext_dsp_data(struct bridge_dev_context *dev_ctxt,
DBC_ASSERT(ul_shm_base_virt != 0);

/* Check if it is a read of Trace section */
- if (DSP_SUCCEEDED(status) && !ul_trace_sec_beg) {
+ if (!status && !ul_trace_sec_beg) {
status = dev_get_symbol(dev_context->hdev_obj,
DSP_TRACESEC_BEG, &ul_trace_sec_beg);
}
DBC_ASSERT(ul_trace_sec_beg != 0);

- if (DSP_SUCCEEDED(status) && !ul_trace_sec_end) {
+ if (!status && !ul_trace_sec_end) {
status = dev_get_symbol(dev_context->hdev_obj,
DSP_TRACESEC_END, &ul_trace_sec_end);
}
DBC_ASSERT(ul_trace_sec_end != 0);

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
if ((dsp_addr <= ul_trace_sec_end) &&
(dsp_addr >= ul_trace_sec_beg))
trace_read = true;
@@ -100,19 +100,19 @@ int read_ext_dsp_data(struct bridge_dev_context *dev_ctxt,
ul_ext_end = 0;

/* Get DYNEXT_BEG, EXT_BEG and EXT_END. */
- if (DSP_SUCCEEDED(status) && !ul_dyn_ext_base) {
+ if (!status && !ul_dyn_ext_base) {
status = dev_get_symbol(dev_context->hdev_obj,
DYNEXTBASE, &ul_dyn_ext_base);
}
DBC_ASSERT(ul_dyn_ext_base != 0);

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
status = dev_get_symbol(dev_context->hdev_obj,
EXTBASE, &ul_ext_base);
}
DBC_ASSERT(ul_ext_base != 0);

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
status = dev_get_symbol(dev_context->hdev_obj,
EXTEND, &ul_ext_end);
}
@@ -131,7 +131,7 @@ int read_ext_dsp_data(struct bridge_dev_context *dev_ctxt,
if (ul_ext_end < ul_ext_base)
status = -EPERM;

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
ul_tlb_base_virt =
dev_context->atlb_entry[0].ul_dsp_va * DSPWORDSIZE;
DBC_ASSERT(ul_tlb_base_virt <= ul_shm_base_virt);
@@ -167,7 +167,7 @@ int read_ext_dsp_data(struct bridge_dev_context *dev_ctxt,

offset = dsp_addr - ul_ext_base;

- if (DSP_SUCCEEDED(status))
+ if (!status)
memcpy(host_buff, (u8 *) dw_base_addr + offset, ul_num_bytes);

return status;
@@ -247,12 +247,12 @@ int write_ext_dsp_data(struct bridge_dev_context *dev_context,
/* Check if it is a load to Trace section */
ret = dev_get_symbol(dev_context->hdev_obj,
DSP_TRACESEC_BEG, &ul_trace_sec_beg);
- if (DSP_SUCCEEDED(ret))
+ if (!ret)
ret = dev_get_symbol(dev_context->hdev_obj,
DSP_TRACESEC_END,
&ul_trace_sec_end);
}
- if (DSP_SUCCEEDED(ret)) {
+ if (!ret) {
if ((dsp_addr <= ul_trace_sec_end) &&
(dsp_addr >= ul_trace_sec_beg))
trace_load = true;
@@ -272,7 +272,7 @@ int write_ext_dsp_data(struct bridge_dev_context *dev_context,
SHMBASENAME, &ul_shm_base_virt);
DBC_ASSERT(ul_shm_base_virt != 0);
if (dynamic_load) {
- if (DSP_SUCCEEDED(ret)) {
+ if (!ret) {
if (symbols_reloaded)
ret =
dev_get_symbol
@@ -280,7 +280,7 @@ int write_ext_dsp_data(struct bridge_dev_context *dev_context,
&ul_ext_base);
}
DBC_ASSERT(ul_ext_base != 0);
- if (DSP_SUCCEEDED(ret)) {
+ if (!ret) {
/* DR OMAPS00013235 : DLModules array may be
* in EXTMEM. It is expected that DYNEXTMEM and
* EXTMEM are contiguous, so checking for the
@@ -293,13 +293,13 @@ int write_ext_dsp_data(struct bridge_dev_context *dev_context,
}
} else {
if (symbols_reloaded) {
- if (DSP_SUCCEEDED(ret))
+ if (!ret)
ret =
dev_get_symbol
(dev_context->hdev_obj, EXTBASE,
&ul_ext_base);
DBC_ASSERT(ul_ext_base != 0);
- if (DSP_SUCCEEDED(ret))
+ if (!ret)
ret =
dev_get_symbol
(dev_context->hdev_obj, EXTEND,
@@ -316,19 +316,16 @@ int write_ext_dsp_data(struct bridge_dev_context *dev_context,
if (ul_ext_end < ul_ext_base)
ret = -EPERM;

- if (DSP_SUCCEEDED(ret)) {
+ if (!ret) {
ul_tlb_base_virt =
dev_context->atlb_entry[0].ul_dsp_va * DSPWORDSIZE;
DBC_ASSERT(ul_tlb_base_virt <= ul_shm_base_virt);

if (symbols_reloaded) {
- if (DSP_SUCCEEDED(ret)) {
- ret =
- dev_get_symbol
+ ret = dev_get_symbol
(dev_context->hdev_obj,
DSP_TRACESEC_END, &shm0_end);
- }
- if (DSP_SUCCEEDED(ret)) {
+ if (!ret) {
ret =
dev_get_symbol
(dev_context->hdev_obj, DYNEXTBASE,
@@ -360,7 +357,7 @@ int write_ext_dsp_data(struct bridge_dev_context *dev_context,
if (!dw_base_addr || !ul_ext_base || !ul_ext_end)
ret = -EPERM;

- if (DSP_SUCCEEDED(ret)) {
+ if (!ret) {
for (i = 0; i < 4; i++)
remain_byte[i] = 0x0;

@@ -369,7 +366,7 @@ int write_ext_dsp_data(struct bridge_dev_context *dev_context,
if (dsp_addr > ul_ext_end || dw_offset > dsp_addr)
ret = -EPERM;
}
- if (DSP_SUCCEEDED(ret)) {
+ if (!ret) {
if (ul_num_bytes)
memcpy((u8 *) dw_base_addr + dw_offset, host_buff,
ul_num_bytes);
--
1.5.4.5

2010-07-28 14:43:23

by Ernesto Ramos

[permalink] [raw]
Subject: [PATCH 03/10] staging:ti dspbridge: remove DSP_SUCCEEDED macro from rmgr

Since status succeeded is now 0 macro DSP_SUCCEEDED
is not necessary anymore.

Signed-off-by: Ernesto Ramos <[email protected]>
---
drivers/staging/tidspbridge/rmgr/dbdcd.c | 24 ++--
drivers/staging/tidspbridge/rmgr/disp.c | 34 +++---
drivers/staging/tidspbridge/rmgr/drv.c | 31 ++---
drivers/staging/tidspbridge/rmgr/drv_interface.c | 2 +-
drivers/staging/tidspbridge/rmgr/dspdrv.c | 8 +-
drivers/staging/tidspbridge/rmgr/mgr.c | 20 ++--
drivers/staging/tidspbridge/rmgr/nldr.c | 93 +++++++-------
drivers/staging/tidspbridge/rmgr/node.c | 151 +++++++++++-----------
drivers/staging/tidspbridge/rmgr/proc.c | 95 +++++++-------
drivers/staging/tidspbridge/rmgr/pwr.c | 18 +--
drivers/staging/tidspbridge/rmgr/rmm.c | 8 +-
drivers/staging/tidspbridge/rmgr/strm.c | 48 ++++----
12 files changed, 260 insertions(+), 272 deletions(-)

diff --git a/drivers/staging/tidspbridge/rmgr/dbdcd.c b/drivers/staging/tidspbridge/rmgr/dbdcd.c
index b96aea7..12d2d41 100644
--- a/drivers/staging/tidspbridge/rmgr/dbdcd.c
+++ b/drivers/staging/tidspbridge/rmgr/dbdcd.c
@@ -156,7 +156,7 @@ int dcd_create_manager(char *sz_zl_dll_name,
cod_delete(cod_mgr);
}

- DBC_ENSURE((DSP_SUCCEEDED(status)) ||
+ DBC_ENSURE((!status) ||
((dcd_mgr_obj == NULL) && (status == -ENOMEM)));

func_end:
@@ -252,7 +252,7 @@ int dcd_enumerate_object(s32 index, enum dsp_dcdobjtype obj_type,
}
}

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
len = strlen(sz_reg_key);
spin_lock(&dbdcd_lock);
list_for_each_entry(dcd_key, &reg_key_list, link) {
@@ -269,7 +269,7 @@ int dcd_enumerate_object(s32 index, enum dsp_dcdobjtype obj_type,
status = -ENODATA;
}

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Create UUID value using string retrieved from
* registry. */
uuid_uuid_from_string(sz_value, &dsp_uuid_obj);
@@ -446,7 +446,7 @@ int dcd_get_object_def(struct dcd_manager *hdcd_mgr,
/* Retrieve paths from the registry based on struct dsp_uuid */
dw_buf_size = DCD_MAXPATHLENGTH;
}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
spin_lock(&dbdcd_lock);
list_for_each_entry(dcd_key, &reg_key_list, link) {
if (!strncmp(dcd_key->name, sz_reg_key,
@@ -500,7 +500,7 @@ int dcd_get_object_def(struct dcd_manager *hdcd_mgr,
#else
status = cod_read_section(lib, sz_sect_name, psz_coff_buf, ul_len);
#endif
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Compres DSP buffer to conform to PC format. */
if (strstr(dcd_key->path, "iva") == NULL) {
compress_buf(psz_coff_buf, ul_len, DSPWORDSIZE);
@@ -585,7 +585,7 @@ int dcd_get_objects(struct dcd_manager *hdcd_mgr,
status =
cod_read_section(lib, DCD_REGISTER_SECTION, psz_coff_buf, ul_len);
#endif
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Compress DSP buffer to conform to PC format. */
if (strstr(sz_coff_path, "iva") == NULL) {
compress_buf(psz_coff_buf, ul_len, DSPWORDSIZE);
@@ -699,7 +699,7 @@ int dcd_get_library_name(struct dcd_manager *hdcd_mgr,
status = -EINVAL;
DBC_ASSERT(false);
}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
if ((strlen(sz_reg_key) + strlen(sz_obj_type)) <
DCD_MAXPATHLENGTH) {
strncat(sz_reg_key, sz_obj_type,
@@ -714,7 +714,7 @@ int dcd_get_library_name(struct dcd_manager *hdcd_mgr,
else
status = -EPERM;
}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
spin_lock(&dbdcd_lock);
list_for_each_entry(dcd_key, &reg_key_list, link) {
/* See if the name matches. */
@@ -767,7 +767,7 @@ int dcd_get_library_name(struct dcd_manager *hdcd_mgr,
0 : -ENOKEY;
}

- if (DSP_SUCCEEDED(status))
+ if (!status)
memcpy(str_lib_name, dcd_key->path, strlen(dcd_key->path) + 1);
return status;
}
@@ -955,7 +955,7 @@ int dcd_register_object(struct dsp_uuid *uuid_obj,
status = -EPERM;
}

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/*
* Because the node database has been updated through a
* successful object registration/de-registration operation,
@@ -1441,11 +1441,11 @@ static int get_dep_lib_info(struct dcd_manager *hdcd_mgr,
}

/* Open the library */
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
status = cod_open(dcd_mgr_obj->cod_mgr, psz_file_name,
COD_NOLOAD, &lib);
}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Get dependent library section information. */
status = cod_get_section(lib, DEPLIBSECT, &ul_addr, &ul_len);

diff --git a/drivers/staging/tidspbridge/rmgr/disp.c b/drivers/staging/tidspbridge/rmgr/disp.c
index 417faeb..2d479b2 100644
--- a/drivers/staging/tidspbridge/rmgr/disp.c
+++ b/drivers/staging/tidspbridge/rmgr/disp.c
@@ -111,9 +111,9 @@ int disp_create(struct disp_object **dispatch_obj,
disp_obj->hdev_obj = hdev_obj;

/* Get Channel manager and Bridge function interface */
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
status = dev_get_chnl_mgr(hdev_obj, &(disp_obj->hchnl_mgr));
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
(void)dev_get_intf_fxns(hdev_obj, &intf_fxns);
disp_obj->intf_fxns = intf_fxns;
}
@@ -146,7 +146,7 @@ int disp_create(struct disp_object **dispatch_obj,
CHNL_MODETODSP, ul_chnl_id,
&chnl_attr_obj);

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
ul_chnl_id = disp_attrs->ul_chnl_offset + CHNLFROMRMSOFFSET;
status =
(*intf_fxns->pfn_chnl_open) (&(disp_obj->chnl_from_dsp),
@@ -154,7 +154,7 @@ int disp_create(struct disp_object **dispatch_obj,
CHNL_MODEFROMDSP, ul_chnl_id,
&chnl_attr_obj);
}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Allocate buffer for commands, replies */
disp_obj->ul_bufsize = disp_attrs->ul_chnl_buf_size;
disp_obj->ul_bufsize_rms = RMS_COMMANDBUFSIZE;
@@ -163,13 +163,13 @@ int disp_create(struct disp_object **dispatch_obj,
status = -ENOMEM;
}
func_cont:
- if (DSP_SUCCEEDED(status))
+ if (!status)
*dispatch_obj = disp_obj;
else
delete_disp(disp_obj);

DBC_ENSURE(((DSP_FAILED(status)) && ((*dispatch_obj == NULL))) ||
- ((DSP_SUCCEEDED(status)) && *dispatch_obj));
+ (!status && *dispatch_obj));
return status;
}

@@ -345,7 +345,7 @@ int disp_node_create(struct disp_object *disp_obj,
* Socket Args (if DAIS socket node):
*
*/
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
total = 0; /* Total number of words in buffer so far */
pdw_buf = (rms_word *) disp_obj->pbuf;
rms_cmd = (struct rms_command *)pdw_buf;
@@ -439,7 +439,7 @@ int disp_node_create(struct disp_object *disp_obj,
offset = total;
}
for (i = 0; (i < task_arg_obj.num_outputs) &&
- (DSP_SUCCEEDED(status)); i++) {
+ (!status); i++) {
pdw_buf[sio_out_def_offset + i] =
(offset - args_offset)
* (sizeof(rms_word) / DSPWORDSIZE);
@@ -455,12 +455,12 @@ int disp_node_create(struct disp_object *disp_obj,
status = -EPERM;
}
}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
ul_bytes = total * sizeof(rms_word);
DBC_ASSERT(ul_bytes < (RMS_COMMANDBUFSIZE * sizeof(rms_word)));
status = send_message(disp_obj, node_get_timeout(hnode),
ul_bytes, node_env);
- if (DSP_SUCCEEDED(status)) {
+ if (status >= 0) {
/*
* Message successfully received from RMS.
* Return the status of the Node's create function
@@ -497,7 +497,7 @@ int disp_node_delete(struct disp_object *disp_obj,

status = dev_get_dev_type(disp_obj->hdev_obj, &dev_type);

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {

if (dev_type == DSP_UNIT) {

@@ -513,7 +513,7 @@ int disp_node_delete(struct disp_object *disp_obj,
status = send_message(disp_obj, node_get_timeout(hnode),
sizeof(struct rms_command),
&dw_arg);
- if (DSP_SUCCEEDED(status)) {
+ if (status >= 0) {
/*
* Message successfully received from RMS.
* Return the status of the Node's delete
@@ -550,7 +550,7 @@ int disp_node_run(struct disp_object *disp_obj,

status = dev_get_dev_type(disp_obj->hdev_obj, &dev_type);

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {

if (dev_type == DSP_UNIT) {

@@ -566,7 +566,7 @@ int disp_node_run(struct disp_object *disp_obj,
status = send_message(disp_obj, node_get_timeout(hnode),
sizeof(struct rms_command),
&dw_arg);
- if (DSP_SUCCEEDED(status)) {
+ if (status >= 0) {
/*
* Message successfully received from RMS.
* Return the status of the Node's execute
@@ -649,7 +649,7 @@ static int fill_stream_def(rms_word *pdw_buf, u32 *ptotal, u32 offset,
strm_def_obj->timeout = strm_def.utimeout;
}

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/*
* Since we haven't added the device name yet, subtract
* 1 from total.
@@ -709,7 +709,7 @@ static int send_message(struct disp_object *disp_obj, u32 timeout,

status =
(*intf_fxns->pfn_chnl_get_ioc) (chnl_obj, timeout, &chnl_ioc_obj);
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
if (!CHNL_IS_IO_COMPLETE(chnl_ioc_obj)) {
if (CHNL_IS_TIMED_OUT(chnl_ioc_obj))
status = -ETIME;
@@ -730,7 +730,7 @@ static int send_message(struct disp_object *disp_obj, u32 timeout,

status =
(*intf_fxns->pfn_chnl_get_ioc) (chnl_obj, timeout, &chnl_ioc_obj);
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
if (CHNL_IS_TIMED_OUT(chnl_ioc_obj)) {
status = -ETIME;
} else if (chnl_ioc_obj.byte_size < ul_bytes) {
diff --git a/drivers/staging/tidspbridge/rmgr/drv.c b/drivers/staging/tidspbridge/rmgr/drv.c
index 2ce0737..93e9369 100644
--- a/drivers/staging/tidspbridge/rmgr/drv.c
+++ b/drivers/staging/tidspbridge/rmgr/drv.c
@@ -90,7 +90,7 @@ int drv_insert_node_res_element(void *hnode, void *node_resource,
if (*node_res_obj == NULL)
status = -EFAULT;

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
if (mutex_lock_interruptible(&ctxt->node_mutex)) {
kfree(*node_res_obj);
return -EPERM;
@@ -282,7 +282,7 @@ int drv_proc_insert_strm_res_element(void *stream_obj,
if (*pstrm_res == NULL)
status = -EFAULT;

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
if (mutex_lock_interruptible(&ctxt->strm_mutex)) {
kfree(*pstrm_res);
return -EPERM;
@@ -453,9 +453,9 @@ int drv_create(struct drv_object **drv_obj)
status = -ENOMEM;
}
/* Store the DRV Object in the Registry */
- if (DSP_SUCCEEDED(status))
+ if (!status)
status = cfg_set_object((u32) pdrv_object, REG_DRV_OBJECT);
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
*drv_obj = pdrv_object;
} else {
kfree(pdrv_object->dev_list);
@@ -556,7 +556,7 @@ u32 drv_get_first_dev_object(void)
u32 dw_dev_object = 0;
struct drv_object *pdrv_obj;

- if (DSP_SUCCEEDED(cfg_get_object((u32 *) &pdrv_obj, REG_DRV_OBJECT))) {
+ if (!cfg_get_object((u32 *) &pdrv_obj, REG_DRV_OBJECT)) {
if ((pdrv_obj->dev_list != NULL) &&
!LST_IS_EMPTY(pdrv_obj->dev_list))
dw_dev_object = (u32) lst_first(pdrv_obj->dev_list);
@@ -576,7 +576,7 @@ u32 drv_get_first_dev_extension(void)
u32 dw_dev_extension = 0;
struct drv_object *pdrv_obj;

- if (DSP_SUCCEEDED(cfg_get_object((u32 *) &pdrv_obj, REG_DRV_OBJECT))) {
+ if (!cfg_get_object((u32 *) &pdrv_obj, REG_DRV_OBJECT)) {

if ((pdrv_obj->dev_node_string != NULL) &&
!LST_IS_EMPTY(pdrv_obj->dev_node_string)) {
@@ -602,7 +602,7 @@ u32 drv_get_next_dev_object(u32 hdev_obj)

DBC_REQUIRE(hdev_obj != 0);

- if (DSP_SUCCEEDED(cfg_get_object((u32 *) &pdrv_obj, REG_DRV_OBJECT))) {
+ if (!cfg_get_object((u32 *) &pdrv_obj, REG_DRV_OBJECT)) {

if ((pdrv_obj->dev_list != NULL) &&
!LST_IS_EMPTY(pdrv_obj->dev_list)) {
@@ -629,7 +629,7 @@ u32 drv_get_next_dev_extension(u32 dev_extension)

DBC_REQUIRE(dev_extension != 0);

- if (DSP_SUCCEEDED(cfg_get_object((u32 *) &pdrv_obj, REG_DRV_OBJECT))) {
+ if (!cfg_get_object((u32 *) &pdrv_obj, REG_DRV_OBJECT)) {
if ((pdrv_obj->dev_node_string != NULL) &&
!LST_IS_EMPTY(pdrv_obj->dev_node_string)) {
dw_dev_extension =
@@ -668,7 +668,6 @@ int drv_init(void)
int drv_insert_dev_object(struct drv_object *driver_obj,
struct dev_object *hdev_obj)
{
- int status = 0;
struct drv_object *pdrv_object = (struct drv_object *)driver_obj;

DBC_REQUIRE(refs > 0);
@@ -678,10 +677,9 @@ int drv_insert_dev_object(struct drv_object *driver_obj,

lst_put_tail(pdrv_object->dev_list, (struct list_head *)hdev_obj);

- DBC_ENSURE(DSP_SUCCEEDED(status)
- && !LST_IS_EMPTY(pdrv_object->dev_list));
+ DBC_ENSURE(!LST_IS_EMPTY(pdrv_object->dev_list));

- return status;
+ return 0;
}

/*
@@ -746,7 +744,7 @@ int drv_request_resources(u32 dw_context, u32 *dev_node_strg)
*/

status = cfg_get_object((u32 *) &pdrv_object, REG_DRV_OBJECT);
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
pszdev_node = kzalloc(sizeof(struct drv_ext), GFP_KERNEL);
if (pszdev_node) {
lst_init_elem(&pszdev_node->link);
@@ -767,7 +765,7 @@ int drv_request_resources(u32 dw_context, u32 *dev_node_strg)
*dev_node_strg = 0;
}

- DBC_ENSURE((DSP_SUCCEEDED(status) && dev_node_strg != NULL &&
+ DBC_ENSURE((!status && dev_node_strg != NULL &&
!LST_IS_EMPTY(pdrv_object->dev_node_string)) ||
(DSP_FAILED(status) && *dev_node_strg == 0));

@@ -820,7 +818,6 @@ int drv_release_resources(u32 dw_context, struct drv_object *hdrv_obj)
*/
static int request_bridge_resources(struct cfg_hostres *res)
{
- int status = 0;
struct cfg_hostres *host_res = res;

/* num_mem_windows must not be more than CFG_MAXMEMREGISTERS */
@@ -845,7 +842,7 @@ static int request_bridge_resources(struct cfg_hostres *res)
host_res->dw_num_chnls = CHNL_MAXCHANNELS;
host_res->dw_chnl_buf_size = 0x400;

- return status;
+ return 0;
}

/*
@@ -919,7 +916,7 @@ int drv_request_bridge_res_dsp(void **phost_resources)
dma_addr, shm_size);
}
}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* These are hard-coded values */
host_res->birq_registers = 0;
host_res->birq_attrib = 0;
diff --git a/drivers/staging/tidspbridge/rmgr/drv_interface.c b/drivers/staging/tidspbridge/rmgr/drv_interface.c
index 340c92d..b1dcf4a 100644
--- a/drivers/staging/tidspbridge/rmgr/drv_interface.c
+++ b/drivers/staging/tidspbridge/rmgr/drv_interface.c
@@ -588,7 +588,7 @@ static long bridge_ioctl(struct file *filp, unsigned int code,
status = api_call_dev_ioctl(code, &buf_in, &retval,
filp->private_data);

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
status = retval;
} else {
dev_dbg(bridge, "%s: IOCTL Failed, code: 0x%x "
diff --git a/drivers/staging/tidspbridge/rmgr/dspdrv.c b/drivers/staging/tidspbridge/rmgr/dspdrv.c
index 8fedf18..0a10d88 100644
--- a/drivers/staging/tidspbridge/rmgr/dspdrv.c
+++ b/drivers/staging/tidspbridge/rmgr/dspdrv.c
@@ -64,7 +64,7 @@ u32 dsp_init(u32 *init_status)
/* End drv_create */
/* Request Resources */
status = drv_request_resources((u32) &dev_node, &device_node_string);
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Attempt to Start the Device */
status = dev_start_device((struct cfg_devnode *)
device_node_string);
@@ -97,7 +97,7 @@ u32 dsp_init(u32 *init_status)
} /* Unwinding the loaded drivers */
func_cont:
/* Attempt to Start the Board */
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* BRD_AutoStart could fail if the dsp execuetable is not the
* correct one. We should not propagate that error
* into the device loader. */
@@ -105,7 +105,7 @@ func_cont:
} else {
dev_dbg(bridge, "%s: Failed\n", __func__);
} /* End api_init_complete2 */
- DBC_ENSURE((DSP_SUCCEEDED(status) && drv_obj != NULL) ||
+ DBC_ENSURE((!status && drv_obj != NULL) ||
(DSP_FAILED(status) && drv_obj == NULL));
*init_status = status;
/* Return the Driver Object */
@@ -133,7 +133,7 @@ bool dsp_deinit(u32 device_context)

/* Get the Manager Object from Registry
* MGR Destroy will unload the DCD dll */
- if (DSP_SUCCEEDED(cfg_get_object((u32 *) &mgr_obj, REG_MGR_OBJECT)))
+ if (!cfg_get_object((u32 *) &mgr_obj, REG_MGR_OBJECT))
(void)mgr_destroy(mgr_obj);

api_exit();
diff --git a/drivers/staging/tidspbridge/rmgr/mgr.c b/drivers/staging/tidspbridge/rmgr/mgr.c
index 805d3ca..57ae807 100644
--- a/drivers/staging/tidspbridge/rmgr/mgr.c
+++ b/drivers/staging/tidspbridge/rmgr/mgr.c
@@ -65,10 +65,10 @@ int mgr_create(struct mgr_object **mgr_obj,
pmgr_obj = kzalloc(sizeof(struct mgr_object), GFP_KERNEL);
if (pmgr_obj) {
status = dcd_create_manager(ZLDLLNAME, &pmgr_obj->hdcd_mgr);
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* If succeeded store the handle in the MGR Object */
status = cfg_set_object((u32) pmgr_obj, REG_MGR_OBJECT);
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
*mgr_obj = pmgr_obj;
} else {
dcd_destroy_manager(pmgr_obj->hdcd_mgr);
@@ -148,7 +148,7 @@ int mgr_enum_node_info(u32 node_id, struct dsp_ndbprops *pndb_props,

}
}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
if (node_id > (node_index - 1)) {
status = -EINVAL;
} else {
@@ -156,7 +156,7 @@ int mgr_enum_node_info(u32 node_id, struct dsp_ndbprops *pndb_props,
(struct dsp_uuid *)
&node_uuid, DSP_DCDNODETYPE,
&gen_obj);
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Get the Obj def */
*pndb_props =
gen_obj.obj_data.node_obj.ndb_props;
@@ -166,7 +166,7 @@ int mgr_enum_node_info(u32 node_id, struct dsp_ndbprops *pndb_props,
}

func_cont:
- DBC_ENSURE((DSP_SUCCEEDED(status) && *pu_num_nodes > 0) ||
+ DBC_ENSURE((!status && *pu_num_nodes > 0) ||
(DSP_FAILED(status) && *pu_num_nodes == 0));

return status;
@@ -204,15 +204,15 @@ int mgr_enum_processor_info(u32 processor_id,

*pu_num_procs = 0;
status = cfg_get_object((u32 *) &hdrv_obj, REG_DRV_OBJECT);
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
status = drv_get_dev_object(processor_id, hdrv_obj, &hdev_obj);
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
status = dev_get_dev_type(hdev_obj, (u8 *) &dev_type);
status = dev_get_dev_node(hdev_obj, &dev_node);
if (dev_type != DSP_UNIT)
status = -EPERM;

- if (DSP_SUCCEEDED(status))
+ if (!status)
processor_info->processor_type = DSPTYPE64;
}
}
@@ -243,7 +243,7 @@ int mgr_enum_processor_info(u32 processor_id,
status2 = dcd_get_object_def(pmgr_obj->hdcd_mgr,
(struct dsp_uuid *)&temp_uuid,
DSP_DCDPROCESSORTYPE, &gen_obj);
- if (DSP_SUCCEEDED(status2)) {
+ if (!status2) {
/* Get the Obj def */
if (processor_info_size <
sizeof(struct mgr_processorextinfo)) {
@@ -318,7 +318,7 @@ int mgr_get_dcd_handle(struct mgr_object *mgr_handle,
*dcd_handle = (u32) pmgr_obj->hdcd_mgr;
status = 0;
}
- DBC_ENSURE((DSP_SUCCEEDED(status) && *dcd_handle != (u32) NULL) ||
+ DBC_ENSURE((!status && *dcd_handle != (u32) NULL) ||
(DSP_FAILED(status) && *dcd_handle == (u32) NULL));

return status;
diff --git a/drivers/staging/tidspbridge/rmgr/nldr.c b/drivers/staging/tidspbridge/rmgr/nldr.c
index f01bddd..3b83fc3 100644
--- a/drivers/staging/tidspbridge/rmgr/nldr.c
+++ b/drivers/staging/tidspbridge/rmgr/nldr.c
@@ -402,7 +402,7 @@ int nldr_allocate(struct nldr_object *nldr_obj, void *priv_ref,
if (DSP_FAILED(status) && nldr_node_obj)
kfree(nldr_node_obj);

- DBC_ENSURE((DSP_SUCCEEDED(status) && *nldr_nodeobj)
+ DBC_ENSURE((!status && *nldr_nodeobj)
|| (DSP_FAILED(status) && *nldr_nodeobj == NULL));
return status;
}
@@ -444,13 +444,13 @@ int nldr_create(struct nldr_object **nldr,
dev_get_cod_mgr(hdev_obj, &cod_mgr);
if (cod_mgr) {
status = cod_get_loader(cod_mgr, &nldr_obj->dbll);
- DBC_ASSERT(DSP_SUCCEEDED(status));
+ DBC_ASSERT(!status);
status = cod_get_base_lib(cod_mgr, &nldr_obj->base_lib);
- DBC_ASSERT(DSP_SUCCEEDED(status));
+ DBC_ASSERT(!status);
status =
cod_get_base_name(cod_mgr, sz_zl_file,
COD_MAXPATHLENGTH);
- DBC_ASSERT(DSP_SUCCEEDED(status));
+ DBC_ASSERT(!status);
}
status = 0;
/* end lazy status checking */
@@ -464,16 +464,16 @@ int nldr_create(struct nldr_object **nldr,
status = -ENOMEM;
}
/* Create the DCD Manager */
- if (DSP_SUCCEEDED(status))
+ if (!status)
status = dcd_create_manager(NULL, &nldr_obj->hdcd_mgr);

/* Get dynamic loading memory sections from base lib */
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
status =
nldr_obj->ldr_fxns.get_sect_fxn(nldr_obj->base_lib,
DYNMEMSECT, &ul_addr,
&ul_len);
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
psz_coff_buf =
kzalloc(ul_len * nldr_obj->us_dsp_mau_size,
GFP_KERNEL);
@@ -487,21 +487,21 @@ int nldr_create(struct nldr_object **nldr,
"segments: 0x%x\n", __func__, status);
}
}
- if (DSP_SUCCEEDED(status) && ul_len > 0) {
+ if (!status && ul_len > 0) {
/* Read section containing dynamic load mem segments */
status =
nldr_obj->ldr_fxns.read_sect_fxn(nldr_obj->base_lib,
DYNMEMSECT, psz_coff_buf,
ul_len);
}
- if (DSP_SUCCEEDED(status) && ul_len > 0) {
+ if (!status && ul_len > 0) {
/* Parse memory segment data */
dload_segs = (u16) (*((u32 *) psz_coff_buf));
if (dload_segs > MAXMEMSEGS)
status = -EBADF;
}
/* Parse dynamic load memory segments */
- if (DSP_SUCCEEDED(status) && dload_segs > 0) {
+ if (!status && dload_segs > 0) {
rmm_segs = kzalloc(sizeof(struct rmm_segment) * dload_segs,
GFP_KERNEL);
nldr_obj->seg_table =
@@ -526,10 +526,10 @@ int nldr_create(struct nldr_object **nldr,
}
}
/* Create Remote memory manager */
- if (DSP_SUCCEEDED(status))
+ if (!status)
status = rmm_create(&nldr_obj->rmm, rmm_segs, dload_segs);

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* set the alloc, free, write functions for loader */
nldr_obj->ldr_fxns.get_attrs_fxn(nldr_obj->dbll, &save_attrs);
new_attrs = save_attrs;
@@ -547,17 +547,17 @@ int nldr_create(struct nldr_object **nldr,
kfree(psz_coff_buf);

/* Get overlay nodes */
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
status =
cod_get_base_name(cod_mgr, sz_zl_file, COD_MAXPATHLENGTH);
/* lazy check */
- DBC_ASSERT(DSP_SUCCEEDED(status));
+ DBC_ASSERT(!status);
/* First count number of overlay nodes */
status =
dcd_get_objects(nldr_obj->hdcd_mgr, sz_zl_file,
add_ovly_node, (void *)nldr_obj);
/* Now build table of overlay nodes */
- if (DSP_SUCCEEDED(status) && nldr_obj->ovly_nodes > 0) {
+ if (!status && nldr_obj->ovly_nodes > 0) {
/* Allocate table for overlay nodes */
nldr_obj->ovly_table =
kzalloc(sizeof(struct ovly_node) *
@@ -570,7 +570,7 @@ int nldr_create(struct nldr_object **nldr,
}
}
/* Do a fake reload of the base image to get overlay section info */
- if (DSP_SUCCEEDED(status) && nldr_obj->ovly_nodes > 0) {
+ if (!status && nldr_obj->ovly_nodes > 0) {
save_attrs.write = fake_ovly_write;
save_attrs.log_write = add_ovly_info;
save_attrs.log_write_handle = nldr_obj;
@@ -578,7 +578,7 @@ int nldr_create(struct nldr_object **nldr,
status = nldr_obj->ldr_fxns.load_fxn(nldr_obj->base_lib, flags,
&save_attrs, &ul_entry);
}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
*nldr = (struct nldr_object *)nldr_obj;
} else {
if (nldr_obj)
@@ -587,7 +587,7 @@ int nldr_create(struct nldr_object **nldr,
*nldr = NULL;
}
/* FIXME:Temp. Fix. Must be removed */
- DBC_ENSURE((DSP_SUCCEEDED(status) && *nldr)
+ DBC_ENSURE((!status && *nldr)
|| (DSP_FAILED(status) && (*nldr == NULL)));
return status;
}
@@ -774,8 +774,7 @@ int nldr_get_rmm_manager(struct nldr_object *nldr,
status = -EFAULT;
}

- DBC_ENSURE(DSP_SUCCEEDED(status) || ((rmm_mgr != NULL) &&
- (*rmm_mgr == NULL)));
+ DBC_ENSURE(!status || (rmm_mgr != NULL && *rmm_mgr == NULL));

return status;
}
@@ -826,7 +825,7 @@ int nldr_load(struct nldr_nodeobject *nldr_node_obj,
load_lib(nldr_node_obj, &nldr_node_obj->root, lib_uuid,
false, nldr_node_obj->lib_path, phase, 0);

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
if (*nldr_node_obj->pf_phase_split) {
switch (phase) {
case NLDR_CREATE:
@@ -956,7 +955,7 @@ static int add_ovly_info(void *handle, struct dbll_sect_info *sect_info,
&nldr_obj->
ovly_table[i].create_sects_list,
sect_info, &sect_exists, addr, bytes);
- if (DSP_SUCCEEDED(status) && !sect_exists)
+ if (!status && !sect_exists)
nldr_obj->ovly_table[i].create_sects++;

} else if (strncmp(pch, PDELETE, strlen(PDELETE)) == 0) {
@@ -965,7 +964,7 @@ static int add_ovly_info(void *handle, struct dbll_sect_info *sect_info,
&nldr_obj->
ovly_table[i].delete_sects_list,
sect_info, &sect_exists, addr, bytes);
- if (DSP_SUCCEEDED(status) && !sect_exists)
+ if (!status && !sect_exists)
nldr_obj->ovly_table[i].delete_sects++;

} else if (strncmp(pch, PEXECUTE, strlen(PEXECUTE)) == 0) {
@@ -974,7 +973,7 @@ static int add_ovly_info(void *handle, struct dbll_sect_info *sect_info,
&nldr_obj->
ovly_table[i].execute_sects_list,
sect_info, &sect_exists, addr, bytes);
- if (DSP_SUCCEEDED(status) && !sect_exists)
+ if (!status && !sect_exists)
nldr_obj->ovly_table[i].execute_sects++;

} else {
@@ -984,7 +983,7 @@ static int add_ovly_info(void *handle, struct dbll_sect_info *sect_info,
&nldr_obj->
ovly_table[i].other_sects_list,
sect_info, &sect_exists, addr, bytes);
- if (DSP_SUCCEEDED(status) && !sect_exists)
+ if (!status && !sect_exists)
nldr_obj->ovly_table[i].other_sects++;

}
@@ -1096,7 +1095,7 @@ static int add_ovly_sect(struct nldr_object *nldr_obj,
}

/* Add to the list */
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
if (*lst == NULL) {
/* First in the list */
*lst = new_sect;
@@ -1263,7 +1262,7 @@ static int load_lib(struct nldr_nodeobject *nldr_node_obj,
if (psz_file_name == NULL)
status = -ENOMEM;

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Get the name of the library */
if (depth == 0) {
status =
@@ -1280,7 +1279,7 @@ static int load_lib(struct nldr_nodeobject *nldr_node_obj,
NULL);
}
}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Open the library, don't load symbols */
status =
nldr_obj->ldr_fxns.open_fxn(nldr_obj->dbll, psz_file_name,
@@ -1290,7 +1289,7 @@ static int load_lib(struct nldr_nodeobject *nldr_node_obj,
kfree(psz_file_name);

/* Check to see if library not already loaded */
- if (DSP_SUCCEEDED(status) && root_prstnt) {
+ if (!status && root_prstnt) {
lib_status =
find_in_persistent_lib_array(nldr_node_obj, root->lib);
/* Close library */
@@ -1299,7 +1298,7 @@ static int load_lib(struct nldr_nodeobject *nldr_node_obj,
return 0;
}
}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Check for circular dependencies. */
for (i = 0; i < depth; i++) {
if (root->lib == lib_path[i]) {
@@ -1309,7 +1308,7 @@ static int load_lib(struct nldr_nodeobject *nldr_node_obj,
}
}
}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Add library to current path in dependency tree */
lib_path[depth] = root->lib;
depth++;
@@ -1319,7 +1318,7 @@ static int load_lib(struct nldr_nodeobject *nldr_node_obj,
&uuid, &nd_libs, &np_libs, phase);
}
DBC_ASSERT(nd_libs >= np_libs);
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
if (!(*nldr_node_obj->pf_phase_split))
np_libs = 0;

@@ -1344,7 +1343,7 @@ static int load_lib(struct nldr_nodeobject *nldr_node_obj,

}

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Get the dependent library UUIDs */
status =
dcd_get_dep_libs(nldr_node_obj->
@@ -1359,7 +1358,7 @@ static int load_lib(struct nldr_nodeobject *nldr_node_obj,
/*
* Recursively load dependent libraries.
*/
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
for (i = 0; i < nd_libs; i++) {
/* If root library is NOT persistent, and dep library
* is, then record it. If root library IS persistent,
@@ -1388,7 +1387,7 @@ static int load_lib(struct nldr_nodeobject *nldr_node_obj,
persistent_dep_libs[i], lib_path,
phase, depth);

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
if ((status != 0) &&
!root_prstnt && persistent_dep_libs[i] &&
*nldr_node_obj->pf_phase_split) {
@@ -1406,7 +1405,7 @@ static int load_lib(struct nldr_nodeobject *nldr_node_obj,
}

/* Now we can load the root library */
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
new_attrs = nldr_obj->ldr_attrs;
new_attrs.sym_arg = root;
new_attrs.rmm_handle = nldr_node_obj;
@@ -1523,7 +1522,7 @@ static int load_ovly(struct nldr_nodeobject *nldr_node_obj,
/* reserve *//* align */
status = rmm_alloc(nldr_obj->rmm, 0, ovly_section->size, 0,
&(ovly_section->sect_run_addr), true);
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
ovly_section = ovly_section->next_sect;
alloc_num++;
} else {
@@ -1533,7 +1532,7 @@ static int load_ovly(struct nldr_nodeobject *nldr_node_obj,
if (other_ref && *other_ref == 0) {
/* 'Allocate' memory for other overlay sections
* (create phase) */
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
ovly_section = other_sects_list;
while (ovly_section) {
/* page not supported *//* align */
@@ -1543,7 +1542,7 @@ static int load_ovly(struct nldr_nodeobject *nldr_node_obj,
ovly_section->size, 0,
&(ovly_section->sect_run_addr),
true);
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
ovly_section = ovly_section->next_sect;
other_alloc++;
} else {
@@ -1553,10 +1552,10 @@ static int load_ovly(struct nldr_nodeobject *nldr_node_obj,
}
}
if (*ref_count == 0) {
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Load sections for this phase */
ovly_section = phase_sects;
- while (ovly_section && DSP_SUCCEEDED(status)) {
+ while (ovly_section && !status) {
bytes =
(*nldr_obj->ovly_fxn) (nldr_node_obj->
priv_ref,
@@ -1574,10 +1573,10 @@ static int load_ovly(struct nldr_nodeobject *nldr_node_obj,
}
}
if (other_ref && *other_ref == 0) {
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Load other sections (create phase) */
ovly_section = other_sects_list;
- while (ovly_section && DSP_SUCCEEDED(status)) {
+ while (ovly_section && !status) {
bytes =
(*nldr_obj->ovly_fxn) (nldr_node_obj->
priv_ref,
@@ -1600,7 +1599,7 @@ static int load_ovly(struct nldr_nodeobject *nldr_node_obj,
free_sects(nldr_obj, other_sects_list, other_alloc);
}
func_end:
- if (DSP_SUCCEEDED(status) && (ref_count != NULL)) {
+ if (!status && (ref_count != NULL)) {
*ref_count += 1;
if (other_ref)
*other_ref += 1;
@@ -1702,8 +1701,8 @@ static int remote_alloc(void **ref, u16 mem_sect, u32 size,
continue;

status = rmm_alloc(rmm, i, word_size, align,
- dsp_address, false);
- if (DSP_SUCCEEDED(status)) {
+ dsp_address, false);
+ if (!status) {
/* Save segid for freeing later */
rmm_addr_obj->segid = i;
break;
@@ -1723,7 +1722,7 @@ func_cont:

status = rmm_alloc(rmm, i, word_size, align,
dsp_address, false);
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Save segid */
rmm_addr_obj->segid = i;
break;
diff --git a/drivers/staging/tidspbridge/rmgr/node.c b/drivers/staging/tidspbridge/rmgr/node.c
index 9f07c81..d8593fd 100644
--- a/drivers/staging/tidspbridge/rmgr/node.c
+++ b/drivers/staging/tidspbridge/rmgr/node.c
@@ -338,7 +338,7 @@ int node_allocate(struct proc_object *hprocessor,
goto func_end;

status = proc_get_dev_object(hprocessor, &hdev_obj);
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
status = dev_get_node_manager(hdev_obj, &hnode_mgr);
if (hnode_mgr == NULL)
status = -EPERM;
@@ -475,7 +475,7 @@ func_cont:
pnode->prio = attr_in->prio;
}
/* Create object to manage notifications */
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
pnode->ntfy_obj = kmalloc(sizeof(struct ntfy_object),
GFP_KERNEL);
if (pnode->ntfy_obj)
@@ -484,7 +484,7 @@ func_cont:
status = -ENOMEM;
}

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
node_type = node_get_type(pnode);
/* Allocate dsp_streamconnect array for device, task, and
* dais socket nodes. */
@@ -497,7 +497,7 @@ func_cont:
status = -ENOMEM;

}
- if (DSP_SUCCEEDED(status) && (node_type == NODE_TASK ||
+ if (!status && (node_type == NODE_TASK ||
node_type == NODE_DAISSOCKET)) {
/* Allocate arrays for maintainig stream connections */
pnode->inputs = kzalloc(MAX_INPUTS(pnode) *
@@ -520,7 +520,7 @@ func_cont:
status = -ENOMEM;
}
}
- if (DSP_SUCCEEDED(status) && (node_type != NODE_DEVICE)) {
+ if (!status && (node_type != NODE_DEVICE)) {
/* Create an event that will be posted when RMS_EXIT is
* received. */
pnode->sync_done = kzalloc(sizeof(struct sync_object),
@@ -530,17 +530,17 @@ func_cont:
else
status = -ENOMEM;

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/*Get the shared mem mgr for this nodes dev object */
status = cmm_get_handle(hprocessor, &hcmm_mgr);
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Allocate a SM addr translator for this node
* w/ deflt attr */
status = cmm_xlator_create(&pnode->xlator,
hcmm_mgr, NULL);
}
}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Fill in message args */
if ((pargs != NULL) && (pargs->cb_data > 0)) {
pmsg_args =
@@ -559,7 +559,7 @@ func_cont:
}
}

- if (DSP_SUCCEEDED(status) && node_type != NODE_DEVICE) {
+ if (!status && node_type != NODE_DEVICE) {
/* Create a message queue for this node */
intf_fxns = hnode_mgr->intf_fxns;
status =
@@ -571,7 +571,7 @@ func_cont:
pnode);
}

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Create object for dynamic loading */

status = hnode_mgr->nldr_fxns.pfn_allocate(hnode_mgr->nldr_obj,
@@ -587,7 +587,7 @@ func_cont:
* STACKSEGLABEL, if yes read the Address of STACKSEGLABEL, calculate
* GPP Address, Read the value in that address and override the
* stack_seg value in task args */
- if (DSP_SUCCEEDED(status) &&
+ if (!status &&
(char *)pnode->dcd_props.obj_data.node_obj.ndb_props.
stack_seg_name != NULL) {
if (strcmp((char *)
@@ -635,7 +635,7 @@ func_cont:
}
}

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Add the node to the node manager's list of allocated
* nodes. */
lst_init_elem((struct list_head *)pnode);
@@ -653,7 +653,7 @@ func_cont:
* (for overlay and dll) */
pnode->phase_split = true;

- if (DSP_SUCCEEDED(status))
+ if (!status)
*ph_node = pnode;

/* Notify all clients registered for DSP_NODESTATECHANGE. */
@@ -665,13 +665,13 @@ func_cont:

}

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
drv_insert_node_res_element(*ph_node, &node_res, pr_ctxt);
drv_proc_node_update_heap_status(node_res, true);
drv_proc_node_update_status(node_res, true);
}
DBC_ENSURE((DSP_FAILED(status) && (*ph_node == NULL)) ||
- (DSP_SUCCEEDED(status) && *ph_node));
+ (!status && *ph_node));
func_end:
dev_dbg(bridge, "%s: hprocessor: %p node_uuid: %p pargs: %p attr_in:"
" %p ph_node: %p status: 0x%x\n", __func__, hprocessor,
@@ -730,7 +730,7 @@ DBAPI node_alloc_msg_buf(struct node_object *hnode, u32 usize,
status = cmm_xlator_info(pnode->xlator, pbuffer, usize,
pattr->segment_id, set_info);
}
- if (DSP_SUCCEEDED(status) && (!va_flag)) {
+ if (!status && (!va_flag)) {
if (pattr->segment_id != 1) {
/* Node supports single SM segment only. */
status = -EBADR;
@@ -749,7 +749,7 @@ DBAPI node_alloc_msg_buf(struct node_object *hnode, u32 usize,
status = -EPERM;
break;
}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* allocate physical buffer from seg_id in node's
* translator */
(void)cmm_xlator_alloc_buf(pnode->xlator, pbuffer,
@@ -815,7 +815,7 @@ int node_change_priority(struct node_object *hnode, s32 prio)
[RMSCHANGENODEPRIORITY],
hnode->node_env, prio);
}
- if (DSP_SUCCEEDED(status))
+ if (status >= 0)
NODE_SET_PRIORITY(hnode, prio);

}
@@ -857,7 +857,7 @@ int node_connect(struct node_object *node1, u32 stream1,
(node2 != (struct node_object *)DSP_HGPPNODE && !node2))
status = -EFAULT;

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* The two nodes must be on the same processor */
if (node1 != (struct node_object *)DSP_HGPPNODE &&
node2 != (struct node_object *)DSP_HGPPNODE &&
@@ -868,7 +868,7 @@ int node_connect(struct node_object *node1, u32 stream1,
status = -EPERM;

}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* node_get_type() will return NODE_GPP if hnode =
* DSP_HGPPNODE. */
node1_type = node_get_type(node1);
@@ -882,7 +882,7 @@ int node_connect(struct node_object *node1, u32 stream1,
MAX_INPUTS(node2)))
status = -EINVAL;
}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/*
* Only the following types of connections are allowed:
* task/dais socket < == > task/dais socket
@@ -900,7 +900,7 @@ int node_connect(struct node_object *node1, u32 stream1,
/*
* Check stream mode. Default is STRMMODE_PROCCOPY.
*/
- if (DSP_SUCCEEDED(status) && pattrs) {
+ if (!status && pattrs) {
if (pattrs->strm_mode != STRMMODE_PROCCOPY)
status = -EPERM; /* illegal stream mode */

@@ -924,7 +924,7 @@ int node_connect(struct node_object *node1, u32 stream1,
if (node2_type != NODE_GPP && node_get_state(node2) != NODE_ALLOCATED)
status = -EBADR;

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Check that stream indices for task and dais socket nodes
* are not already be used. (Device nodes checked later) */
if (node1_type == NODE_TASK || node1_type == NODE_DAISSOCKET) {
@@ -945,7 +945,7 @@ int node_connect(struct node_object *node1, u32 stream1,
}
}
/* Connecting two task nodes? */
- if (DSP_SUCCEEDED(status) && ((node1_type == NODE_TASK ||
+ if (!status && ((node1_type == NODE_TASK ||
node1_type == NODE_DAISSOCKET)
&& (node2_type == NODE_TASK
|| node2_type == NODE_DAISSOCKET))) {
@@ -981,7 +981,7 @@ int node_connect(struct node_object *node1, u32 stream1,
}
}
/* Connecting task node to host? */
- if (DSP_SUCCEEDED(status) && (node1_type == NODE_GPP ||
+ if (!status && (node1_type == NODE_GPP ||
node2_type == NODE_GPP)) {
if (node1_type == NODE_GPP) {
chnl_mode = CHNL_MODETODSP;
@@ -1047,7 +1047,7 @@ int node_connect(struct node_object *node1, u32 stream1,
}
status = -ENOMEM;
func_cont2:
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
if (node1 == (struct node_object *)DSP_HGPPNODE) {
node2->inputs[stream2].type = HOSTCONNECT;
node2->inputs[stream2].dev_id = chnl_id;
@@ -1061,7 +1061,7 @@ func_cont2:
}
}
/* Connecting task node to device node? */
- if (DSP_SUCCEEDED(status) && ((node1_type == NODE_DEVICE) ||
+ if (!status && ((node1_type == NODE_DEVICE) ||
(node2_type == NODE_DEVICE))) {
if (node2_type == NODE_DEVICE) {
/* node1 == > device */
@@ -1101,7 +1101,7 @@ func_cont2:
dev_node_obj->device_owner = hnode;
}
}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Fill in create args */
if (node1_type == NODE_TASK || node1_type == NODE_DAISSOCKET) {
node1->create_args.asa.task_arg_obj.num_outputs++;
@@ -1187,7 +1187,7 @@ int node_create(struct node_object *hnode)
if (node_get_state(hnode) != NODE_ALLOCATED)
status = -EBADR;

- if (DSP_SUCCEEDED(status))
+ if (!status)
status = proc_get_processor_id(pnode->hprocessor, &proc_id);

if (DSP_FAILED(status))
@@ -1203,7 +1203,7 @@ int node_create(struct node_object *hnode)
hnode->num_outputs - 1))
status = -ENOTCONN;

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* If node's create function is not loaded, load it */
/* Boost the OPP level to max level that DSP can be requested */
#if defined(CONFIG_TIDSPBRIDGE_DVFS) && !defined(CONFIG_CPU_FREQ)
@@ -1213,7 +1213,7 @@ int node_create(struct node_object *hnode)
status = hnode_mgr->nldr_fxns.pfn_load(hnode->nldr_node_obj,
NLDR_CREATE);
/* Get address of node's create function */
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
hnode->loaded = true;
if (node_type != NODE_DEVICE) {
status = get_fxn_address(hnode, &ul_create_fxn,
@@ -1229,7 +1229,7 @@ int node_create(struct node_object *hnode)
(*pdata->cpu_set_freq) (pdata->mpu_speed[VDD1_OPP1]);
#endif
/* Get address of iAlg functions, if socket node */
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
if (node_type == NODE_DAISSOCKET) {
status = hnode_mgr->nldr_fxns.pfn_get_fxn_addr
(hnode->nldr_node_obj,
@@ -1240,7 +1240,7 @@ int node_create(struct node_object *hnode)
}
}
}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
if (node_type != NODE_DEVICE) {
status = disp_node_create(hnode_mgr->disp_obj, hnode,
hnode_mgr->ul_fxn_addrs
@@ -1248,7 +1248,7 @@ int node_create(struct node_object *hnode)
ul_create_fxn,
&(hnode->create_args),
&(hnode->node_env));
- if (DSP_SUCCEEDED(status)) {
+ if (status >= 0) {
/* Set the message queue id to the node env
* pointer */
intf_fxns = hnode_mgr->intf_fxns;
@@ -1272,7 +1272,7 @@ int node_create(struct node_object *hnode)
__func__, status1);
func_cont2:
/* Update node state and node manager state */
- if (DSP_SUCCEEDED(status)) {
+ if (status >= 0) {
NODE_SET_STATE(hnode, NODE_CREATED);
hnode_mgr->num_created++;
goto func_cont;
@@ -1285,7 +1285,7 @@ func_cont:
/* Free access to node dispatcher */
mutex_unlock(&hnode_mgr->node_mgr_lock);
func_end:
- if (DSP_SUCCEEDED(status)) {
+ if (status >= 0) {
proc_notify_clients(hnode->hprocessor, DSP_NODESTATECHANGE);
ntfy_notify(hnode->ntfy_obj, DSP_NODESTATECHANGE);
}
@@ -1341,19 +1341,19 @@ int node_create_mgr(struct node_mgr **node_man,
status = -ENOMEM;
}
/* get devNodeType */
- if (DSP_SUCCEEDED(status))
+ if (!status)
status = dev_get_dev_type(hdev_obj, &dev_type);

/* Create the DCD Manager */
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
status =
dcd_create_manager(sz_zl_file, &node_mgr_obj->hdcd_mgr);
- if (DSP_SUCCEEDED(status))
+ if (!status)
status = get_proc_props(node_mgr_obj, hdev_obj);

}
/* Create NODE Dispatcher */
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
disp_attr_obj.ul_chnl_offset = node_mgr_obj->ul_chnl_offset;
disp_attr_obj.ul_chnl_buf_size = node_mgr_obj->ul_chnl_buf_size;
disp_attr_obj.proc_family = node_mgr_obj->proc_family;
@@ -1363,10 +1363,10 @@ int node_create_mgr(struct node_mgr **node_man,
&disp_attr_obj);
}
/* Create a STRM Manager */
- if (DSP_SUCCEEDED(status))
+ if (!status)
status = strm_create(&node_mgr_obj->strm_mgr_obj, hdev_obj);

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
dev_get_intf_fxns(hdev_obj, &node_mgr_obj->intf_fxns);
/* Get msg_ctrl queue manager */
dev_get_msg_mgr(hdev_obj, &node_mgr_obj->msg_mgr_obj);
@@ -1393,7 +1393,7 @@ int node_create_mgr(struct node_mgr **node_man,
node_mgr_obj->ul_chnl_offset + 1);
}
}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* NO RM Server on the IVA */
if (dev_type != IVA_UNIT) {
/* Get addresses of any RMS functions loaded */
@@ -1402,10 +1402,10 @@ int node_create_mgr(struct node_mgr **node_man,
}

/* Get loader functions and create loader */
- if (DSP_SUCCEEDED(status))
+ if (!status)
node_mgr_obj->nldr_fxns = nldr_fxns; /* Dyn loader funcs */

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
nldr_attrs_obj.pfn_ovly = ovly;
nldr_attrs_obj.pfn_write = mem_write;
nldr_attrs_obj.us_dsp_word_size = node_mgr_obj->udsp_word_size;
@@ -1416,13 +1416,13 @@ int node_create_mgr(struct node_mgr **node_man,
hdev_obj,
&nldr_attrs_obj);
}
- if (DSP_SUCCEEDED(status))
+ if (!status)
*node_man = node_mgr_obj;
else
delete_node_mgr(node_mgr_obj);

DBC_ENSURE((DSP_FAILED(status) && (*node_man == NULL)) ||
- (DSP_SUCCEEDED(status) && *node_man));
+ (!status && *node_man));

return status;
}
@@ -1506,7 +1506,7 @@ int node_delete(struct node_object *hnode,
status =
hnode_mgr->nldr_fxns.
pfn_load(hnode->nldr_node_obj, NLDR_DELETE);
- if (DSP_SUCCEEDED(status))
+ if (!status)
hnode->loaded = true;
else
pr_err("%s: fail - load delete code:"
@@ -1514,7 +1514,7 @@ int node_delete(struct node_object *hnode,
}
}
func_cont1:
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Unblock a thread trying to terminate the node */
(void)sync_set_event(hnode->sync_done);
if (proc_id == DSP_UNIT) {
@@ -1524,7 +1524,7 @@ func_cont1:
DELETEPHASE);
} else if (proc_id == IVA_UNIT)
ul_delete_fxn = (u32) hnode->node_env;
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
status = proc_get_state(hprocessor,
&proc_state,
sizeof(struct
@@ -1690,7 +1690,7 @@ int node_free_msg_buf(struct node_object *hnode, u8 * pbuffer,
}
status = proc_get_processor_id(pnode->hprocessor, &proc_id);
if (proc_id == DSP_UNIT) {
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
if (pattr == NULL) {
/* set defaults */
pattr = &node_dfltbufattrs;
@@ -1889,8 +1889,7 @@ int node_get_nldr_obj(struct node_mgr *hnode_mgr,
else
*nldr_ovlyobj = node_mgr_obj->nldr_obj;

- DBC_ENSURE(DSP_SUCCEEDED(status) || ((nldr_ovlyobj != NULL) &&
- (*nldr_ovlyobj == NULL)));
+ DBC_ENSURE(!status || (nldr_ovlyobj != NULL && *nldr_ovlyobj == NULL));
return status;
}

@@ -2039,7 +2038,7 @@ int node_pause(struct node_object *hnode)
if (proc_id == IVA_UNIT)
status = -ENOSYS;

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
hnode_mgr = hnode->hnode_mgr;

/* Enter critical section */
@@ -2068,14 +2067,14 @@ int node_pause(struct node_object *hnode)
hnode->node_env, NODE_SUSPENDEDPRI);

/* Update state */
- if (DSP_SUCCEEDED(status))
+ if (status >= 0)
NODE_SET_STATE(hnode, NODE_PAUSED);

func_cont:
/* End of sync_enter_cs */
/* Leave critical section */
mutex_unlock(&hnode_mgr->node_mgr_lock);
- if (DSP_SUCCEEDED(status)) {
+ if (status >= 0) {
proc_notify_clients(hnode->hprocessor,
DSP_NODESTATECHANGE);
ntfy_notify(hnode->ntfy_obj, DSP_NODESTATECHANGE);
@@ -2130,7 +2129,7 @@ int node_put_message(struct node_object *hnode,
node_type != NODE_DAISSOCKET)
status = -EPERM;

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Check node state. Can't send messages to a node after
* we've sent the RMS_EXIT command. There is still the
* possibility that node_terminate can be called after we've
@@ -2175,7 +2174,7 @@ int node_put_message(struct node_object *hnode,
status = -ESRCH;
}
}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
intf_fxns = hnode_mgr->intf_fxns;
status = (*intf_fxns->pfn_msg_put) (hnode->msg_queue_obj,
&new_msg, utimeout);
@@ -2217,7 +2216,7 @@ int node_register_notify(struct node_object *hnode, u32 event_mask,
if (event_mask == (DSP_NODESTATECHANGE | DSP_NODEMESSAGEREADY))
status = -EINVAL;
}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
if (event_mask == DSP_NODESTATECHANGE) {
status = ntfy_register(hnode->ntfy_obj, hnotification,
event_mask & DSP_NODESTATECHANGE,
@@ -2294,7 +2293,7 @@ int node_run(struct node_object *hnode)
if (state != NODE_CREATED && state != NODE_PAUSED)
status = -EBADR;

- if (DSP_SUCCEEDED(status))
+ if (!status)
status = proc_get_processor_id(pnode->hprocessor, &proc_id);

if (DSP_FAILED(status))
@@ -2309,14 +2308,14 @@ int node_run(struct node_object *hnode)
status =
hnode_mgr->nldr_fxns.pfn_load(hnode->nldr_node_obj,
NLDR_EXECUTE);
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
hnode->loaded = true;
} else {
pr_err("%s: fail - load execute code: 0x%x\n",
__func__, status);
}
}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Get address of node's execute function */
if (proc_id == IVA_UNIT)
ul_execute_fxn = (u32) hnode->node_env;
@@ -2325,7 +2324,7 @@ int node_run(struct node_object *hnode)
EXECUTEPHASE);
}
}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
ul_fxn_addr = hnode_mgr->ul_fxn_addrs[RMSEXECUTENODE];
status =
disp_node_run(hnode_mgr->disp_obj, hnode,
@@ -2343,14 +2342,14 @@ int node_run(struct node_object *hnode)
}
func_cont1:
/* Update node state. */
- if (DSP_SUCCEEDED(status))
+ if (status >= 0)
NODE_SET_STATE(hnode, NODE_RUNNING);
else /* Set state back to previous value */
NODE_SET_STATE(hnode, state);
/*End of sync_enter_cs */
/* Exit critical section */
mutex_unlock(&hnode_mgr->node_mgr_lock);
- if (DSP_SUCCEEDED(status)) {
+ if (status >= 0) {
proc_notify_clients(hnode->hprocessor, DSP_NODESTATECHANGE);
ntfy_notify(hnode->ntfy_obj, DSP_NODESTATECHANGE);
}
@@ -2391,13 +2390,13 @@ int node_terminate(struct node_object *hnode, int *pstatus)
}
status = proc_get_processor_id(pnode->hprocessor, &proc_id);

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
hnode_mgr = hnode->hnode_mgr;
node_type = node_get_type(hnode);
if (node_type != NODE_TASK && node_type != NODE_DAISSOCKET)
status = -EPERM;
}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Check node state */
mutex_lock(&hnode_mgr->node_mgr_lock);
state = node_get_state(hnode);
@@ -2414,7 +2413,7 @@ int node_terminate(struct node_object *hnode, int *pstatus)
/* end of sync_enter_cs */
mutex_unlock(&hnode_mgr->node_mgr_lock);
}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/*
* Send exit message. Do not change state to NODE_DONE
* here. That will be done in callback.
@@ -2476,7 +2475,7 @@ int node_terminate(struct node_object *hnode, int *pstatus)
}
}
func_cont:
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Enter CS before getting exit status, in case node was
* deleted. */
mutex_lock(&hnode_mgr->node_mgr_lock);
@@ -2903,7 +2902,7 @@ static int get_node_props(struct dcd_manager *hdcd_mgr,
status = dcd_get_object_def(hdcd_mgr, (struct dsp_uuid *)node_uuid,
DSP_DCDNODETYPE, dcd_prop);

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
hnode->ntype = node_type = pndb_props->ntype;

/* Create UUID value to set in registry. */
@@ -2935,7 +2934,7 @@ static int get_node_props(struct dcd_manager *hdcd_mgr,
}
}
}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Fill in create args that come from NDB */
if (node_type == NODE_TASK || node_type == NODE_DAISSOCKET) {
task_arg_obj = &(hnode->create_args.asa.task_arg_obj);
@@ -2973,7 +2972,7 @@ static int get_proc_props(struct node_mgr *hnode_mgr,
if (!pbridge_context)
status = -EFAULT;

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
host_res = pbridge_context->resources;
if (!host_res)
return -EPERM;
@@ -3058,7 +3057,7 @@ int node_get_uuid_props(void *hprocessor,
(struct dsp_uuid *)node_uuid, DSP_DCDNODETYPE,
(struct dcd_genericobj *)&dcd_node_props);

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
*node_props = dcd_node_props.ndb_props;
kfree(dcd_node_props.pstr_create_phase_fxn);

@@ -3148,12 +3147,12 @@ static u32 ovly(void *priv_ref, u32 dsp_run_addr, u32 dsp_load_addr,
/* Call new MemCopy function */
intf_fxns = hnode_mgr->intf_fxns;
status = dev_get_bridge_context(hnode_mgr->hdev_obj, &hbridge_context);
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
status =
(*intf_fxns->pfn_brd_mem_copy) (hbridge_context,
dsp_run_addr, dsp_load_addr,
ul_num_bytes, (u32) mem_space);
- if (DSP_SUCCEEDED(status))
+ if (!status)
ul_bytes = ul_num_bytes;
else
pr_debug("%s: failed to copy brd memory, status 0x%x\n",
@@ -3220,7 +3219,7 @@ int node_find_addr(struct node_mgr *node_mgr, u32 sym_addr,
status = nldr_find_addr(node_obj->nldr_node_obj, sym_addr,
offset_range, sym_addr_output, sym_name);

- if (DSP_SUCCEEDED(status))
+ if (!status)
break;

node_obj = (struct node_object *) (node_obj->list_elem.next);
diff --git a/drivers/staging/tidspbridge/rmgr/proc.c b/drivers/staging/tidspbridge/rmgr/proc.c
index 5f189dc..570927f 100644
--- a/drivers/staging/tidspbridge/rmgr/proc.c
+++ b/drivers/staging/tidspbridge/rmgr/proc.c
@@ -292,14 +292,14 @@ proc_attach(u32 processor_id,

/* Get the Driver and Manager Object Handles */
status = cfg_get_object((u32 *) &hdrv_obj, REG_DRV_OBJECT);
- if (DSP_SUCCEEDED(status))
+ if (!status)
status = cfg_get_object((u32 *) &hmgr_obj, REG_MGR_OBJECT);

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Get the Device Object */
status = drv_get_dev_object(processor_id, hdrv_obj, &hdev_obj);
}
- if (DSP_SUCCEEDED(status))
+ if (!status)
status = dev_get_dev_type(hdev_obj, &dev_type);

if (DSP_FAILED(status))
@@ -326,7 +326,7 @@ proc_attach(u32 processor_id,
p_proc_object->utimeout = PROC_DFLT_TIMEOUT;

status = dev_get_intf_fxns(hdev_obj, &p_proc_object->intf_fxns);
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
status = dev_get_bridge_context(hdev_obj,
&p_proc_object->hbridge_context);
if (DSP_FAILED(status))
@@ -348,7 +348,7 @@ proc_attach(u32 processor_id,
else
status = -ENOMEM;

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Insert the Processor Object into the DEV List.
* Return handle to this Processor Object:
* Find out if the Device is already attached to a
@@ -358,7 +358,7 @@ proc_attach(u32 processor_id,
(u32) p_proc_object,
&p_proc_object->
is_already_attached);
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
if (p_proc_object->is_already_attached)
status = 0;
} else {
@@ -369,7 +369,7 @@ proc_attach(u32 processor_id,

kfree(p_proc_object);
}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
*ph_processor = (void *)p_proc_object;
pr_ctxt->hprocessor = *ph_processor;
(void)proc_notify_clients(p_proc_object,
@@ -381,7 +381,7 @@ proc_attach(u32 processor_id,
}
func_end:
DBC_ENSURE((status == -EPERM && *ph_processor == NULL) ||
- (DSP_SUCCEEDED(status) && p_proc_object) ||
+ (!status && p_proc_object) ||
(status == 0 && p_proc_object));

return status;
@@ -448,7 +448,7 @@ int proc_auto_start(struct cfg_devnode *dev_node_obj,
p_proc_object->hdev_obj = hdev_obj;
p_proc_object->hmgr_obj = hmgr_obj;
status = dev_get_intf_fxns(hdev_obj, &p_proc_object->intf_fxns);
- if (DSP_SUCCEEDED(status))
+ if (!status)
status = dev_get_bridge_context(hdev_obj,
&p_proc_object->hbridge_context);
if (DSP_FAILED(status))
@@ -465,12 +465,12 @@ int proc_auto_start(struct cfg_devnode *dev_node_obj,
p_proc_object->processor_id = dev_type;
status = get_exec_file(dev_node_obj, hdev_obj, sizeof(sz_exec_file),
sz_exec_file);
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
argv[0] = sz_exec_file;
argv[1] = NULL;
/* ...and try to load it: */
status = proc_load(p_proc_object, 1, (const char **)argv, NULL);
- if (DSP_SUCCEEDED(status))
+ if (!status)
status = proc_start(p_proc_object);
}
kfree(p_proc_object->psz_last_coff);
@@ -522,7 +522,7 @@ int proc_ctrl(void *hprocessor, u32 dw_cmd, struct dsp_cbdata * arg)
/* timeout = arg->cb_data; */
status = pwr_wake_dsp(timeout);
} else
- if (DSP_SUCCEEDED((*p_proc_object->intf_fxns->pfn_dev_cntrl)
+ if (!((*p_proc_object->intf_fxns->pfn_dev_cntrl)
(p_proc_object->hbridge_context, dw_cmd,
arg))) {
status = 0;
@@ -595,7 +595,7 @@ int proc_enum_nodes(void *hprocessor, void **node_tab,
DBC_REQUIRE(pu_allocated != NULL);

if (p_proc_object) {
- if (DSP_SUCCEEDED(dev_get_node_manager(p_proc_object->hdev_obj,
+ if (!(dev_get_node_manager(p_proc_object->hdev_obj,
&hnode_mgr))) {
if (hnode_mgr) {
status = node_enum_nodes(hnode_mgr, node_tab,
@@ -880,7 +880,7 @@ int proc_get_resource_info(void *hprocessor, u32 resource_type,
}

status = node_get_nldr_obj(hnode_mgr, &nldr_obj);
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
status = nldr_get_rmm_manager(nldr_obj, &rmm);
if (rmm) {
if (!rmm_stat(rmm,
@@ -952,7 +952,7 @@ int proc_get_dev_object(void *hprocessor,
status = -EFAULT;
}

- DBC_ENSURE((DSP_SUCCEEDED(status) && *device_obj != NULL) ||
+ DBC_ENSURE((!status && *device_obj != NULL) ||
(DSP_FAILED(status) && *device_obj == NULL));

return status;
@@ -979,7 +979,7 @@ int proc_get_state(void *hprocessor,
/* First, retrieve BRD state information */
status = (*p_proc_object->intf_fxns->pfn_brd_status)
(p_proc_object->hbridge_context, &brd_status);
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
switch (brd_status) {
case BRD_STOPPED:
proc_state_obj->proc_state = PROC_STOPPED;
@@ -1131,7 +1131,7 @@ int proc_load(void *hprocessor, const s32 argc_index,
/* Get the DCD Handle */
status = mgr_get_dcd_handle(p_proc_object->hmgr_obj,
(u32 *) &hdcd_handle);
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Before proceeding with new load,
* check if a previously registered COFF
* exists.
@@ -1157,12 +1157,12 @@ int proc_load(void *hprocessor, const s32 argc_index,
} else {
status = -ENOMEM;
}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Auto-register data base */
/* Get the DCD Handle */
status = mgr_get_dcd_handle(p_proc_object->hmgr_obj,
(u32 *) &hdcd_handle);
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Auto register nodes in specified COFF
* file. If registration did not fail,
* (status = 0 or -EACCES)
@@ -1194,18 +1194,18 @@ int proc_load(void *hprocessor, const s32 argc_index,
}
}
/* Update shared memory address and size */
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Create the message manager. This must be done
* before calling the IOOnLoaded function. */
dev_get_msg_mgr(p_proc_object->hdev_obj, &hmsg_mgr);
if (!hmsg_mgr) {
status = msg_create(&hmsg_mgr, p_proc_object->hdev_obj,
(msg_onexit) node_on_exit);
- DBC_ASSERT(DSP_SUCCEEDED(status));
+ DBC_ASSERT(!status);
dev_set_msg_mgr(p_proc_object->hdev_obj, hmsg_mgr);
}
}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Set the Device object's message manager */
status = dev_get_io_mgr(p_proc_object->hdev_obj, &hio_mgr);
if (hio_mgr)
@@ -1214,7 +1214,7 @@ int proc_load(void *hprocessor, const s32 argc_index,
else
status = -EFAULT;
}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Now, attempt to load an exec: */

/* Boost the OPP level to Maximum level supported by baseport */
@@ -1242,28 +1242,28 @@ int proc_load(void *hprocessor, const s32 argc_index,
#endif

}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Update the Processor status to loaded */
status = (*p_proc_object->intf_fxns->pfn_brd_set_state)
(p_proc_object->hbridge_context, BRD_LOADED);
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
p_proc_object->proc_state = PROC_LOADED;
if (p_proc_object->ntfy_obj)
proc_notify_clients(p_proc_object,
DSP_PROCESSORSTATECHANGE);
}
}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
status = proc_get_processor_id(hprocessor, &proc_id);
if (proc_id == DSP_UNIT) {
/* Use all available DSP address space after EXTMEM
* for DMM */
- if (DSP_SUCCEEDED(status))
+ if (!status)
status = cod_get_sym_value(cod_mgr, EXTEND,
&dw_ext_end);

/* Reset DMM structs and add an initial free chunk */
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
status =
dev_get_dmm_mgr(p_proc_object->hdev_obj,
&dmm_mgr);
@@ -1285,8 +1285,8 @@ int proc_load(void *hprocessor, const s32 argc_index,
/* Restore the original argv[0] */
kfree(new_envp);
user_args[0] = pargv0;
- if (DSP_SUCCEEDED(status)) {
- if (DSP_SUCCEEDED((*p_proc_object->intf_fxns->pfn_brd_status)
+ if (!status) {
+ if (!((*p_proc_object->intf_fxns->pfn_brd_status)
(p_proc_object->hbridge_context, &brd_state))) {
pr_info("%s: Processor Loaded %s\n", __func__, pargv0);
kfree(drv_datap->base_img);
@@ -1305,7 +1305,7 @@ func_end:
if (DSP_FAILED(status))
pr_err("%s: Processor failed to load\n", __func__);

- DBC_ENSURE((DSP_SUCCEEDED(status)
+ DBC_ENSURE((!status
&& p_proc_object->proc_state == PROC_LOADED)
|| DSP_FAILED(status));
#ifdef OPT_LOAD_TIME_INSTRUMENTATION
@@ -1368,7 +1368,7 @@ int proc_map(void *hprocessor, void *pmpu_addr, u32 ul_size,
status = -EFAULT;

/* Add mapping to the page tables. */
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {

/* Mapped address = MSB of VA | LSB of PA */
tmp_addr = (va_align | ((u32) pmpu_addr & (PG_SIZE4K - 1)));
@@ -1382,7 +1382,7 @@ int proc_map(void *hprocessor, void *pmpu_addr, u32 ul_size,
(p_proc_object->hbridge_context, pa_align, va_align,
size_align, ul_map_attr, map_obj->pages);
}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Mapped address = MSB of VA | LSB of PA */
*pp_map_addr = (void *) tmp_addr;
} else {
@@ -1436,7 +1436,7 @@ int proc_register_notify(void *hprocessor, u32 event_mask,
if (notify_type != DSP_SIGNALEVENT)
status = -EINVAL;

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* If event mask is not DSP_SYSERROR, DSP_MMUFAULT,
* or DSP_PWRERROR then register event immediately. */
if (event_mask &
@@ -1568,7 +1568,7 @@ int proc_start(void *hprocessor)

/* Call dev_create2 */
status = dev_create2(p_proc_object->hdev_obj);
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
p_proc_object->proc_state = PROC_RUNNING;
/* Deep sleep switces off the peripheral clocks.
* we just put the DSP CPU in idle in the idle loop.
@@ -1586,8 +1586,8 @@ int proc_start(void *hprocessor)
p_proc_object->proc_state = PROC_STOPPED;
}
func_cont:
- if (DSP_SUCCEEDED(status)) {
- if (DSP_SUCCEEDED((*p_proc_object->intf_fxns->pfn_brd_status)
+ if (!status) {
+ if (!((*p_proc_object->intf_fxns->pfn_brd_status)
(p_proc_object->hbridge_context, &brd_state))) {
pr_info("%s: dsp in running state\n", __func__);
DBC_ASSERT(brd_state != BRD_HIBERNATION);
@@ -1597,7 +1597,7 @@ func_cont:
}

func_end:
- DBC_ENSURE((DSP_SUCCEEDED(status) && p_proc_object->proc_state ==
+ DBC_ENSURE((!status && p_proc_object->proc_state ==
PROC_RUNNING) || DSP_FAILED(status));
return status;
}
@@ -1626,7 +1626,7 @@ int proc_stop(void *hprocessor)
}
/* check if there are any running nodes */
status = dev_get_node_manager(p_proc_object->hdev_obj, &hnode_mgr);
- if (DSP_SUCCEEDED(status) && hnode_mgr) {
+ if (!status && hnode_mgr) {
status = node_enum_nodes(hnode_mgr, &hnode, node_tab_size,
&num_nodes, &nodes_allocated);
if ((status == -EINVAL) || (nodes_allocated > 0)) {
@@ -1640,19 +1640,18 @@ int proc_stop(void *hprocessor)
status =
(*p_proc_object->intf_fxns->
pfn_brd_stop) (p_proc_object->hbridge_context);
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
dev_dbg(bridge, "%s: processor in standby mode\n", __func__);
p_proc_object->proc_state = PROC_STOPPED;
/* Destory the Node Manager, msg_ctrl Manager */
- if (DSP_SUCCEEDED(dev_destroy2(p_proc_object->hdev_obj))) {
+ if (!(dev_destroy2(p_proc_object->hdev_obj))) {
/* Destroy the msg_ctrl by calling msg_delete */
dev_get_msg_mgr(p_proc_object->hdev_obj, &hmsg_mgr);
if (hmsg_mgr) {
msg_delete(hmsg_mgr);
dev_set_msg_mgr(p_proc_object->hdev_obj, NULL);
}
- if (DSP_SUCCEEDED
- ((*p_proc_object->
+ if (!((*p_proc_object->
intf_fxns->pfn_brd_status) (p_proc_object->
hbridge_context,
&brd_state)))
@@ -1700,7 +1699,7 @@ int proc_un_map(void *hprocessor, void *map_addr,
*/
status = dmm_un_map_memory(dmm_mgr, (u32) va_align, &size_align);
/* Remove mapping from the page tables. */
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
status = (*p_proc_object->intf_fxns->pfn_brd_mem_un_map)
(p_proc_object->hbridge_context, va_align, size_align);
}
@@ -1800,7 +1799,7 @@ static int proc_monitor(struct proc_object *proc_obj)
/* This is needed only when Device is loaded when it is
* already 'ACTIVE' */
/* Destory the Node Manager, msg_ctrl Manager */
- if (DSP_SUCCEEDED(dev_destroy2(proc_obj->hdev_obj))) {
+ if (!dev_destroy2(proc_obj->hdev_obj)) {
/* Destroy the msg_ctrl by calling msg_delete */
dev_get_msg_mgr(proc_obj->hdev_obj, &hmsg_mgr);
if (hmsg_mgr) {
@@ -1809,15 +1808,15 @@ static int proc_monitor(struct proc_object *proc_obj)
}
}
/* Place the Board in the Monitor State */
- if (DSP_SUCCEEDED((*proc_obj->intf_fxns->pfn_brd_monitor)
+ if (!((*proc_obj->intf_fxns->pfn_brd_monitor)
(proc_obj->hbridge_context))) {
status = 0;
- if (DSP_SUCCEEDED((*proc_obj->intf_fxns->pfn_brd_status)
+ if (!((*proc_obj->intf_fxns->pfn_brd_status)
(proc_obj->hbridge_context, &brd_state)))
DBC_ASSERT(brd_state == BRD_IDLE);
}

- DBC_ENSURE((DSP_SUCCEEDED(status) && brd_state == BRD_IDLE) ||
+ DBC_ENSURE((!status && brd_state == BRD_IDLE) ||
DSP_FAILED(status));
return status;
}
diff --git a/drivers/staging/tidspbridge/rmgr/pwr.c b/drivers/staging/tidspbridge/rmgr/pwr.c
index 13f5ed6..69c2e19 100644
--- a/drivers/staging/tidspbridge/rmgr/pwr.c
+++ b/drivers/staging/tidspbridge/rmgr/pwr.c
@@ -91,12 +91,10 @@ int pwr_wake_dsp(const u32 timeout)
hdev_obj != NULL;
hdev_obj = (struct dev_object *)drv_get_next_dev_object
((u32) hdev_obj)) {
- if (DSP_SUCCEEDED(dev_get_bridge_context(hdev_obj,
+ if (!(dev_get_bridge_context(hdev_obj,
(struct bridge_dev_context
**)&dw_context))) {
- if (DSP_SUCCEEDED
- (dev_get_intf_fxns
- (hdev_obj,
+ if (!(dev_get_intf_fxns(hdev_obj,
(struct bridge_drv_interface **)&intf_fxns))) {
status =
(*intf_fxns->pfn_dev_cntrl) (dw_context,
@@ -127,12 +125,10 @@ int pwr_pm_pre_scale(u16 voltage_domain, u32 level)
hdev_obj != NULL;
hdev_obj = (struct dev_object *)drv_get_next_dev_object
((u32) hdev_obj)) {
- if (DSP_SUCCEEDED(dev_get_bridge_context(hdev_obj,
+ if (!(dev_get_bridge_context(hdev_obj,
(struct bridge_dev_context
**)&dw_context))) {
- if (DSP_SUCCEEDED
- (dev_get_intf_fxns
- (hdev_obj,
+ if (!(dev_get_intf_fxns(hdev_obj,
(struct bridge_drv_interface **)&intf_fxns))) {
status =
(*intf_fxns->pfn_dev_cntrl) (dw_context,
@@ -163,12 +159,10 @@ int pwr_pm_post_scale(u16 voltage_domain, u32 level)
hdev_obj != NULL;
hdev_obj = (struct dev_object *)drv_get_next_dev_object
((u32) hdev_obj)) {
- if (DSP_SUCCEEDED(dev_get_bridge_context(hdev_obj,
+ if (!(dev_get_bridge_context(hdev_obj,
(struct bridge_dev_context
**)&dw_context))) {
- if (DSP_SUCCEEDED
- (dev_get_intf_fxns
- (hdev_obj,
+ if (!(dev_get_intf_fxns(hdev_obj,
(struct bridge_drv_interface **)&intf_fxns))) {
status =
(*intf_fxns->pfn_dev_cntrl) (dw_context,
diff --git a/drivers/staging/tidspbridge/rmgr/rmm.c b/drivers/staging/tidspbridge/rmgr/rmm.c
index 6db9ace..633d441 100644
--- a/drivers/staging/tidspbridge/rmgr/rmm.c
+++ b/drivers/staging/tidspbridge/rmgr/rmm.c
@@ -139,7 +139,7 @@ int rmm_alloc(struct rmm_target_obj *target, u32 segid, u32 size,
(struct list_head *)
sect);
}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* No overlap - allocate list element for new section. */
new_sect = kzalloc(sizeof(struct rmm_ovly_sect), GFP_KERNEL);
if (new_sect == NULL) {
@@ -230,7 +230,7 @@ int rmm_create(struct rmm_target_obj **target_obj,
}
func_cont:
/* Initialize overlay memory list */
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
target->ovly_list = kzalloc(sizeof(struct lst_list),
GFP_KERNEL);
if (target->ovly_list == NULL)
@@ -239,7 +239,7 @@ func_cont:
INIT_LIST_HEAD(&target->ovly_list->head);
}

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
*target_obj = target;
} else {
*target_obj = NULL;
@@ -248,7 +248,7 @@ func_cont:

}

- DBC_ENSURE((DSP_SUCCEEDED(status) && *target_obj)
+ DBC_ENSURE((!status && *target_obj)
|| (DSP_FAILED(status) && *target_obj == NULL));

return status;
diff --git a/drivers/staging/tidspbridge/rmgr/strm.c b/drivers/staging/tidspbridge/rmgr/strm.c
index 6c184c6..35d6378 100644
--- a/drivers/staging/tidspbridge/rmgr/strm.c
+++ b/drivers/staging/tidspbridge/rmgr/strm.c
@@ -172,7 +172,7 @@ int strm_close(struct strm_object *stream_obj,
status =
(*intf_fxns->pfn_chnl_get_info) (stream_obj->chnl_obj,
&chnl_info_obj);
- DBC_ASSERT(DSP_SUCCEEDED(status));
+ DBC_ASSERT(!status);

if (chnl_info_obj.cio_cs > 0 || chnl_info_obj.cio_reqs > 0)
status = -EPIPE;
@@ -219,21 +219,21 @@ int strm_create(struct strm_mgr **strm_man,
strm_mgr_obj->dev_obj = dev_obj;

/* Get Channel manager and Bridge function interface */
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
status = dev_get_chnl_mgr(dev_obj, &(strm_mgr_obj->hchnl_mgr));
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
(void)dev_get_intf_fxns(dev_obj,
&(strm_mgr_obj->intf_fxns));
DBC_ASSERT(strm_mgr_obj->intf_fxns != NULL);
}
}

- if (DSP_SUCCEEDED(status))
+ if (!status)
*strm_man = strm_mgr_obj;
else
kfree(strm_mgr_obj);

- DBC_ENSURE((DSP_SUCCEEDED(status) && *strm_man) ||
+ DBC_ENSURE((!status && *strm_man) ||
(DSP_FAILED(status) && *strm_man == NULL));

return status;
@@ -285,7 +285,7 @@ int strm_free_buffer(struct strm_object *stream_obj, u8 ** ap_buffer,
if (!stream_obj)
status = -EFAULT;

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
for (i = 0; i < num_bufs; i++) {
DBC_ASSERT(stream_obj->xlator != NULL);
status =
@@ -445,7 +445,7 @@ int strm_issue(struct strm_object *stream_obj, u8 *pbuf, u32 ul_bytes,
status = -ESRCH;

}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
status = (*intf_fxns->pfn_chnl_add_io_req)
(stream_obj->chnl_obj, pbuf, ul_bytes, ul_buf_size,
(u32) tmp_buf, dw_arg);
@@ -492,10 +492,10 @@ int strm_open(struct node_object *hnode, u32 dir, u32 index,
/* Get the channel id from the node (set in node_connect()) */
status = node_get_channel_id(hnode, dir, index, &ul_chnl_id);
}
- if (DSP_SUCCEEDED(status))
+ if (!status)
status = node_get_strm_mgr(hnode, &strm_mgr_obj);

- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
strm_obj = kzalloc(sizeof(struct strm_object), GFP_KERNEL);
if (strm_obj == NULL) {
status = -ENOMEM;
@@ -550,10 +550,10 @@ int strm_open(struct node_object *hnode, u32 dir, u32 index,
DBC_ASSERT(strm_obj->strm_mode != STRMMODE_LDMA);
/* Get the shared mem mgr for this streams dev object */
status = dev_get_cmm_mgr(strm_mgr_obj->dev_obj, &hcmm_mgr);
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/*Allocate a SM addr translator for this strm. */
status = cmm_xlator_create(&strm_obj->xlator, hcmm_mgr, NULL);
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
DBC_ASSERT(strm_obj->segment_id > 0);
/* Set translators Virt Addr attributes */
status = cmm_xlator_info(strm_obj->xlator,
@@ -563,7 +563,7 @@ int strm_open(struct node_object *hnode, u32 dir, u32 index,
}
}
func_cont:
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Open channel */
chnl_mode = (dir == DSP_TONODE) ?
CHNL_MODETODSP : CHNL_MODEFROMDSP;
@@ -594,7 +594,7 @@ func_cont:
}
}
}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
*strm_objct = strm_obj;
drv_proc_insert_strm_res_element(*strm_objct, &hstrm_res,
pr_ctxt);
@@ -603,7 +603,7 @@ func_cont:
}

/* ensure we return a documented error code */
- DBC_ENSURE((DSP_SUCCEEDED(status) && *strm_objct) ||
+ DBC_ENSURE((!status && *strm_objct) ||
(*strm_objct == NULL && (status == -EFAULT ||
status == -EPERM
|| status == -EINVAL)));
@@ -642,7 +642,7 @@ int strm_reclaim(struct strm_object *stream_obj, u8 ** buf_ptr,
(*intf_fxns->pfn_chnl_get_ioc) (stream_obj->chnl_obj,
stream_obj->utimeout,
&chnl_ioc_obj);
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
*nbytes = chnl_ioc_obj.byte_size;
if (buff_size)
*buff_size = chnl_ioc_obj.buf_size;
@@ -659,7 +659,7 @@ int strm_reclaim(struct strm_object *stream_obj, u8 ** buf_ptr,
}
}
/* Translate zerocopy buffer if channel not canceled. */
- if (DSP_SUCCEEDED(status)
+ if (!status
&& (!CHNL_IS_IO_CANCELLED(chnl_ioc_obj))
&& (stream_obj->strm_mode == STRMMODE_ZEROCOPY)) {
/*
@@ -688,7 +688,7 @@ int strm_reclaim(struct strm_object *stream_obj, u8 ** buf_ptr,
}
func_end:
/* ensure we return a documented return code */
- DBC_ENSURE(DSP_SUCCEEDED(status) || status == -EFAULT ||
+ DBC_ENSURE(!status || status == -EFAULT ||
status == -ETIME || status == -ESRCH ||
status == -EPERM);

@@ -723,7 +723,7 @@ int strm_register_notify(struct strm_object *stream_obj, u32 event_mask,
status = -ENOSYS;

}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
intf_fxns = stream_obj->strm_mgr_obj->intf_fxns;

status =
@@ -734,7 +734,7 @@ int strm_register_notify(struct strm_object *stream_obj, u32 event_mask,
hnotification);
}
/* ensure we return a documented return code */
- DBC_ENSURE(DSP_SUCCEEDED(status) || status == -EFAULT ||
+ DBC_ENSURE(!status || status == -EFAULT ||
status == -ETIME || status == -ESRCH ||
status == -ENOSYS || status == -EPERM);
return status;
@@ -783,7 +783,7 @@ int strm_select(struct strm_object **strm_tab, u32 strms,

}
}
- if (DSP_SUCCEEDED(status) && utimeout > 0 && *pmask == 0) {
+ if (!status && utimeout > 0 && *pmask == 0) {
/* Non-zero timeout */
sync_events = kmalloc(strms * sizeof(struct sync_object *),
GFP_KERNEL);
@@ -804,11 +804,11 @@ int strm_select(struct strm_object **strm_tab, u32 strms,

}
}
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
status =
sync_wait_on_multiple_events(sync_events, strms,
utimeout, &index);
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
/* Since we waited on the event, we have to
* reset it */
sync_set_event(sync_events[index]);
@@ -819,7 +819,7 @@ int strm_select(struct strm_object **strm_tab, u32 strms,
func_end:
kfree(sync_events);

- DBC_ENSURE((DSP_SUCCEEDED(status) && (*pmask != 0 || utimeout == 0)) ||
+ DBC_ENSURE((!status && (*pmask != 0 || utimeout == 0)) ||
(DSP_FAILED(status) && *pmask == 0));

return status;
@@ -843,7 +843,7 @@ static int delete_strm(struct strm_object *stream_obj)
status = (*intf_fxns->pfn_chnl_close)
(stream_obj->chnl_obj);
/* Free all SM address translator resources */
- if (DSP_SUCCEEDED(status)) {
+ if (!status) {
if (stream_obj->xlator) {
/* force free */
(void)cmm_xlator_delete(stream_obj->
--
1.5.4.5

2010-07-28 14:43:08

by Ernesto Ramos

[permalink] [raw]
Subject: [PATCH 10/10] staging:ti dspbridge: remove DSP_FAILED macro definition

Since status succeeded is now 0 macro DSP_FAILED
is not necessary anymore. This patch removes this
define.

Signed-off-by: Ernesto Ramos <[email protected]>
---
.../staging/tidspbridge/include/dspbridge/dbdefs.h | 3 ---
1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/tidspbridge/include/dspbridge/dbdefs.h b/drivers/staging/tidspbridge/include/dspbridge/dbdefs.h
index 2ccbfe1..5af075d 100644
--- a/drivers/staging/tidspbridge/include/dspbridge/dbdefs.h
+++ b/drivers/staging/tidspbridge/include/dspbridge/dbdefs.h
@@ -91,9 +91,6 @@
#define DSPWORD unsigned char
#define DSPWORDSIZE sizeof(DSPWORD)

-/* Failure macro */
-#define DSP_FAILED(status) unlikely((s32)(status) < 0)
-
/* Power control enumerations */
#define PROC_PWRCONTROL 0x8070

--
1.5.4.5

2010-07-30 15:16:53

by Ohad Ben Cohen

[permalink] [raw]
Subject: Re: [PATCH 00/10] staging:ti dspbridge: Remove DSP_FAILED and DSP_SUCCEEDED macros

Hi Ernesto,

On Wed, Jul 28, 2010 at 5:45 PM, Ernesto Ramos <[email protected]> wrote:
> This series of patches is targetted to remove macros DSP_FAILED
> and DSP_SUCCEEDED since bridge driver currently uses standard kernel
> error codes.

These macros were often used to test for success, instead for errors.

This often leads to dspbridge code being highly nested, and hard to
read. The excessive indentation sometimes even lead to longer lines,
which were broken to meet the 80-chars recommendation, where the real
problem is actually the redundant indentation (e.g. check out this
patch http://www.mail-archive.com/[email protected]/msg26700.html).

E.g. the following error testing is very common in the bridge code:

do_something1();
if (success) {
do_something2();
if (success) {
do_something3();
....
}
}

The kernel alternative would be to check for errors, and take error
paths out of the code flow, e.g.:

do_something1();
if (error)
leave;

do_something2();
if (error)
leave;

do_something3();
if (error)
leave;

This leads to code which is much more easier to read.

If you could hunt some of those highly nested areas and make them test
for error instead of success, it can be really great.

Thanks,
Ohad.

>
> Ernesto Ramos (10):
> ?staging:ti dspbridge: remove DSP_SUCCEEDED macro from core
> ?staging:ti dspbridge: remove DSP_SUCCEEDED macro from pmgr
> ?staging:ti dspbridge: remove DSP_SUCCEEDED macro from rmgr
> ?staging:ti dspbridge: remove DSP_SUCCEEDED macro from services
> ?staging:ti dspbridge: remove DSP_SUCCEEDED macro definition
> ?staging:ti dspbridge: remove DSP_FAILED macro from core
> ?staging:ti dspbridge: remove DSP_FAILED macro from pmgr
> ?staging:ti dspbridge: remove DSP_FAILED macro from rmgr
> ?staging:ti dspbridge: remove DSP_FAILED macro from services
> ?staging:ti dspbridge: remove DSP_FAILED macro definition
>
> ?drivers/staging/tidspbridge/core/chnl_sm.c ? ? ? ? | ? 42 ++--
> ?drivers/staging/tidspbridge/core/dsp-clock.c ? ? ? | ? ?4 +-
> ?drivers/staging/tidspbridge/core/io_sm.c ? ? ? ? ? | ?111 +++++-----
> ?drivers/staging/tidspbridge/core/msg_sm.c ? ? ? ? ?| ? 26 ++--
> ?drivers/staging/tidspbridge/core/tiomap3430.c ? ? ?| ? 61 +++---
> ?drivers/staging/tidspbridge/core/tiomap3430_pwr.c ?| ? ?8 +-
> ?drivers/staging/tidspbridge/core/tiomap_io.c ? ? ? | ? 41 ++--
> ?.../staging/tidspbridge/include/dspbridge/dbdefs.h | ? ?4 -
> ?drivers/staging/tidspbridge/pmgr/chnl.c ? ? ? ? ? ?| ? 10 +-
> ?drivers/staging/tidspbridge/pmgr/cmm.c ? ? ? ? ? ? | ?137 ++++++-------
> ?drivers/staging/tidspbridge/pmgr/cod.c ? ? ? ? ? ? | ? 18 +-
> ?drivers/staging/tidspbridge/pmgr/dbll.c ? ? ? ? ? ?| ? 32 ++--
> ?drivers/staging/tidspbridge/pmgr/dev.c ? ? ? ? ? ? | ? 79 +++----
> ?drivers/staging/tidspbridge/pmgr/dmm.c ? ? ? ? ? ? | ? 12 +-
> ?drivers/staging/tidspbridge/pmgr/dspapi.c ? ? ? ? ?| ? 82 ++++----
> ?drivers/staging/tidspbridge/pmgr/io.c ? ? ? ? ? ? ?| ? ?4 +-
> ?drivers/staging/tidspbridge/pmgr/msg.c ? ? ? ? ? ? | ? ?2 +-
> ?drivers/staging/tidspbridge/rmgr/dbdcd.c ? ? ? ? ? | ? 48 ++--
> ?drivers/staging/tidspbridge/rmgr/disp.c ? ? ? ? ? ?| ? 62 +++---
> ?drivers/staging/tidspbridge/rmgr/drv.c ? ? ? ? ? ? | ? 39 ++--
> ?drivers/staging/tidspbridge/rmgr/drv_interface.c ? | ? 10 +-
> ?drivers/staging/tidspbridge/rmgr/dspdrv.c ? ? ? ? ?| ? 16 +-
> ?drivers/staging/tidspbridge/rmgr/mgr.c ? ? ? ? ? ? | ? 32 ++--
> ?drivers/staging/tidspbridge/rmgr/nldr.c ? ? ? ? ? ?| ?106 +++++-----
> ?drivers/staging/tidspbridge/rmgr/node.c ? ? ? ? ? ?| ?224 ++++++++++----------
> ?drivers/staging/tidspbridge/rmgr/proc.c ? ? ? ? ? ?| ?137 ++++++------
> ?drivers/staging/tidspbridge/rmgr/pwr.c ? ? ? ? ? ? | ? 26 +--
> ?drivers/staging/tidspbridge/rmgr/rmm.c ? ? ? ? ? ? | ? 12 +-
> ?drivers/staging/tidspbridge/rmgr/strm.c ? ? ? ? ? ?| ? 75 ++++----
> ?drivers/staging/tidspbridge/services/cfg.c ? ? ? ? | ? 21 +-
> ?30 files changed, 710 insertions(+), 771 deletions(-)
>
>