Skip to content

Commit

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

Signed-off-by: Ernesto Ramos <ernesto@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Ernesto Ramos authored and Greg Kroah-Hartman committed Jul 28, 2010
1 parent ecd3d0c commit e6486d8
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 108 deletions.
22 changes: 10 additions & 12 deletions drivers/staging/tidspbridge/core/chnl_sm.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,23 +170,23 @@ int bridge_chnl_add_io_req(struct chnl_object *chnl_obj, void *host_buf,
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))
status = -EINVAL;

}
}
if (DSP_SUCCEEDED(status)) {
if (!status) {
/* Get a free chirp: */
chnl_packet_obj =
(struct chnl_irp *)lst_get_head(pchnl->free_packets_list);
if (chnl_packet_obj == NULL)
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;
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -499,16 +498,15 @@ 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. */
if (CHNL_IS_OUTPUT(chnl_mode)
&& (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))
Expand Down Expand Up @@ -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)
Expand All @@ -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: */
Expand Down Expand Up @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions drivers/staging/tidspbridge/core/dsp-clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
47 changes: 22 additions & 25 deletions drivers/staging/tidspbridge/core/io_sm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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 {
Expand All @@ -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);
Expand All @@ -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,
Expand Down Expand Up @@ -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);
Expand All @@ -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,
Expand All @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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",
Expand All @@ -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);
Expand All @@ -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
Expand All @@ -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) &&
Expand All @@ -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)
Expand Down
22 changes: 11 additions & 11 deletions drivers/staging/tidspbridge/core/msg_sm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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);
}
Expand Down Expand Up @@ -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. */
Expand All @@ -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 */
Expand Down Expand Up @@ -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;
Expand Down
Loading

0 comments on commit e6486d8

Please sign in to comment.