Commit a664bcbe authored by Suman Anna's avatar Suman Anna Committed by Hari Kanigeri

SYSLINK: ipc - fix listmp_sharedmemory issues in heapbuf_open and heapbuf_create

This patch fixes the issues within listmp_sharedmemory module that are
causing the heapbuf_open and heapbuf_create to fail. listmp_sharedmemory module
uses the gate passed onto it from heapbuf. The module currently uses the linux
mutex apis with this gate, whereas the actual gate passed is a gatepeterson object.
The linux mutex apis are replaced with gatepeterson apis in
listmp_sharedmemort_put_tail function.
Signed-off-by: default avatarJayan John <x00jayan@ti.com>
parent 1fe96701
......@@ -74,6 +74,7 @@
#include <multiproc.h>
#include "_listmp.h"
#include <listmp.h>
#include <gatepeterson.h>
#include <listmp_sharedmemory.h>
......@@ -989,7 +990,7 @@ int listmp_sharedmemory_put_tail(listmp_sharedmemory_handle listMPHandle,
struct listmp_elem *localPrevElem = NULL;
struct listmp_elem *sharedElem = NULL;
struct listmp_elem *sharedHead = NULL;
u32 key = 0;
s32 retval = 0;
u32 index;
gt_2trace(listmpshm_debugmask, GT_ENTER, "listmp_sharedmemory_put_tail",
......@@ -1014,8 +1015,14 @@ int listmp_sharedmemory_put_tail(listmp_sharedmemory_handle listMPHandle,
sharedHead = (struct listmp_elem *)sharedregion_get_srptr
((void *)obj->listmp_elem,
obj->index);
if (obj->params.lock_handle != NULL)
key = mutex_lock_interruptible(obj->params.lock_handle);
if (obj->params.lock_handle != NULL) {
retval = gatepeterson_enter(obj->params.lock_handle);
if (retval < 0) {
status = -EINVAL;
goto exit;
}
}
/* Add the new elem into the list */
elem->next = sharedHead;
......@@ -1025,7 +1032,7 @@ int listmp_sharedmemory_put_tail(listmp_sharedmemory_handle listMPHandle,
obj->listmp_elem->prev = sharedElem;
if (obj->params.lock_handle != NULL)
mutex_unlock(obj->params.lock_handle);
gatepeterson_leave(obj->params.lock_handle, 0);
exit:
gt_1trace(listmpshm_debugmask, GT_LEAVE, "listmp_sharedmemory_put_tail",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment