Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 235925
b: refs/heads/master
c: 74c2d1f
h: refs/heads/master
i:
  235923: 8417782
v: v3
  • Loading branch information
Ionut Nicu authored and Omar Ramirez Luna committed Feb 5, 2011
1 parent 22337b6 commit 2dc65d2
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 49 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 59403c21afdcd2e89aeadc73b99ccd82d32733b3
refs/heads/master: 74c2d1f63f6fff26503f538ddacf0e45feb15f0d
78 changes: 30 additions & 48 deletions trunk/drivers/staging/tidspbridge/core/io_sm.c
Original file line number Diff line number Diff line change
Expand Up @@ -167,57 +167,41 @@ int bridge_io_create(struct io_mgr **io_man,
struct dev_object *hdev_obj,
const struct io_attrs *mgr_attrts)
{
int status = 0;
struct io_mgr *pio_mgr = NULL;
struct shm *shared_mem = NULL;
struct bridge_dev_context *hbridge_context = NULL;
struct cfg_devnode *dev_node_obj;
struct chnl_mgr *hchnl_mgr;
u8 dev_type;

/* Check requirements */
if (!io_man || !mgr_attrts || mgr_attrts->word_size == 0) {
status = -EFAULT;
goto func_end;
}
if (!io_man || !mgr_attrts || mgr_attrts->word_size == 0)
return -EFAULT;

*io_man = NULL;

dev_get_chnl_mgr(hdev_obj, &hchnl_mgr);
if (!hchnl_mgr || hchnl_mgr->hio_mgr) {
status = -EFAULT;
goto func_end;
}
if (!hchnl_mgr || hchnl_mgr->hio_mgr)
return -EFAULT;

/*
* Message manager will be created when a file is loaded, since
* size of message buffer in shared memory is configurable in
* the base image.
*/
dev_get_bridge_context(hdev_obj, &hbridge_context);
if (!hbridge_context) {
status = -EFAULT;
goto func_end;
}
if (!hbridge_context)
return -EFAULT;

dev_get_dev_type(hdev_obj, &dev_type);
/*
* DSP shared memory area will get set properly when
* a program is loaded. They are unknown until a COFF file is
* loaded. I chose the value -1 because it was less likely to be
* a valid address than 0.
*/
shared_mem = (struct shm *)-1;

/* Allocate IO manager object */
pio_mgr = kzalloc(sizeof(struct io_mgr), GFP_KERNEL);
if (pio_mgr == NULL) {
status = -ENOMEM;
goto func_end;
}
if (!pio_mgr)
return -ENOMEM;

/* Initialize chnl_mgr object */
#if defined(CONFIG_TIDSPBRIDGE_BACKTRACE) || defined(CONFIG_TIDSPBRIDGE_DEBUG)
pio_mgr->pmsg = NULL;
#endif
pio_mgr->hchnl_mgr = hchnl_mgr;
pio_mgr->word_size = mgr_attrts->word_size;
pio_mgr->shared_mem = shared_mem;

if (dev_type == DSP_UNIT) {
/* Create an IO DPC */
Expand All @@ -229,29 +213,24 @@ int bridge_io_create(struct io_mgr **io_man,

spin_lock_init(&pio_mgr->dpc_lock);

status = dev_get_dev_node(hdev_obj, &dev_node_obj);
if (dev_get_dev_node(hdev_obj, &dev_node_obj)) {
bridge_io_destroy(pio_mgr);
return -EIO;
}
}

if (!status) {
pio_mgr->hbridge_context = hbridge_context;
pio_mgr->shared_irq = mgr_attrts->irq_shared;
if (dsp_wdt_init())
status = -EPERM;
} else {
status = -EIO;
}
func_end:
if (status) {
/* Cleanup */
pio_mgr->hbridge_context = hbridge_context;
pio_mgr->shared_irq = mgr_attrts->irq_shared;
if (dsp_wdt_init()) {
bridge_io_destroy(pio_mgr);
if (io_man)
*io_man = NULL;
} else {
/* Return IO manager object to caller... */
hchnl_mgr->hio_mgr = pio_mgr;
*io_man = pio_mgr;
return -EPERM;
}
return status;

/* Return IO manager object to caller... */
hchnl_mgr->hio_mgr = pio_mgr;
*io_man = pio_mgr;

return 0;
}

/*
Expand Down Expand Up @@ -1714,6 +1693,9 @@ int io_sh_msetting(struct io_mgr *hio_mgr, u8 desc, void *pargs)
int bridge_io_get_proc_load(struct io_mgr *hio_mgr,
struct dsp_procloadstat *proc_lstat)
{
if (!hio_mgr->shared_mem)
return -EFAULT;

proc_lstat->curr_load =
hio_mgr->shared_mem->load_mon_info.curr_dsp_load;
proc_lstat->predicted_load =
Expand Down

0 comments on commit 2dc65d2

Please sign in to comment.