Commit 41638be7 authored by C A Subramaniam's avatar C A Subramaniam Committed by Hari Kanigeri

SYSLINK NOTIFY Patch to migrate Notify module to Syslink version 2.0.0.12

Patch Introduces additional tracking of notify driver
handles.
Signed-off-by: default avatarC A Subramaniam <subramaniam.ca@ti.com>
Signed-off-by: default avatarRamesh Gupta G <grgupta@ti.com>
parent 25ca34bd
...@@ -394,6 +394,7 @@ struct notify_driver_object { ...@@ -394,6 +394,7 @@ struct notify_driver_object {
struct notify_driver_attrs attrs; struct notify_driver_attrs attrs;
u32 *disable_flag[NOTIFY_MAXNESTDEPTH]; u32 *disable_flag[NOTIFY_MAXNESTDEPTH];
void *driver_object; void *driver_object;
int index;
}; };
......
...@@ -102,6 +102,7 @@ struct notify_ducatidrv_module { ...@@ -102,6 +102,7 @@ struct notify_ducatidrv_module {
struct notify_ducatidrv_config def_cfg; struct notify_ducatidrv_config def_cfg;
struct notify_ducatidrv_params def_inst_params; struct notify_ducatidrv_params def_inst_params;
struct mutex *gate_handle; struct mutex *gate_handle;
struct notify_driver_object *drv_handles[NOTIFY_MAX_DRIVERS];
} ; } ;
...@@ -250,6 +251,7 @@ struct notify_driver_object *notify_ducatidrv_create(char *driver_name, ...@@ -250,6 +251,7 @@ struct notify_driver_object *notify_ducatidrv_create(char *driver_name,
int proc_id; int proc_id;
int i; int i;
u32 shm_va; u32 shm_va;
int tmp_status = NOTIFY_SUCCESS;
int slot = false; int slot = false;
...@@ -275,6 +277,13 @@ struct notify_driver_object *notify_ducatidrv_create(char *driver_name, ...@@ -275,6 +277,13 @@ struct notify_driver_object *notify_ducatidrv_create(char *driver_name,
proc_id = PROC_DUCATI; proc_id = PROC_DUCATI;
tmp_status = notify_get_driver_handle(driver_name, &drv_handle);
if (tmp_status != NOTIFY_E_NOTFOUND) {
status = -EEXIST;
goto func_end;
}
/* Fill in information about driver attributes. */ /* Fill in information about driver attributes. */
/* This driver supports interaction with one other remote /* This driver supports interaction with one other remote
* processor.*/ * processor.*/
...@@ -413,6 +422,8 @@ struct notify_driver_object *notify_ducatidrv_create(char *driver_name, ...@@ -413,6 +422,8 @@ struct notify_driver_object *notify_ducatidrv_create(char *driver_name,
omap_mbox_enable_irq(ducati_mbox, IRQ_RX); omap_mbox_enable_irq(ducati_mbox, IRQ_RX);
status = 0; status = 0;
if (status == 0) { if (status == 0) {
notify_ducatidriver_state.drv_handles[drv_handle->index]
= drv_handle;
driver_obj = drv_handle->driver_object; driver_obj = drv_handle->driver_object;
ctrl_ptr->reg_mask.mask = 0x0; ctrl_ptr->reg_mask.mask = 0x0;
ctrl_ptr->reg_mask.enable_mask = 0xFFFFFFFF; ctrl_ptr->reg_mask.enable_mask = 0xFFFFFFFF;
...@@ -504,6 +515,8 @@ int notify_ducatidrv_delete(struct notify_driver_object **handle_ptr) ...@@ -504,6 +515,8 @@ int notify_ducatidrv_delete(struct notify_driver_object **handle_ptr)
if (drv_handle != NULL) { if (drv_handle != NULL) {
status = notify_unregister_driver(drv_handle); status = notify_unregister_driver(drv_handle);
driver_obj = drv_handle->driver_object; driver_obj = drv_handle->driver_object;
BUG_ON(drv_handle->index >= NOTIFY_MAX_DRIVERS);
notify_ducatidriver_state.drv_handles[drv_handle->index] = NULL;
} }
if (status != NOTIFY_SUCCESS) if (status != NOTIFY_SUCCESS)
printk(KERN_WARNING "driver is not registerd\n"); printk(KERN_WARNING "driver is not registerd\n");
...@@ -581,6 +594,7 @@ EXPORT_SYMBOL(notify_ducatidrv_delete); ...@@ -581,6 +594,7 @@ EXPORT_SYMBOL(notify_ducatidrv_delete);
int notify_ducatidrv_destroy(void) int notify_ducatidrv_destroy(void)
{ {
int status = 0; int status = 0;
int i = 0;
if (atomic_cmpmask_and_lt(&(notify_ducatidriver_state.ref_count), if (atomic_cmpmask_and_lt(&(notify_ducatidriver_state.ref_count),
NOTIFYDRIVERSHM_MAKE_MAGICSTAMP(0), NOTIFYDRIVERSHM_MAKE_MAGICSTAMP(0),
...@@ -592,13 +606,21 @@ int notify_ducatidrv_destroy(void) ...@@ -592,13 +606,21 @@ int notify_ducatidrv_destroy(void)
if (atomic_dec_return(&(notify_ducatidriver_state.ref_count)) == if (atomic_dec_return(&(notify_ducatidriver_state.ref_count)) ==
NOTIFYDRIVERSHM_MAKE_MAGICSTAMP(0)) { NOTIFYDRIVERSHM_MAKE_MAGICSTAMP(0)) {
/* Temprarily increment the refcount */
atomic_set(&(notify_ducatidriver_state.ref_count),
NOTIFYDRIVERSHM_MAKE_MAGICSTAMP(1));
for (i = 0; i < NOTIFY_MAX_DRIVERS; i++) {
if (ducati_isr_params[i])
notify_ducatidrv_delete(
&(notify_ducatidriver_state.drv_handles[i]));
}
/* Check if the gate_handle was created internally. */ /* Check if the gate_handle was created internally. */
if (notify_ducatidriver_state.gate_handle != NULL) if (notify_ducatidriver_state.gate_handle != NULL)
kfree(notify_ducatidriver_state.gate_handle); kfree(notify_ducatidriver_state.gate_handle);
/* FIXME- Why do we need to reset this if we already
* decremented it to 0 */
atomic_set(&(notify_ducatidriver_state.ref_count), atomic_set(&(notify_ducatidriver_state.ref_count),
NOTIFYDRIVERSHM_MAKE_MAGICSTAMP(0)); NOTIFYDRIVERSHM_MAKE_MAGICSTAMP(0));
...@@ -663,8 +685,10 @@ int notify_ducatidrv_setup(struct notify_ducatidrv_config *cfg) ...@@ -663,8 +685,10 @@ int notify_ducatidrv_setup(struct notify_ducatidrv_config *cfg)
cfg, sizeof(struct notify_ducatidrv_config)); cfg, sizeof(struct notify_ducatidrv_config));
} }
for (i = 0; i < NOTIFY_MAX_DRIVERS; i++) for (i = 0; i < NOTIFY_MAX_DRIVERS; i++) {
ducati_isr_params[i] = NULL; ducati_isr_params[i] = NULL;
notify_ducatidriver_state.drv_handles[i] = NULL;
}
/* Initialize the maibox modulde for ducati */ /* Initialize the maibox modulde for ducati */
if (ducati_mbox == NULL) { if (ducati_mbox == NULL) {
ducati_mbox = omap_mbox_get("mailbox-2"); ducati_mbox = omap_mbox_get("mailbox-2");
......
...@@ -76,6 +76,7 @@ int notify_register_driver(char *driver_name, ...@@ -76,6 +76,7 @@ int notify_register_driver(char *driver_name,
/* Found an empty slot, so block it. */ /* Found an empty slot, so block it. */
drv_handle->is_init = drv_handle->is_init =
NOTIFY_DRIVERINITSTATUS_INPROGRESS; NOTIFY_DRIVERINITSTATUS_INPROGRESS;
drv_handle->index = i;
status = NOTIFY_SUCCESS; status = NOTIFY_SUCCESS;
break; break;
} }
......
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