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;
} }
......
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