diff options
Diffstat (limited to 'drivers/staging/tidspbridge/rmgr')
-rw-r--r-- | drivers/staging/tidspbridge/rmgr/drv.c | 70 | ||||
-rw-r--r-- | drivers/staging/tidspbridge/rmgr/proc.c | 12 | ||||
-rw-r--r-- | drivers/staging/tidspbridge/rmgr/strm.c | 6 |
3 files changed, 35 insertions, 53 deletions
diff --git a/drivers/staging/tidspbridge/rmgr/drv.c b/drivers/staging/tidspbridge/rmgr/drv.c index db1da28cecba..be26917a6896 100644 --- a/drivers/staging/tidspbridge/rmgr/drv.c +++ b/drivers/staging/tidspbridge/rmgr/drv.c @@ -76,37 +76,28 @@ int drv_insert_node_res_element(void *hnode, void *node_resource, struct node_res_object **node_res_obj = (struct node_res_object **)node_resource; struct process_context *ctxt = (struct process_context *)process_ctxt; - int status = 0; int retval; *node_res_obj = kzalloc(sizeof(struct node_res_object), GFP_KERNEL); - if (!*node_res_obj) { - status = -ENOMEM; - goto func_end; - } + if (!*node_res_obj) + return -ENOMEM; (*node_res_obj)->node = hnode; - retval = idr_get_new(ctxt->node_id, *node_res_obj, - &(*node_res_obj)->id); - if (retval == -EAGAIN) { - if (!idr_pre_get(ctxt->node_id, GFP_KERNEL)) { - pr_err("%s: OUT OF MEMORY\n", __func__); - status = -ENOMEM; - goto func_end; - } - - retval = idr_get_new(ctxt->node_id, *node_res_obj, - &(*node_res_obj)->id); + retval = idr_alloc(ctxt->node_id, *node_res_obj, 0, 0, GFP_KERNEL); + if (retval >= 0) { + (*node_res_obj)->id = retval; + return 0; } - if (retval) { + + kfree(*node_res_obj); + + if (retval == -ENOSPC) { pr_err("%s: FAILED, IDR is FULL\n", __func__); - status = -EFAULT; + return -EFAULT; + } else { + pr_err("%s: OUT OF MEMORY\n", __func__); + return -ENOMEM; } -func_end: - if (status) - kfree(*node_res_obj); - - return status; } /* Release all Node resources and its context @@ -201,35 +192,26 @@ int drv_proc_insert_strm_res_element(void *stream_obj, struct strm_res_object **pstrm_res = (struct strm_res_object **)strm_res; struct process_context *ctxt = (struct process_context *)process_ctxt; - int status = 0; int retval; *pstrm_res = kzalloc(sizeof(struct strm_res_object), GFP_KERNEL); - if (*pstrm_res == NULL) { - status = -EFAULT; - goto func_end; - } + if (*pstrm_res == NULL) + return -EFAULT; (*pstrm_res)->stream = stream_obj; - retval = idr_get_new(ctxt->stream_id, *pstrm_res, - &(*pstrm_res)->id); - if (retval == -EAGAIN) { - if (!idr_pre_get(ctxt->stream_id, GFP_KERNEL)) { - pr_err("%s: OUT OF MEMORY\n", __func__); - status = -ENOMEM; - goto func_end; - } - - retval = idr_get_new(ctxt->stream_id, *pstrm_res, - &(*pstrm_res)->id); + retval = idr_alloc(ctxt->stream_id, *pstrm_res, 0, 0, GFP_KERNEL); + if (retval >= 0) { + (*pstrm_res)->id = retval; + return 0; } - if (retval) { + + if (retval == -ENOSPC) { pr_err("%s: FAILED, IDR is FULL\n", __func__); - status = -EPERM; + return -EPERM; + } else { + pr_err("%s: OUT OF MEMORY\n", __func__); + return -ENOMEM; } - -func_end: - return status; } static int drv_proc_free_strm_res(int id, void *p, void *process_ctxt) diff --git a/drivers/staging/tidspbridge/rmgr/proc.c b/drivers/staging/tidspbridge/rmgr/proc.c index 0df55bd5bde4..cd5235a4f77c 100644 --- a/drivers/staging/tidspbridge/rmgr/proc.c +++ b/drivers/staging/tidspbridge/rmgr/proc.c @@ -488,7 +488,7 @@ func_end: * Call the bridge_dev_ctrl fxn with the Argument. This is a Synchronous * Operation. arg can be null. */ -int proc_ctrl(void *hprocessor, u32 dw_cmd, struct dsp_cbdata * arg) +int proc_ctrl(void *hprocessor, u32 dw_cmd, struct dsp_cbdata *arg) { int status = 0; struct proc_object *p_proc_object = hprocessor; @@ -982,7 +982,7 @@ int proc_get_state(void *hprocessor, * This call is destructive, meaning the processor is placed in the monitor * state as a result of this function. */ -int proc_get_trace(void *hprocessor, u8 * pbuf, u32 max_size) +int proc_get_trace(void *hprocessor, u8 *pbuf, u32 max_size) { int status; status = -ENOSYS; @@ -1338,7 +1338,7 @@ func_end: */ int proc_register_notify(void *hprocessor, u32 event_mask, u32 notify_type, struct dsp_notification - * hnotification) + *hnotification) { int status = 0; struct proc_object *p_proc_object = (struct proc_object *)hprocessor; @@ -1549,8 +1549,8 @@ int proc_stop(void *hprocessor) status = node_enum_nodes(hnode_mgr, &hnode, node_tab_size, &num_nodes, &nodes_allocated); if ((status == -EINVAL) || (nodes_allocated > 0)) { - pr_err("%s: Can't stop device, active nodes = %d \n", - __func__, nodes_allocated); + pr_err("%s: Can't stop device, active nodes = %d\n", + __func__, nodes_allocated); return -EBADR; } } @@ -1819,7 +1819,7 @@ func_end: * Purpose: * Retrieves the processor ID. */ -int proc_get_processor_id(void *proc, u32 * proc_id) +int proc_get_processor_id(void *proc, u32 *proc_id) { int status = 0; struct proc_object *p_proc_object = (struct proc_object *)proc; diff --git a/drivers/staging/tidspbridge/rmgr/strm.c b/drivers/staging/tidspbridge/rmgr/strm.c index 34cc934e0c3d..b88b27bbe2e7 100644 --- a/drivers/staging/tidspbridge/rmgr/strm.c +++ b/drivers/staging/tidspbridge/rmgr/strm.c @@ -223,7 +223,7 @@ void strm_delete(struct strm_mgr *strm_mgr_obj) * Purpose: * Frees the buffers allocated for a stream. */ -int strm_free_buffer(struct strm_res_object *strmres, u8 ** ap_buffer, +int strm_free_buffer(struct strm_res_object *strmres, u8 **ap_buffer, u32 num_bufs, struct process_context *pr_ctxt) { int status = 0; @@ -523,7 +523,7 @@ func_cont: * Purpose: * Relcaims a buffer from a stream. */ -int strm_reclaim(struct strm_object *stream_obj, u8 ** buf_ptr, +int strm_reclaim(struct strm_object *stream_obj, u8 **buf_ptr, u32 *nbytes, u32 *buff_size, u32 *pdw_arg) { struct bridge_drv_interface *intf_fxns; @@ -599,7 +599,7 @@ func_end: */ int strm_register_notify(struct strm_object *stream_obj, u32 event_mask, u32 notify_type, struct dsp_notification - * hnotification) + *hnotification) { struct bridge_drv_interface *intf_fxns; int status = 0; |