Commit 6e7176db authored by Ramesh Gupta's avatar Ramesh Gupta Committed by Hari Kanigeri

Chech patch fixes in ducati driver Chech patch fixes in ducati driver

Signed-off-by: default avatarRamesh Gupta G <grgupta@ti.com>
parent cbea7df2
...@@ -40,9 +40,7 @@ ...@@ -40,9 +40,7 @@
#define REG volatile #define REG volatile
extern u32 get_ducati_virt_mem();
/* /*
* func notify_mbxdrv_register_event * func notify_mbxdrv_register_event
......
...@@ -337,8 +337,7 @@ long hw_mbox_event_status( ...@@ -337,8 +337,7 @@ long hw_mbox_event_status(
const unsigned long base_address, const unsigned long base_address,
const enum hw_mbox_id_t mail_box_id, const enum hw_mbox_id_t mail_box_id,
const enum hw_mbox_userid_t user_id, const enum hw_mbox_userid_t user_id,
unsigned long *const p_eventStatus unsigned long *const p_eventStatus)
)
{ {
long status = RET_OK; long status = RET_OK;
unsigned long irq_status_reg; unsigned long irq_status_reg;
......
...@@ -29,7 +29,6 @@ MODULE_AUTHOR("Suman Anna"); ...@@ -29,7 +29,6 @@ MODULE_AUTHOR("Suman Anna");
MODULE_AUTHOR("Hari Kanigeri"); MODULE_AUTHOR("Hari Kanigeri");
MODULE_DESCRIPTION("Dispatchers mailbox events"); MODULE_DESCRIPTION("Dispatchers mailbox events");
#define OMAP_MBOX_BASE 0x4A0F4000 #define OMAP_MBOX_BASE 0x4A0F4000
#define OMAP_MBOX_SIZE 0x2000 #define OMAP_MBOX_SIZE 0x2000
...@@ -375,7 +374,7 @@ EXPORT_SYMBOL(ntfy_disp_send); ...@@ -375,7 +374,7 @@ EXPORT_SYMBOL(ntfy_disp_send);
* *
* Remove the ISR to the HW interrupt line coming into the processor * Remove the ISR to the HW interrupt line coming into the processor
*/ */
int ntfy_disp_unbind_interrupt( int interrupt_no) int ntfy_disp_unbind_interrupt(int interrupt_no)
{ {
int i; int i;
short int valid_interrupt = false; short int valid_interrupt = false;
......
...@@ -39,8 +39,8 @@ static signed long int major = 234 ; ...@@ -39,8 +39,8 @@ static signed long int major = 234 ;
/* driver function to open the notify mailbox driver object. */ /* driver function to open the notify mailbox driver object. */
static int drvducati_open(struct inode *inode, struct file *filp); static int drvducati_open(struct inode *inode, struct file *filp);
static int drvducati_release(struct inode * inode, struct file * filp); static int drvducati_release(struct inode *inode, struct file *filp);
static int drvducati_ioctl(struct inode * inode, static int drvducati_ioctl(struct inode *inode,
struct file *filp, struct file *filp,
unsigned int cmd, unsigned int cmd,
unsigned long args); unsigned long args);
...@@ -54,7 +54,7 @@ static void __exit drvducati_finalize_module(void) ; ...@@ -54,7 +54,7 @@ static void __exit drvducati_finalize_module(void) ;
/* Function to invoke the APIs through ioctl. */ /* Function to invoke the APIs through ioctl. */
static struct file_operations driver_ops = { static const struct file_operations driver_ops = {
.open = drvducati_open, .open = drvducati_open,
.release = drvducati_release, .release = drvducati_release,
.ioctl = drvducati_ioctl, .ioctl = drvducati_ioctl,
...@@ -85,7 +85,7 @@ static int drvducati_open(struct inode *inode, struct file *filp) ...@@ -85,7 +85,7 @@ static int drvducati_open(struct inode *inode, struct file *filp)
} }
/*drivr close*/ /*drivr close*/
static int drvducati_release(struct inode * inode, struct file * filp) static int drvducati_release(struct inode *inode, struct file *filp)
{ {
return 0; return 0;
} }
...@@ -96,7 +96,7 @@ static int drvducati_release(struct inode * inode, struct file * filp) ...@@ -96,7 +96,7 @@ static int drvducati_release(struct inode * inode, struct file * filp)
* brief linux driver function to invoke the APIs through ioctl. * brief linux driver function to invoke the APIs through ioctl.
* *
*/ */
static int drvducati_ioctl(struct inode * inode, static int drvducati_ioctl(struct inode *inode,
struct file *filp, struct file *filp,
unsigned int cmd, unsigned int cmd,
unsigned long args) unsigned long args)
...@@ -104,41 +104,40 @@ static int drvducati_ioctl(struct inode * inode, ...@@ -104,41 +104,40 @@ static int drvducati_ioctl(struct inode * inode,
int status = 0; int status = 0;
int osStatus = 0; int osStatus = 0;
int retVal = 0; int retVal = 0;
struct notify_ducatidrv_cmdargs * cmd_args = (struct notify_ducatidrv_cmdargs *) args; struct notify_ducatidrv_cmdargs *cmd_args =
(struct notify_ducatidrv_cmdargs *) args;
struct notify_ducatidrv_cmdargs common_args; struct notify_ducatidrv_cmdargs common_args;
switch (cmd) { switch (cmd) {
case CMD_NOTIFYDRIVERSHM_GETCONFIG: { case CMD_NOTIFYDRIVERSHM_GETCONFIG: {
struct notify_ducatidrv_cmdargs_getconfig * src_args = struct notify_ducatidrv_cmdargs_getconfig *src_args =
(struct notify_ducatidrv_cmdargs_getconfig *) args; (struct notify_ducatidrv_cmdargs_getconfig *) args;
struct notify_ducatidrv_config cfg; struct notify_ducatidrv_config cfg;
notify_ducatidrv_getconfig(&cfg); notify_ducatidrv_getconfig(&cfg);
if (osStatus == 0) { if (osStatus == 0) {
retVal = copy_to_user((void*)(src_args->cfg), retVal = copy_to_user((void *)(src_args->cfg),
(const void*) &cfg, (const void *) &cfg,
sizeof(struct notify_ducatidrv_config )); sizeof(struct notify_ducatidrv_config));
if (retVal != 0) { if (retVal != 0)
osStatus = -EFAULT; osStatus = -EFAULT;
} }
} }
}
break; break;
case CMD_NOTIFYDRIVERSHM_SETUP: { case CMD_NOTIFYDRIVERSHM_SETUP: {
struct notify_ducatidrv_cmdargs_setup* src_args = struct notify_ducatidrv_cmdargs_setup *src_args =
(struct notify_ducatidrv_cmdargs_setup *) args; (struct notify_ducatidrv_cmdargs_setup *) args;
struct notify_ducatidrv_config cfg; struct notify_ducatidrv_config cfg;
retVal = copy_from_user((void *) &cfg, retVal = copy_from_user((void *) &cfg,
(const void*)(src_args->cfg), (const void *)(src_args->cfg),
sizeof(struct notify_ducatidrv_config)); sizeof(struct notify_ducatidrv_config));
if (retVal != 0) { if (retVal != 0) {
osStatus = -EFAULT; osStatus = -EFAULT;
} else { } else {
status = notify_ducatidrv_setup(&cfg); status = notify_ducatidrv_setup(&cfg);
if (status < 0) { if (status < 0)
printk("FAIL: notify_ducatidrv_setup\n" ); printk(KERN_ERR "FAIL: notify_ducatidrv_setup\n");
}
} }
} }
break; break;
...@@ -146,9 +145,8 @@ static int drvducati_ioctl(struct inode * inode, ...@@ -146,9 +145,8 @@ static int drvducati_ioctl(struct inode * inode,
case CMD_NOTIFYDRIVERSHM_DESTROY: { case CMD_NOTIFYDRIVERSHM_DESTROY: {
status = notify_ducatidrv_destroy(); status = notify_ducatidrv_destroy();
if (status < 0) { if (status < 0)
printk("FAIL: notify_ducatidrv_destroy\n" ); printk(KERN_ERR "FAIL: notify_ducatidrv_destroy\n");
}
} }
break; break;
...@@ -156,64 +154,66 @@ static int drvducati_ioctl(struct inode * inode, ...@@ -156,64 +154,66 @@ static int drvducati_ioctl(struct inode * inode,
struct notify_ducatidrv_cmdargs_paramsinit src_args; struct notify_ducatidrv_cmdargs_paramsinit src_args;
struct notify_ducatidrv_params params; struct notify_ducatidrv_params params;
retVal = copy_from_user((void *) &src_args, retVal = copy_from_user((void *) &src_args,
(const void*)(args), (const void *)(args),
sizeof(struct notify_ducatidrv_cmdargs_paramsinit)); sizeof(
if (retVal != 0) { struct notify_ducatidrv_cmdargs_paramsinit));
if (retVal != 0)
osStatus = -EFAULT; osStatus = -EFAULT;
} else { else
notify_ducatidrv_params_init(src_args.handle,&params); notify_ducatidrv_params_init(src_args.handle, &params);
}
if (osStatus == 0) { if (osStatus == 0) {
retVal = copy_to_user((void*)(src_args.params), retVal = copy_to_user((void *)(src_args.params),
(const void*) &params, (const void *) &params,
sizeof(struct notify_ducatidrv_params)); sizeof(struct notify_ducatidrv_params));
if (retVal != 0) { if (retVal != 0)
osStatus = -EFAULT; osStatus = -EFAULT;
} }
} }
}
break; break;
case CMD_NOTIFYDRIVERSHM_CREATE: { case CMD_NOTIFYDRIVERSHM_CREATE: {
struct notify_ducatidrv_cmdargs_create src_args; struct notify_ducatidrv_cmdargs_create src_args;
retVal = copy_from_user((void*) &src_args, retVal = copy_from_user((void *) &src_args,
(const void*)(args), (const void *)(args),
sizeof(struct notify_ducatidrv_cmdargs_create)); sizeof(struct notify_ducatidrv_cmdargs_create));
if (retVal != 0) { if (retVal != 0)
osStatus = -EFAULT; osStatus = -EFAULT;
} else { else {
src_args.handle = notify_ducatidrv_create(src_args.driverName, src_args.handle = notify_ducatidrv_create(
src_args.driverName,
&(src_args.params)); &(src_args.params));
if (src_args.handle == NULL) { if (src_args.handle == NULL) {
status = -EFAULT; status = -EFAULT;
printk("drvducati_ioctl:status 0x%x,NotifyDriverShm_create failed", status); printk(KERN_ERR "drvducati_ioctl:status 0x%x,"
"NotifyDriverShm_create failed",
status);
} }
} }
if (osStatus == 0) { if (osStatus == 0) {
retVal = copy_to_user((void*)(args), retVal = copy_to_user((void *)(args),
(const void*) &src_args, (const void *) &src_args,
sizeof(struct notify_ducatidrv_cmdargs_create)); sizeof(struct notify_ducatidrv_cmdargs_create));
if (retVal != 0) { if (retVal != 0)
osStatus = -EFAULT; osStatus = -EFAULT;
} }
} }
}
break; break;
case CMD_NOTIFYDRIVERSHM_DELETE: { case CMD_NOTIFYDRIVERSHM_DELETE: {
struct notify_ducatidrv_cmdargs_delete src_args; struct notify_ducatidrv_cmdargs_delete src_args;
retVal = copy_from_user((void*) &src_args, retVal = copy_from_user((void *) &src_args,
(const void*)(args), (const void *)(args),
sizeof(struct notify_ducatidrv_cmdargs_delete)); sizeof(struct notify_ducatidrv_cmdargs_delete));
if (retVal != 0) { if (retVal != 0)
osStatus = -EFAULT; osStatus = -EFAULT;
} else { else {
status = notify_ducatidrv_delete(&(src_args.handle)); status = notify_ducatidrv_delete(&(src_args.handle));
if (status < 0) { if (status < 0)
printk("drvducati_ioctl: notify_ducatidrv_delete failed status = %d\n",status); printk(KERN_ERR "drvducati_ioctl:"
} " notify_ducatidrv_delete failed"
" status = %d\n", status);
} }
} }
break; break;
...@@ -221,8 +221,8 @@ static int drvducati_ioctl(struct inode * inode, ...@@ -221,8 +221,8 @@ static int drvducati_ioctl(struct inode * inode,
case CMD_NOTIFYDRIVERSHM_OPEN: { case CMD_NOTIFYDRIVERSHM_OPEN: {
struct notify_ducatidrv_cmdargs_open src_args; struct notify_ducatidrv_cmdargs_open src_args;
retVal = copy_from_user((void*) &src_args, retVal = copy_from_user((void *) &src_args,
(const void*)(args), (const void *)(args),
sizeof(struct notify_ducatidrv_cmdargs_open)); sizeof(struct notify_ducatidrv_cmdargs_open));
if (retVal != 0) { if (retVal != 0) {
osStatus = -EFAULT; osStatus = -EFAULT;
...@@ -230,34 +230,36 @@ static int drvducati_ioctl(struct inode * inode, ...@@ -230,34 +230,36 @@ static int drvducati_ioctl(struct inode * inode,
status = notify_ducatidrv_open(src_args.driverName, status = notify_ducatidrv_open(src_args.driverName,
&(src_args.handle)); &(src_args.handle));
if (status < 0) { if (status < 0)
printk("drvducati_ioctl: notify_ducatidrv_open failed status = %d\n",status); printk(KERN_ERR "drvducati_ioctl:"
} " notify_ducatidrv_open failed"
" status = %d\n", status);
} }
if (osStatus == 0) { if (osStatus == 0) {
retVal = copy_to_user((void*)(args), retVal = copy_to_user((void *)(args),
(const void*) &src_args, (const void *) &src_args,
sizeof(struct notify_ducatidrv_cmdargs_open)); sizeof(
if (retVal != 0) { struct notify_ducatidrv_cmdargs_open));
if (retVal != 0)
osStatus = -EFAULT; osStatus = -EFAULT;
} }
} }
}
break; break;
case CMD_NOTIFYDRIVERSHM_CLOSE: { case CMD_NOTIFYDRIVERSHM_CLOSE: {
struct notify_ducatidrv_cmdargs_close src_args; struct notify_ducatidrv_cmdargs_close src_args;
retVal = copy_from_user((void*) &src_args, retVal = copy_from_user((void *) &src_args,
(const void*)(args), (const void *)(args),
sizeof(struct notify_ducatidrv_cmdargs_close)); sizeof(struct notify_ducatidrv_cmdargs_close));
if (retVal != 0) { if (retVal != 0) {
osStatus = -EFAULT; osStatus = -EFAULT;
} else { } else {
status = notify_ducatidrv_close(&(src_args.handle)); status = notify_ducatidrv_close(&(src_args.handle));
if (status < 0) { if (status < 0)
printk("drvducati_ioctl: notify_ducatidrv_close failed status = %d\n",status); printk(KERN_ERR "drvducati_ioctl:"
} " notify_ducatidrv_close"
" failed status = %d\n", status);
} }
} }
break; break;
...@@ -265,24 +267,24 @@ static int drvducati_ioctl(struct inode * inode, ...@@ -265,24 +267,24 @@ static int drvducati_ioctl(struct inode * inode,
default: { default: {
status = -EINVAL; status = -EINVAL;
osStatus = -EINVAL; osStatus = -EINVAL;
printk("drivducati_ioctl:Unsupported ioctl command specified"); printk(KERN_ERR "drivducati_ioctl:Unsupported"
" ioctl command specified");
} }
break; break;
} }
/* Set the status and copy the common args to user-side. */ /* Set the status and copy the common args to user-side. */
common_args.api_status = status; common_args.api_status = status;
retVal = copy_to_user((void*) cmd_args, retVal = copy_to_user((void *) cmd_args,
(const void*) &common_args, (const void *) &common_args,
sizeof(struct notify_ducatidrv_cmdargs)); sizeof(struct notify_ducatidrv_cmdargs));
if (retVal != 0) { if (retVal != 0) {
osStatus = -EFAULT; osStatus = -EFAULT;
} else { } else {
if (status == -ERESTARTSYS) { if (status == -ERESTARTSYS)
osStatus = -ERESTARTSYS; osStatus = -ERESTARTSYS;
} }
}
return osStatus; return osStatus;
} }
......
...@@ -59,8 +59,7 @@ ...@@ -59,8 +59,7 @@
#define PROC_DUCATI 1 #define PROC_DUCATI 1
#define PROC_GPP 2 #define PROC_GPP 2
extern u32 get_ducati_virt_mem(); static void notify_ducatidrv_isr(void *ref_data);
/* /*
...@@ -105,12 +104,6 @@ static struct notify_ducatidrv_module notify_ducatidriver_state = { ...@@ -105,12 +104,6 @@ static struct notify_ducatidrv_module notify_ducatidriver_state = {
.def_inst_params.send_int_id = (int) -1 .def_inst_params.send_int_id = (int) -1
}; };
void notify_ducatidrv_isr(void *ref_data);
/* /*
*This function searchs for a element the List. *This function searchs for a element the List.
*/ */
...@@ -154,7 +147,8 @@ int notify_ducatidrv_open(char *driver_name, ...@@ -154,7 +147,8 @@ int notify_ducatidrv_open(char *driver_name,
BUG_ON(driver_name == NULL); BUG_ON(driver_name == NULL);
BUG_ON(handle_ptr == NULL); BUG_ON(handle_ptr == NULL);
/* Enter critical section protection. */ /* Enter critical section protection. */
WARN_ON(mutex_lock_interruptible(notify_ducatidriver_state.gate_handle) != 0); WARN_ON(mutex_lock_interruptible(notify_ducatidriver_state.
gate_handle) != 0);
/* Get the handle from Notify module. */ /* Get the handle from Notify module. */
status = notify_get_driver_handle(driver_name, handle_ptr); status = notify_get_driver_handle(driver_name, handle_ptr);
WARN_ON(status < 0); WARN_ON(status < 0);
...@@ -197,7 +191,7 @@ void notify_ducatidrv_params_init(struct notify_driver_object *handle, ...@@ -197,7 +191,7 @@ void notify_ducatidrv_params_init(struct notify_driver_object *handle,
&(notify_ducatidriver_state.def_inst_params), &(notify_ducatidriver_state.def_inst_params),
sizeof(struct notify_ducatidrv_params)); sizeof(struct notify_ducatidrv_params));
} else { } else {
/* Return updated NotifyDriverShm instance specific parameters. */ /*Return updated NotifyDriverShm instance specific parameters*/
driver_obj = (struct notify_ducatidrv_object *) driver_obj = (struct notify_ducatidrv_object *)
handle->driver_object; handle->driver_object;
memcpy(params, &(driver_obj->params), memcpy(params, &(driver_obj->params),
...@@ -251,9 +245,9 @@ struct notify_driver_object *notify_ducatidrv_create(char *driver_name, ...@@ -251,9 +245,9 @@ struct notify_driver_object *notify_ducatidrv_create(char *driver_name,
/* This driver supports interaction with one other remote /* This driver supports interaction with one other remote
* processor.*/ * processor.*/
for (i = 0 ; i < MULTIPROC_MAXPROCESSORS ; i++) { for (i = 0 ; i < MULTIPROC_MAXPROCESSORS; i++) {
/* Initialize all to invalid. */ /* Initialize all to invalid. */
drv_attrs.proc_info [i].proc_id = (u16)0xFFFF; drv_attrs.proc_info[i].proc_id = (u16)0xFFFF;
} }
drv_attrs.numProc = 1; drv_attrs.numProc = 1;
drv_attrs.proc_info[params->remote_proc_id].max_events = drv_attrs.proc_info[params->remote_proc_id].max_events =
...@@ -269,13 +263,13 @@ struct notify_driver_object *notify_ducatidrv_create(char *driver_name, ...@@ -269,13 +263,13 @@ struct notify_driver_object *notify_ducatidrv_create(char *driver_name,
params->remote_proc_id; params->remote_proc_id;
/* Function table information */ /* Function table information */
fxn_table.register_event = (void*)&notify_ducatidrv_register_event; fxn_table.register_event = (void *)&notify_ducatidrv_register_event;
fxn_table.unregister_event= (void*)&notify_ducatidrv_unregister_event; fxn_table.unregister_event = (void *)&notify_ducatidrv_unregister_event;
fxn_table.send_event = (void*)&notify_ducatidrv_sendevent; fxn_table.send_event = (void *)&notify_ducatidrv_sendevent;
fxn_table.disable = (void*)&notify_ducatidrv_disable; fxn_table.disable = (void *)&notify_ducatidrv_disable;
fxn_table.restore = (void*)&notify_ducatidrv_restore; fxn_table.restore = (void *)&notify_ducatidrv_restore;
fxn_table.disable_event = (void*)&notify_ducatidrv_disable_event; fxn_table.disable_event = (void *)&notify_ducatidrv_disable_event;
fxn_table.enable_event = (void*)&notify_ducatidrv_enable_event; fxn_table.enable_event = (void *)&notify_ducatidrv_enable_event;
/* Register driver with the Notify module. */ /* Register driver with the Notify module. */
status = notify_register_driver(driver_name, status = notify_register_driver(driver_name,
...@@ -283,11 +277,9 @@ struct notify_driver_object *notify_ducatidrv_create(char *driver_name, ...@@ -283,11 +277,9 @@ struct notify_driver_object *notify_ducatidrv_create(char *driver_name,
&drv_attrs, &drv_attrs,
&drv_handle); &drv_handle);
if (status < 0) { if (status < 0) {
/* @retval NULL Failed to register driver with Notify module!*/ /*retval NULL Failed to register driver with Notify module!*/
status = -EINVAL; status = -EINVAL;
} else { } else {
/* Allocate memory for the NotifyDriverShm_Object object. */
/* Allocate memory for the NotifyDriverShm_Object object. */ /* Allocate memory for the NotifyDriverShm_Object object. */
drv_handle->driver_object = driver_obj = drv_handle->driver_object = driver_obj =
kmalloc(sizeof(struct notify_ducatidrv_object), kmalloc(sizeof(struct notify_ducatidrv_object),
...@@ -299,78 +291,74 @@ struct notify_driver_object *notify_ducatidrv_create(char *driver_name, ...@@ -299,78 +291,74 @@ struct notify_driver_object *notify_ducatidrv_create(char *driver_name,
} else { } else {
memcpy(&(driver_obj->params), (void *) params, memcpy(&(driver_obj->params), (void *) params,
sizeof(struct notify_ducatidrv_params)); sizeof(struct notify_ducatidrv_params));
} }
} }
if (status >= 0) { if (status >= 0) {
/*FIX ME Need to use MultiProc*/ /*FIX ME Need to use MultiProc*/
driver_obj->self_id = OTHER_ID; driver_obj->self_id = OTHER_ID;
driver_obj->other_id = SELF_ID; driver_obj->other_id = SELF_ID;
shm_va = get_ducati_virt_mem(); shm_va = get_ducati_virt_mem();
driver_obj->ctrl_ptr = (struct notify_shmdrv_ctrl *) shm_va; driver_obj->ctrl_ptr = (struct notify_shmdrv_ctrl *) shm_va;
ctrl_ptr = &(driver_obj->ctrl_ptr->proc_ctrl [driver_obj->self_id]); ctrl_ptr = &(driver_obj->ctrl_ptr->
proc_ctrl[driver_obj->self_id]);
ctrl_ptr->self_event_chart = (struct notify_shmdrv_event_entry *) ctrl_ptr->self_event_chart =
(struct notify_shmdrv_event_entry *)
((int)(driver_obj->ctrl_ptr) ((int)(driver_obj->ctrl_ptr)
+ sizeof(struct notify_shmdrv_ctrl) + sizeof(struct notify_shmdrv_ctrl)+
+(sizeof(struct notify_shmdrv_event_entry) (sizeof(struct
notify_shmdrv_event_entry)
* params->num_events * params->num_events
* driver_obj->other_id)); * driver_obj->other_id));
ctrl_ptr->other_event_chart = (struct notify_shmdrv_event_entry *) ctrl_ptr->other_event_chart =
(struct notify_shmdrv_event_entry *)
((int)(driver_obj->ctrl_ptr) ((int)(driver_obj->ctrl_ptr)
+ sizeof(struct notify_shmdrv_ctrl) + sizeof(struct notify_shmdrv_ctrl) +
+(sizeof(struct notify_shmdrv_event_entry) (sizeof(struct
notify_shmdrv_event_entry)
* params->num_events * params->num_events
* driver_obj->self_id)); * driver_obj->self_id));
driver_obj->proc_id = params->remote_proc_id; driver_obj->proc_id = params->remote_proc_id;
driver_obj->event_list = kmalloc(
(sizeof(struct notify_drv_eventlist)
driver_obj->event_list = kmalloc((sizeof(struct notify_drv_eventlist)
* params->num_events), GFP_ATOMIC); * params->num_events), GFP_ATOMIC);
if (driver_obj->event_list == NULL) { if (driver_obj->event_list == NULL) {
status = -ENOMEM; status = -ENOMEM;
goto func_end; goto func_end;
} else { } else {
memset(driver_obj->event_list, 0, memset(driver_obj->event_list, 0,
sizeof(struct notify_drv_eventlist)*params->num_events); sizeof(struct notify_drv_eventlist)*params->
num_events);
} }
driver_obj->reg_chart = kmalloc(sizeof(
driver_obj->reg_chart = kmalloc(sizeof(struct notify_shmdrv_eventreg) struct notify_shmdrv_eventreg)
*params->num_events, GFP_ATOMIC); *params->num_events,
GFP_ATOMIC);
if (driver_obj->reg_chart == NULL) { if (driver_obj->reg_chart == NULL) {
status = -ENOMEM; status = -ENOMEM;
goto func_end; goto func_end;
} else { } else {
memset(driver_obj->reg_chart, 0, sizeof(struct notify_shmdrv_eventreg) memset(driver_obj->reg_chart, 0,
sizeof(struct notify_shmdrv_eventreg)
*params->num_events); *params->num_events);
} }
event_list = driver_obj->event_list; event_list = driver_obj->event_list;
for (i = 0 ; (i < params->num_events) ; i++) { for (i = 0 ; (i < params->num_events) ; i++) {
ctrl_ptr->self_event_chart[i].flag = 0; ctrl_ptr->self_event_chart[i].flag = 0;
driver_obj->reg_chart[i].reg_event_no = (int) -1; driver_obj->reg_chart[i].reg_event_no = (int) -1;
event_list[i].event_handler_count = 0; event_list[i].event_handler_count = 0;
INIT_LIST_HEAD(&event_list[i].listeners); INIT_LIST_HEAD(&event_list[i].listeners);
} }
} }
mbox_hw_config = ntfy_disp_get_config(); mbox_hw_config = ntfy_disp_get_config();
mbox_module_no = mbox_hw_config->mbox_modules; mbox_module_no = mbox_hw_config->mbox_modules;
interrupt_no = mbox_hw_config->interrupt_lines[mbox_module_no-1]; interrupt_no = mbox_hw_config->interrupt_lines[mbox_module_no-1];
mbx_ret_val = ntfy_disp_bind_interrupt(interrupt_no, mbx_ret_val = ntfy_disp_bind_interrupt(interrupt_no,
(void *)notify_mailbx0_user0_isr, NULL); (void *)
notify_mailbx0_user0_isr, NULL);
/*Set up the ISR on the Modena-ducati FIFO */ /*Set up the ISR on the Modena-ducati FIFO */
if (mbx_ret_val == 0) { if (mbx_ret_val == 0) {
proc_id = PROC_DUCATI; proc_id = PROC_DUCATI;
...@@ -381,7 +369,8 @@ struct notify_driver_object *notify_ducatidrv_create(char *driver_name, ...@@ -381,7 +369,8 @@ struct notify_driver_object *notify_ducatidrv_create(char *driver_name,
if (mbx_ret_val == 0) { if (mbx_ret_val == 0) {
mbx_ret_val = ntfy_disp_interrupt_enable( mbx_ret_val = ntfy_disp_interrupt_enable(
mbox_module_no, (NOTIFYDRV_DUCATI_RECV_MBX * 2)); mbox_module_no,
(NOTIFYDRV_DUCATI_RECV_MBX * 2));
} }
} }
/*Set up the ISR on the Modena-Ducati FIFO */ /*Set up the ISR on the Modena-Ducati FIFO */
...@@ -399,14 +388,14 @@ struct notify_driver_object *notify_ducatidrv_create(char *driver_name, ...@@ -399,14 +388,14 @@ struct notify_driver_object *notify_ducatidrv_create(char *driver_name,
ctrl_ptr->send_init_status = NOTIFYSHMDRV_INIT_STAMP; ctrl_ptr->send_init_status = NOTIFYSHMDRV_INIT_STAMP;
drv_handle->is_init = NOTIFY_DRIVERINITSTATUS_DONE; drv_handle->is_init = NOTIFY_DRIVERINITSTATUS_DONE;
} else { } else {
/* Check if drvHandle was
/* Check if drvHandle was registered with Notify module. */ registered with Notify module. */
if (drv_handle != NULL) { if (drv_handle != NULL) {
/* Unregister driver from the Notify module. */ /* Unregister driver from the Notify module*/
notify_unregister_driver(drv_handle); notify_unregister_driver(drv_handle);
if (ctrl_ptr != NULL) { if (ctrl_ptr != NULL) {
/* Clear initialization status in shared memory. */ /* Clear initialization status in
shared memory. */
ctrl_ptr->recv_init_status = 0x0; ctrl_ptr->recv_init_status = 0x0;
ctrl_ptr->send_init_status = 0x0; ctrl_ptr->send_init_status = 0x0;
ctrl_ptr = NULL; ctrl_ptr = NULL;
...@@ -415,9 +404,15 @@ struct notify_driver_object *notify_ducatidrv_create(char *driver_name, ...@@ -415,9 +404,15 @@ struct notify_driver_object *notify_ducatidrv_create(char *driver_name,
if (driver_obj != NULL) { if (driver_obj != NULL) {
/* Check if event List was allocated. */ /* Check if event List was allocated. */
if (driver_obj->event_list != NULL) { if (driver_obj->event_list != NULL) {
/* Check if lists were created. */ /* Check if lists were
for (i = 0 ; i < params->num_events ; i++) { created. */
list_del((struct list_head *)&driver_obj->event_list[i].listeners); for (i = 0 ;
i < params->num_events ; i++) {
list_del(
(struct list_head *)
&driver_obj->
event_list[i].
listeners);
} }
kfree(driver_obj->event_list); kfree(driver_obj->event_list);
driver_obj->event_list = NULL; driver_obj->event_list = NULL;
...@@ -425,17 +420,17 @@ struct notify_driver_object *notify_ducatidrv_create(char *driver_name, ...@@ -425,17 +420,17 @@ struct notify_driver_object *notify_ducatidrv_create(char *driver_name,
/* Check if regChart was allocated. */ /* Check if regChart was allocated. */
if (driver_obj->reg_chart != NULL) { if (driver_obj->reg_chart != NULL) {
kfree(driver_obj->reg_chart); kfree(driver_obj->reg_chart);
driver_obj->reg_chart = NULL; driver_obj->reg_chart
= NULL;
} }
kfree(driver_obj); kfree(driver_obj);
} }
drv_handle->is_init= NOTIFY_DRIVERINITSTATUS_NOTDONE; drv_handle->is_init =
NOTIFY_DRIVERINITSTATUS_NOTDONE;
drv_handle = NULL; drv_handle = NULL;
} }
} }
func_end: func_end:
/* Leave critical section protection. */ /* Leave critical section protection. */
mutex_unlock(notify_ducatidriver_state.gate_handle); mutex_unlock(notify_ducatidriver_state.gate_handle);
...@@ -443,8 +438,6 @@ func_end: ...@@ -443,8 +438,6 @@ func_end:
} }
EXPORT_SYMBOL(notify_ducatidrv_create); EXPORT_SYMBOL(notify_ducatidrv_create);
/* /*
* brief Function to delete the instance of shared memory driver * brief Function to delete the instance of shared memory driver
* *
...@@ -462,11 +455,11 @@ int notify_ducatidrv_delete(struct notify_driver_object **handle_ptr) ...@@ -462,11 +455,11 @@ int notify_ducatidrv_delete(struct notify_driver_object **handle_ptr)
int interrupt_no; int interrupt_no;
int mbx_ret_val = 0; int mbx_ret_val = 0;
WARN_ON(handle_ptr == NULL); WARN_ON(handle_ptr == NULL);
if (handle_ptr == NULL) if (handle_ptr == NULL)
return -1; return -1;
driver_obj = (struct notify_ducatidrv_object *)(*handle_ptr)->driver_object; driver_obj = (struct notify_ducatidrv_object *)
(*handle_ptr)->driver_object;
drv_handle = (*handle_ptr); drv_handle = (*handle_ptr);
WARN_ON((*handle_ptr)->driver_object == NULL); WARN_ON((*handle_ptr)->driver_object == NULL);
...@@ -485,10 +478,10 @@ int notify_ducatidrv_delete(struct notify_driver_object **handle_ptr) ...@@ -485,10 +478,10 @@ int notify_ducatidrv_delete(struct notify_driver_object **handle_ptr)
if (driver_obj != NULL) { if (driver_obj != NULL) {
if (driver_obj->ctrl_ptr != NULL) { if (driver_obj->ctrl_ptr != NULL) {
/* Clear initialization status in shared memory. */ /* Clear initialization status in shared memory. */
driver_obj->ctrl_ptr->proc_ctrl[driver_obj->self_id].recv_init_status = driver_obj->ctrl_ptr->proc_ctrl[driver_obj->self_id].
0x0; recv_init_status = 0x0;
driver_obj->ctrl_ptr->proc_ctrl[driver_obj->self_id].send_init_status = driver_obj->ctrl_ptr->proc_ctrl[driver_obj->self_id].
0x0; send_init_status = 0x0;
driver_obj->ctrl_ptr = NULL; driver_obj->ctrl_ptr = NULL;
} }
...@@ -496,9 +489,11 @@ int notify_ducatidrv_delete(struct notify_driver_object **handle_ptr) ...@@ -496,9 +489,11 @@ int notify_ducatidrv_delete(struct notify_driver_object **handle_ptr)
if (event_list != NULL) { if (event_list != NULL) {
/* Check if lists were created. */ /* Check if lists were created. */
for (i = 0 ; i < driver_obj->params.num_events ; i++) { for (i = 0 ; i < driver_obj->params.num_events ; i++) {
WARN_ON(event_list[i].event_handler_count != 0); WARN_ON(event_list[i].
event_handler_count != 0);
event_list[i].event_handler_count = 0; event_list[i].event_handler_count = 0;
list_del((struct list_head *)&event_list[i].listeners); list_del((struct list_head *)
&event_list[i].listeners);
} }
kfree(event_list); kfree(event_list);
...@@ -531,7 +526,6 @@ int notify_ducatidrv_delete(struct notify_driver_object **handle_ptr) ...@@ -531,7 +526,6 @@ int notify_ducatidrv_delete(struct notify_driver_object **handle_ptr)
} }
return status; return status;
} }
EXPORT_SYMBOL(notify_ducatidrv_delete); EXPORT_SYMBOL(notify_ducatidrv_delete);
...@@ -541,16 +535,14 @@ EXPORT_SYMBOL(notify_ducatidrv_delete); ...@@ -541,16 +535,14 @@ EXPORT_SYMBOL(notify_ducatidrv_delete);
*/ */
int notify_ducatidrv_destroy(void) int notify_ducatidrv_destroy(void)
{ {
int status = 0; int status = 0;
WARN_ON(notify_ducatidriver_state.is_setup != true); WARN_ON(notify_ducatidriver_state.is_setup != true);
/* Check if the gate_handle was created internally. */ /* Check if the gate_handle was created internally. */
if (notify_ducatidriver_state.cfg.gate_handle == NULL) { if (notify_ducatidriver_state.cfg.gate_handle == NULL) {
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);
} }
}
notify_ducatidriver_state.is_setup = false; notify_ducatidriver_state.is_setup = false;
return status; return status;
} }
...@@ -586,8 +578,8 @@ int notify_ducatidrv_setup(struct notify_ducatidrv_config *cfg) ...@@ -586,8 +578,8 @@ int notify_ducatidrv_setup(struct notify_ducatidrv_config *cfg)
if (cfg->gate_handle != NULL) if (cfg->gate_handle != NULL)
notify_ducatidriver_state.gate_handle = cfg->gate_handle; notify_ducatidriver_state.gate_handle = cfg->gate_handle;
else { else {
notify_ducatidriver_state.gate_handle = kmalloc(sizeof(struct mutex), notify_ducatidriver_state.gate_handle =
GFP_KERNEL); kmalloc(sizeof(struct mutex), GFP_KERNEL);
mutex_init(notify_ducatidriver_state.gate_handle); mutex_init(notify_ducatidriver_state.gate_handle);
} }
...@@ -633,20 +625,24 @@ int notify_ducatidrv_register_event( ...@@ -633,20 +625,24 @@ int notify_ducatidrv_register_event(
BUG_ON(fn_notify_cbck == NULL); BUG_ON(fn_notify_cbck == NULL);
driver_object = (struct notify_ducatidrv_object *) handle->driver_object; driver_object = (struct notify_ducatidrv_object *)
handle->driver_object;
ctrl_ptr = driver_object->ctrl_ptr; ctrl_ptr = driver_object->ctrl_ptr;
/* Allocate memory for event listener. */ /* Allocate memory for event listener. */
event_listener = kmalloc(sizeof(struct notify_drv_eventlistner), GFP_ATOMIC); event_listener = kmalloc(sizeof(struct notify_drv_eventlistner),
GFP_ATOMIC);
if (event_listener == NULL) { if (event_listener == NULL) {
status = -ENOMEM; status = -ENOMEM;
goto func_end; goto func_end;
} else { } else {
memset(event_listener, 0, sizeof(struct notify_drv_eventlistner)); memset(event_listener, 0,
sizeof(struct notify_drv_eventlistner));
} }
if (mutex_lock_interruptible(notify_ducatidriver_state.gate_handle) != 0) if (mutex_lock_interruptible(notify_ducatidriver_state.gate_handle)
!= 0)
WARN_ON(1); WARN_ON(1);
event_list = driver_object->event_list; event_list = driver_object->event_list;
...@@ -679,9 +675,11 @@ int notify_ducatidrv_register_event( ...@@ -679,9 +675,11 @@ int notify_ducatidrv_register_event(
/* Find the correct slot in the registration array. */ /* Find the correct slot in the registration array. */
if (reg_chart[i].reg_event_no == (int) -1) { if (reg_chart[i].reg_event_no == (int) -1) {
for (j = (i - 1); j >= 0; j--) { for (j = (i - 1); j >= 0; j--) {
if (event_no < reg_chart[j].reg_event_no) { if (event_no < reg_chart[j].
reg_event_no) {
reg_chart[j + 1].reg_event_no = reg_chart[j + 1].reg_event_no =
reg_chart[j].reg_event_no; reg_chart[j].
reg_event_no;
reg_chart[j + 1].reserved = reg_chart[j + 1].reserved =
reg_chart[j].reserved; reg_chart[j].reserved;
i = j; i = j;
...@@ -743,13 +741,15 @@ int notify_ducatidrv_unregister_event( ...@@ -743,13 +741,15 @@ int notify_ducatidrv_unregister_event(
BUG_ON(handle == NULL); BUG_ON(handle == NULL);
BUG_ON(handle->driver_object == NULL); BUG_ON(handle->driver_object == NULL);
driver_object = (struct notify_ducatidrv_object *) handle->driver_object; driver_object = (struct notify_ducatidrv_object *)
handle->driver_object;
num_events = driver_object->params.num_events; num_events = driver_object->params.num_events;
ctrl_ptr = driver_object->ctrl_ptr; ctrl_ptr = driver_object->ctrl_ptr;
/* Enter critical section protection. */ /* Enter critical section protection. */
if (mutex_lock_interruptible(notify_ducatidriver_state.gate_handle) != 0) if (mutex_lock_interruptible(notify_ducatidriver_state.gate_handle)
!= 0)
WARN_ON(1); WARN_ON(1);
event_list = driver_object->event_list; event_list = driver_object->event_list;
...@@ -793,7 +793,8 @@ int notify_ducatidrv_unregister_event( ...@@ -793,7 +793,8 @@ int notify_ducatidrv_unregister_event(
} }
if (j == num_events) { if (j == num_events) {
reg_chart[j - 1].reg_event_no = (int) -1; reg_chart[j - 1].reg_event_no =
(int) -1;
} }
break; break;
} }
...@@ -817,7 +818,7 @@ int notify_ducatidrv_sendevent(struct notify_driver_object *handle, ...@@ -817,7 +818,7 @@ int notify_ducatidrv_sendevent(struct notify_driver_object *handle,
int payload, short int wait_clear) int payload, short int wait_clear)
{ {
int status = 0; int status = 0;
struct notify_ducatidrv_object*driver_object; struct notify_ducatidrv_object *driver_object;
struct notify_shmdrv_ctrl *ctrl_ptr; struct notify_shmdrv_ctrl *ctrl_ptr;
int max_poll_count; int max_poll_count;
struct notify_shmdrv_event_entry *other_event_chart; struct notify_shmdrv_event_entry *other_event_chart;
...@@ -829,56 +830,63 @@ int notify_ducatidrv_sendevent(struct notify_driver_object *handle, ...@@ -829,56 +830,63 @@ int notify_ducatidrv_sendevent(struct notify_driver_object *handle,
BUG_ON(handle == NULL); BUG_ON(handle == NULL);
BUG_ON(handle->driver_object == NULL); BUG_ON(handle->driver_object == NULL);
mbox_hw_config= ntfy_disp_get_config(); mbox_hw_config = ntfy_disp_get_config();
mbox_module_no = mbox_hw_config->mbox_modules; mbox_module_no = mbox_hw_config->mbox_modules;
driver_object = (struct notify_ducatidrv_object *) handle->driver_object; driver_object = (struct notify_ducatidrv_object *)
handle->driver_object;
BUG_ON(event_no > driver_object->params.num_events); BUG_ON(event_no > driver_object->params.num_events);
ctrl_ptr = driver_object->ctrl_ptr; ctrl_ptr = driver_object->ctrl_ptr;
other_event_chart = ctrl_ptr->proc_ctrl[driver_object->self_id].other_event_chart; other_event_chart = ctrl_ptr->proc_ctrl[driver_object->self_id].
other_event_chart;
max_poll_count = driver_object->params.send_event_poll_count; max_poll_count = driver_object->params.send_event_poll_count;
/* Check whether driver supports interrupts from this processor to the /* Check whether driver supports interrupts from this processor to the
* other processor, and if it is initialized other processor, and if it is initialized
*/ */
if (ctrl_ptr->proc_ctrl[driver_object->other_id].recv_init_status if (ctrl_ptr->proc_ctrl[driver_object->other_id].recv_init_status
!= NOTIFYSHMDRV_INIT_STAMP) { != NOTIFYSHMDRV_INIT_STAMP) {
status = -ENODEV; status = -ENODEV;
/* This may be used for polling till other-side driver is ready, so /* This may be used for polling till other-side
* do not set failure reason. driver is ready, sodo not set failure reason.
*/ */
} else { } else {
/* Check if other side is ready to receive this event. */ /* Check if other side is ready to receive this event. */
if ((TEST_BIT (ctrl_ptr->proc_ctrl[driver_object->other_id].reg_mask.mask, if ((TEST_BIT(ctrl_ptr->proc_ctrl[driver_object->other_id].
event_no) == false) reg_mask.mask, event_no) == false)
||(TEST_BIT (ctrl_ptr->proc_ctrl[driver_object->other_id]. || (TEST_BIT(ctrl_ptr->
reg_mask.enable_mask, event_no) == false)) { proc_ctrl[driver_object->other_id].reg_mask.
enable_mask, event_no) == false)) {
status = -ENODEV; status = -ENODEV;
/* This may be used for polling till other-side is ready, so /* This may be used for polling till other-side
* do not set failure reason. is ready, so do not set failure reason.*/
*/
} else { } else {
/* Enter critical section protection. */ /* Enter critical section protection. */
if (mutex_lock_interruptible(notify_ducatidriver_state.gate_handle) != 0) if (mutex_lock_interruptible(notify_ducatidriver_state.
gate_handle) != 0)
WARN_ON(1); WARN_ON(1);
if (wait_clear == true) { if (wait_clear == true) {
/* Wait for completion of previous event from other side. */ /*Wait for completion of prev
while ((other_event_chart [event_no].flag event from other side*/
while ((other_event_chart[event_no].flag
!= DOWN) != DOWN)
&& status == 0) { && status == 0) {
/* Leave critical section protection. Create a window /* Leave critical section protection
* of opportunity for other interrupts to be handled. Create a window of opportunity
for other interrupts to be handled.
*/ */
mutex_unlock(notify_ducatidriver_state.gate_handle); mutex_unlock(notify_ducatidriver_state.
gate_handle);
i++; i++;
if ((max_poll_count != (int) -1) if ((max_poll_count != (int) -1)
&& (i == max_poll_count)) { && (i == max_poll_count)) {
status = -EBUSY; status = -EBUSY;
} }
/* Enter critical section protection. */ /* Enter critical section protection. */
if (mutex_lock_interruptible(notify_ducatidriver_state.gate_handle) != 0) if (mutex_lock_interruptible(
notify_ducatidriver_state.
gate_handle) != 0)
WARN_ON(1); WARN_ON(1);
} }
} }
...@@ -886,9 +894,11 @@ int notify_ducatidrv_sendevent(struct notify_driver_object *handle, ...@@ -886,9 +894,11 @@ int notify_ducatidrv_sendevent(struct notify_driver_object *handle,
/* Set the event bit field and payload. */ /* Set the event bit field and payload. */
other_event_chart[event_no].payload = payload; other_event_chart[event_no].payload = payload;
other_event_chart[event_no].flag = UP; other_event_chart[event_no].flag = UP;
/* Send an interrupt with the event information to the /* Send an interrupt with the event
remote processor */ information to theremote processor */
mbx_ret_val = ntfy_disp_send(mbox_module_no, NOTIFYDRV_DUCATI_SEND_MBX, event_no); mbx_ret_val = ntfy_disp_send(mbox_module_no,
NOTIFYDRV_DUCATI_SEND_MBX,
event_no);
if (mbx_ret_val == 0) { if (mbx_ret_val == 0) {
status = 0; status = 0;
} else { } else {
...@@ -952,10 +962,12 @@ int notify_ducatidrv_disable_event( ...@@ -952,10 +962,12 @@ int notify_ducatidrv_disable_event(
BUG_ON(handle == NULL); BUG_ON(handle == NULL);
BUG_ON(handle->driver_object == NULL); BUG_ON(handle->driver_object == NULL);
access_count++; access_count++;
driver_object = (struct notify_ducatidrv_object *) handle->driver_object; driver_object = (struct notify_ducatidrv_object *)
handle->driver_object;
/* Enter critical section protection. */ /* Enter critical section protection. */
if (mutex_lock_interruptible(notify_ducatidriver_state.gate_handle) != 0) if (mutex_lock_interruptible(notify_ducatidriver_state.
gate_handle) != 0)
WARN_ON(1); WARN_ON(1);
CLEAR_BIT(driver_object->ctrl_ptr->proc_ctrl[driver_object->self_id]. CLEAR_BIT(driver_object->ctrl_ptr->proc_ctrl[driver_object->self_id].
...@@ -977,10 +989,12 @@ int notify_ducatidrv_enable_event(struct notify_driver_object *handle, ...@@ -977,10 +989,12 @@ int notify_ducatidrv_enable_event(struct notify_driver_object *handle,
BUG_ON(handle == NULL); BUG_ON(handle == NULL);
BUG_ON(handle->driver_object == NULL); BUG_ON(handle->driver_object == NULL);
driver_object = (struct notify_ducatidrv_object *) handle->driver_object; driver_object = (struct notify_ducatidrv_object *)
handle->driver_object;
/* Enter critical section protection. */ /* Enter critical section protection. */
if (mutex_lock_interruptible(notify_ducatidriver_state.gate_handle) != 0) if (mutex_lock_interruptible(notify_ducatidriver_state.
gate_handle) != 0)
WARN_ON(1); WARN_ON(1);
SET_BIT(driver_object->ctrl_ptr->proc_ctrl[driver_object->self_id]. SET_BIT(driver_object->ctrl_ptr->proc_ctrl[driver_object->self_id].
...@@ -997,7 +1011,7 @@ int notify_ducatidrv_enable_event(struct notify_driver_object *handle, ...@@ -997,7 +1011,7 @@ int notify_ducatidrv_enable_event(struct notify_driver_object *handle,
int notify_ducatidrv_debug(struct notify_driver_object *handle) int notify_ducatidrv_debug(struct notify_driver_object *handle)
{ {
int status = 0; int status = 0;
printk(KERN_WARNING "ducati Debug: Nothing being printed currently.\n"); printk(KERN_WARNING "ducati Debug: Nothing being printed currently\n");
return status; return status;
} }
...@@ -1008,7 +1022,7 @@ int notify_ducatidrv_debug(struct notify_driver_object *handle) ...@@ -1008,7 +1022,7 @@ int notify_ducatidrv_debug(struct notify_driver_object *handle)
* interrupt received from the Ducati processor. * interrupt received from the Ducati processor.
* *
*/ */
void notify_ducatidrv_isr(void *ref_data) static void notify_ducatidrv_isr(void *ref_data)
{ {
int payload = 0; int payload = 0;
int i = 0; int i = 0;
...@@ -1021,50 +1035,55 @@ void notify_ducatidrv_isr(void *ref_data) ...@@ -1021,50 +1035,55 @@ void notify_ducatidrv_isr(void *ref_data)
int event_no; int event_no;
driver_obj = (struct notify_ducatidrv_object *) ref_data; driver_obj = (struct notify_ducatidrv_object *) ref_data;
proc_ctrl_ptr= &(driver_obj->ctrl_ptr->proc_ctrl[driver_obj->self_id]); proc_ctrl_ptr = &(driver_obj->ctrl_ptr->proc_ctrl[driver_obj->self_id]);
reg_chart = driver_obj->reg_chart; reg_chart = driver_obj->reg_chart;
self_event_chart = proc_ctrl_ptr->self_event_chart; self_event_chart = proc_ctrl_ptr->self_event_chart;
/* Execute the loop till no asserted event is found for one complete loop /* Execute the loop till no asserted event
* through all registered events. is found for one complete loop
through all registered events
*/ */
do { do {
/* Check if the entry is a valid registered event. */ /* Check if the entry is a valid registered event.*/
event_no = reg_chart[i].reg_event_no; event_no = reg_chart[i].reg_event_no;
if (event_no != (int) -1) { /* Determine the current high priority event.*/
/* Determine the current high priority event. */ /* Check if the event is set and enabled.*/
/* Check if the event is set and enabled. */ if (self_event_chart[event_no].flag == UP &&
if (self_event_chart[event_no].flag == UP) { TEST_BIT(proc_ctrl_ptr->reg_mask.enable_mask,
if (TEST_BIT(proc_ctrl_ptr->reg_mask.enable_mask, event_no)) { event_no) && (event_no != (int) -1)) {
payload = self_event_chart[event_no].payload;
payload = self_event_chart[event_no].
payload;
/* Acknowledge the event. */ /* Acknowledge the event. */
self_event_chart[event_no].flag = DOWN; self_event_chart[event_no].flag = DOWN;
/* Call the callbacks associated with the event. */ /*Call the callbacks associated with the event*/
temp = driver_obj->event_list [event_no].listeners.next; temp = driver_obj->
event_list[event_no].
listeners.next;
if (temp != NULL) { if (temp != NULL) {
for (j = 0; j < driver_obj->event_list[event_no]. for (j = 0; j < driver_obj->
event_handler_count; j++) { event_list[event_no].
event_handler_count;
j++) {
/* Check for empty list. */ /* Check for empty list. */
if (temp != NULL) { if (temp == NULL)
((struct notify_drv_eventlistner *)temp)-> continue;
fn_notify_cbck(driver_obj-> ((struct notify_drv_eventlistner *)
proc_id, event_no, temp)->fn_notify_cbck(
driver_obj->proc_id,
event_no,
((struct notify_drv_eventlistner *) ((struct notify_drv_eventlistner *)
temp)->cbck_arg, temp)->cbck_arg,
payload); payload);
temp = temp->next; temp = temp->next;
} }
}
/* reinitialize the event check counter. */ /* reinitialize the event check counter. */
i = 0; i = 0;
} }
}
} else { } else {
/* check for next event. */ /* check for next event. */
i++; i++;
} }
}
} while ((event_no != (int) -1) } while ((event_no != (int) -1)
&& (i < driver_obj->params.num_events)); && (i < driver_obj->params.num_events));
} }
...@@ -1082,7 +1101,6 @@ static void notify_ducatidrv_qsearch_elem(struct list_head *list, ...@@ -1082,7 +1101,6 @@ static void notify_ducatidrv_qsearch_elem(struct list_head *list,
struct notify_drv_eventlistner *l_temp = NULL ; struct notify_drv_eventlistner *l_temp = NULL ;
short int found = false; short int found = false;
BUG_ON(list == NULL); BUG_ON(list == NULL);
BUG_ON(check_obj == NULL); BUG_ON(check_obj == NULL);
WARN_ON(listener == NULL); WARN_ON(listener == NULL);
...@@ -1095,7 +1113,8 @@ static void notify_ducatidrv_qsearch_elem(struct list_head *list, ...@@ -1095,7 +1113,8 @@ static void notify_ducatidrv_qsearch_elem(struct list_head *list,
temp = list->next; temp = list->next;
while ((found == false) && (temp != NULL)) { while ((found == false) && (temp != NULL)) {
l_temp = l_temp =
(struct notify_drv_eventlistner *)(temp); (struct notify_drv_eventlistner *)
(temp);
if ((l_temp->fn_notify_cbck == if ((l_temp->fn_notify_cbck ==
check_obj->fn_notify_cbck) && check_obj->fn_notify_cbck) &&
(l_temp->cbck_arg == (l_temp->cbck_arg ==
......
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