Skip to content

Commit

Permalink
staging: ti dspbridge: use node id instead of kernel address
Browse files Browse the repository at this point in the history
Use idr kernel library to send/receive node ids to the
user instead of kernel address.
This id will be use to access the node handles at the
kernel side, if id does not match to any handle
error -EFAULT is returned.

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 Aug 3, 2010
1 parent 35f338e commit 0624f52
Show file tree
Hide file tree
Showing 7 changed files with 257 additions and 196 deletions.
6 changes: 3 additions & 3 deletions drivers/staging/tidspbridge/include/dspbridge/drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <dspbridge/devdefs.h>

#include <dspbridge/drvdefs.h>
#include <linux/idr.h>

#define DRV_ASSIGN 1
#define DRV_RELEASE 0
Expand Down Expand Up @@ -81,7 +82,7 @@ struct node_res_object {
s32 node_allocated; /* Node status */
s32 heap_allocated; /* Heap status */
s32 streams_allocated; /* Streams status */
struct node_res_object *next;
int id;
};

/* used to cache dma mapping information */
Expand Down Expand Up @@ -158,8 +159,7 @@ struct process_context {
void *hprocessor;

/* DSP Node resources */
struct node_res_object *node_list;
struct mutex node_mutex;
struct idr *node_id;

/* DMM mapped memory resources */
struct list_head dmm_map_list;
Expand Down
14 changes: 8 additions & 6 deletions drivers/staging/tidspbridge/include/dspbridge/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
* pargs: Optional arguments to be passed to the node.
* attr_in: Optional pointer to node attributes (priority,
* timeout...)
* ph_node: Location to store node handle on output.
* noderes: Location to store node resource info.
* Returns:
* 0: Success.
* -ENOMEM: Insufficient memory on GPP.
Expand All @@ -50,17 +50,17 @@
* node_init(void) called.
* hprocessor != NULL.
* node_uuid != NULL.
* ph_node != NULL.
* noderes != NULL.
* Ensures:
* 0: IsValidNode(*ph_node).
* error: *ph_node == NULL.
* error: *noderes == NULL.
*/
extern int node_allocate(struct proc_object *hprocessor,
const struct dsp_uuid *node_uuid,
const struct dsp_cbdata
*pargs, const struct dsp_nodeattrin
*attr_in,
struct node_object **ph_node,
struct node_res_object **noderes,
struct process_context *pr_ctxt);

/*
Expand Down Expand Up @@ -242,7 +242,9 @@ extern int node_create_mgr(struct node_mgr **node_man,
* delete function. Loads the node's delete function if necessary.
* GPP side resources are freed after node's delete function returns.
* Parameters:
* hnode: Node handle returned from node_allocate().
* noderes: Node resource info handle returned from
* node_allocate().
* pr_ctxt: Poninter to process context data.
* Returns:
* 0: Success.
* -EFAULT: Invalid hnode.
Expand All @@ -254,7 +256,7 @@ extern int node_create_mgr(struct node_mgr **node_man,
* Ensures:
* 0: hnode is invalid.
*/
extern int node_delete(struct node_object *hnode,
extern int node_delete(struct node_res_object *noderes,
struct process_context *pr_ctxt);

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,11 @@ extern int drv_remove_all_resources(void *process_ctxt);
extern int drv_remove_proc_context(struct drv_object *driver_obj,
void *pr_ctxt);

extern int drv_get_node_res_element(void *hnode, void *node_resource,
void *process_ctx);

extern int drv_insert_node_res_element(void *hnode, void *node_resource,
void *process_ctxt);

extern void drv_proc_node_update_heap_status(void *node_resource, s32 status);

extern int drv_remove_node_res_element(void *node_resource,
void *process_ctxt);

extern void drv_proc_node_update_status(void *node_resource, s32 status);

extern int drv_proc_update_strm_res(u32 num_bufs, void *strm_resources);
Expand Down
Loading

0 comments on commit 0624f52

Please sign in to comment.