From dd1a8b6b4a487eb3e7e3a001fc557119f4bfa891 Mon Sep 17 00:00:00 2001 From: Jayan John <x00jayan@ti.com> Date: Mon, 22 Jun 2009 21:47:48 +0530 Subject: [PATCH] Syslink: Patch to resolve issues in IPC components nameserver, nameserver notify and messageQ. This patch resolves issues in nameserver, nameserver remote, nameserver remote notify and messageQ. The fixes mainly involve correction of arg checks, status returns and status checks. These changes are necessary for MessageQ to work. Signed-off-by: Jayan John <x00jayan@ti.com> --- drivers/dsp/syslink/multicore_ipc/messageq.c | 4 ++-- drivers/dsp/syslink/multicore_ipc/nameserver.c | 7 ++----- drivers/dsp/syslink/multicore_ipc/nameserver_remote.c | 5 ++--- .../dsp/syslink/multicore_ipc/nameserver_remotenotify.c | 6 +++--- 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/drivers/dsp/syslink/multicore_ipc/messageq.c b/drivers/dsp/syslink/multicore_ipc/messageq.c index 223440cacfb..9f043c6e7f6 100644 --- a/drivers/dsp/syslink/multicore_ipc/messageq.c +++ b/drivers/dsp/syslink/multicore_ipc/messageq.c @@ -721,8 +721,8 @@ int messageq_open(char *name, u32 *queue_id) len = nameserver_get(messageq_state.ns_handle, name, queue_id, sizeof(u32), NULL); - if (len <= 0) { - /* Name found */ + if (len < 0) { + /* Name not found */ status = MESSAGEQ_E_FAIL; } diff --git a/drivers/dsp/syslink/multicore_ipc/nameserver.c b/drivers/dsp/syslink/multicore_ipc/nameserver.c index 4194776f473..c543fcba713 100644 --- a/drivers/dsp/syslink/multicore_ipc/nameserver.c +++ b/drivers/dsp/syslink/multicore_ipc/nameserver.c @@ -797,13 +797,12 @@ int nameserver_get(void *handle, const char *name, struct nameserver_object *temp_obj = NULL; u16 max_proc_id; u16 local_proc_id; - s32 retval = -1; + s32 retval = -ENOENT; u32 i; BUG_ON(handle == NULL); BUG_ON(name == NULL); BUG_ON(buffer == NULL); - BUG_ON(proc_id == NULL); if (WARN_ON(length == 0)) { retval = -EINVAL; goto exit; @@ -823,7 +822,7 @@ int nameserver_get(void *handle, const char *name, if (i == local_proc_id) continue; retval = nameserver_remote_get( - nameserver_state.remote_handle_list[proc_id[i]], + nameserver_state.remote_handle_list[i], temp_obj->name, name, buffer, length); if (retval == 0) /* Got the value */ break; @@ -846,12 +845,10 @@ int nameserver_get(void *handle, const char *name, retval = nameserver_remote_get( nameserver_state.remote_handle_list[proc_id[i]], temp_obj->name, name, buffer, length); - /* A count of non-zero means it was found */ if (retval == 0) break; } } - retval = -ENOENT; exit: printk(KERN_ERR "nameserver_get_local failed status:%x \n", retval); diff --git a/drivers/dsp/syslink/multicore_ipc/nameserver_remote.c b/drivers/dsp/syslink/multicore_ipc/nameserver_remote.c index 65b2346428d..0463987828d 100644 --- a/drivers/dsp/syslink/multicore_ipc/nameserver_remote.c +++ b/drivers/dsp/syslink/multicore_ipc/nameserver_remote.c @@ -30,7 +30,7 @@ int nameserver_remote_get(const struct nameserver_remote_object *handle, void *value, u32 value_len) { s32 retval = 0; - s32 count = 0; + gt_0trace(ns_debugmask, GT_ENTER, "nameserver_remote_get\n"); if (handle == NULL || instance_name == NULL || @@ -44,8 +44,7 @@ int nameserver_remote_get(const struct nameserver_remote_object *handle, goto exit; } - count = handle->get(handle, instance_name, name, value, value_len); - return count; + retval = handle->get(handle, instance_name, name, value, value_len); exit: return retval; diff --git a/drivers/dsp/syslink/multicore_ipc/nameserver_remotenotify.c b/drivers/dsp/syslink/multicore_ipc/nameserver_remotenotify.c index d8a7b217968..5baf1295856 100644 --- a/drivers/dsp/syslink/multicore_ipc/nameserver_remotenotify.c +++ b/drivers/dsp/syslink/multicore_ipc/nameserver_remotenotify.c @@ -350,7 +350,7 @@ int nameserver_remotenotify_get(void *rhandle, BUG_ON(name == NULL); BUG_ON(value == NULL); - if (WARN_ON(handle == NULL)) { + if (WARN_ON(rhandle == NULL)) { retval = -EINVAL; goto exit; } @@ -513,7 +513,7 @@ void *nameserver_remotenotify_create(u16 proc_id, params->notify_event_no, nameserver_remotenotify_callback, (void *)obj); - if (retval) { + if (retval < 0) { gt_0trace(nameserver_remotenotify_mask, GT_6CLASS, "nameserver_remotenotify_create: notify register" "events failed!\n"); @@ -527,7 +527,7 @@ void *nameserver_remotenotify_create(u16 proc_id, goto sem_alloc_error; } - sema_init(obj->sem_handle, 1); + sema_init(obj->sem_handle, 0); /* its is at the end since its init state = unlocked? */ mutex_init(obj->local_gate); -- 2.25.4