Commit 5d036924 authored by Suman Anna's avatar Suman Anna Committed by Hari Kanigeri

SYSLINK: ipc - fix listmp_sharedmemory list initialization

This patch fixes the initialization of a listmp_sharedmemory
list. A listmp_sharedmemory object is a list of portable pointers, which
are obtained using the sharedregion module. This patch resolves the
list initialization for non-zero sharedregion indices. Checkpatch
warnings are minimized by using a macro for volatile.
Signed-off-by: default avatarSuman Anna <s-anna@ti.com>
parent e9df6a89
...@@ -97,6 +97,9 @@ ...@@ -97,6 +97,9 @@
#define LISTMP_SHAREDMEMORY_CACHESIZE 128 #define LISTMP_SHAREDMEMORY_CACHESIZE 128
#define VOLATILE volatile
/* ============================================================================= /* =============================================================================
* Structures and Enums * Structures and Enums
* ============================================================================= * =============================================================================
...@@ -140,7 +143,7 @@ struct listmp_sharedmemory_module_object listmp_sharedmemory_state = { ...@@ -140,7 +143,7 @@ struct listmp_sharedmemory_module_object listmp_sharedmemory_state = {
struct listmp_sharedmemory_obj{ struct listmp_sharedmemory_obj{
struct list_head list_elem; struct list_head list_elem;
/*!< Used for creating a linked list */ /*!< Used for creating a linked list */
volatile struct listmp_elem *listmp_elem; VOLATILE struct listmp_elem *listmp_elem;
/*!< Used for storing listmp_sharedmemory element */ /*!< Used for storing listmp_sharedmemory element */
struct listmp_proc_attrs *owner; struct listmp_proc_attrs *owner;
/*!< Creator's attributes associated with an instance */ /*!< Creator's attributes associated with an instance */
...@@ -149,7 +152,7 @@ struct listmp_sharedmemory_obj{ ...@@ -149,7 +152,7 @@ struct listmp_sharedmemory_obj{
void *ns_key; void *ns_key;
u32 index; u32 index;
/*!< the index for SrPtr */ /*!< the index for SrPtr */
volatile struct listmp_attrs *attrs; VOLATILE struct listmp_attrs *attrs;
/*!< Shared memory attributes */ /*!< Shared memory attributes */
void *top; void *top;
/*!< Pointer to the top Object */ /*!< Pointer to the top Object */
...@@ -1405,11 +1408,11 @@ listmp_sharedmemory_handle _listmp_sharedmemory_create( ...@@ -1405,11 +1408,11 @@ listmp_sharedmemory_handle _listmp_sharedmemory_create(
handle->prev = &listmp_sharedmemory_prev; handle->prev = &listmp_sharedmemory_prev;
/* Update attrs */ /* Update attrs */
obj->attrs = (struct listmp_attrs *) obj->attrs = (struct listmp_attrs *) params->shared_addr;
params->shared_addr;
/* Assign the memory with proper cache line padding */ /* Assign the memory with proper cache line padding */
obj->listmp_elem = (void *) ((u32)obj->attrs + \ obj->listmp_elem = (void *) ((u32)obj->attrs + \
LISTMP_SHAREDMEMORY_CACHESIZE); LISTMP_SHAREDMEMORY_CACHESIZE);
obj->index = sharedregion_get_index(params->shared_addr);
if (create_flag == true) { if (create_flag == true) {
obj->attrs->shared_addr_size = params->shared_addr_size; obj->attrs->shared_addr_size = params->shared_addr_size;
...@@ -1420,12 +1423,8 @@ listmp_sharedmemory_handle _listmp_sharedmemory_create( ...@@ -1420,12 +1423,8 @@ listmp_sharedmemory_handle _listmp_sharedmemory_create(
obj->index)); obj->index));
} }
obj->index = sharedregion_get_index(params->shared_addr);
/* Populate the params member */ /* Populate the params member */
memcpy((void *)&obj->params, memcpy((void *)&obj->params, (void *)params,
(void *)params,
sizeof(listmp_sharedmemory_params)); sizeof(listmp_sharedmemory_params));
if (likely(listmp_sharedmemory_state.cfg.use_name_server if (likely(listmp_sharedmemory_state.cfg.use_name_server
......
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