Hi,
I am getting this error, I dont know for what reason i am getting this error, works for when compiled for PC
doesnt work when compiled for i.mx8mmini
------------------------------------------Error------------------------------------------------------
error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
.write=device_write,
^~~~~~~~~~~~
/home/santhosh/Desktop/IP_Camera/App_development/Driver/imx8mmini_gpio_platformdevice.c:280:10: note: (near initialization for 'Fops.write')
/home/santhosh/Desktop/IP_Camera/App_development/Driver/imx8mmini_gpio_platformdevice.c:283:19: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
.unlocked_ioctl=gpio_ioctl
--------------------------------------------------------------------------------------------------------------
The code is for quick reference
-------------------------------------start-code--------------------------------------------------------
struct file_operations Fops =
{
.owner = THIS_MODULE,
.read = device_read,
.write = device_write,
.open = device_open,
.release = device_release,
.unlocked_ioctl = gpio_ioctl
};
static int device_open(struct inode *inode, struct file *file)
{
return 0;
}
static int device_release(struct inode *inode, struct file *file)
{
return 0;
}
static ssize_t device_read(struct file *file, char __user *buffer, size_t length, loff_t * offset)
{
return 0;
}
//static ssize_t device_write(struct file *file, const char __user *user_buf, size_t count, loff_t *ppos)
static ssize_t device_write(struct file *file, char __user *buffer, size_t length, loff_t * offset)
{
return 0;
}
int gpio_ioctl(struct file *file, unsigned int ioctl_num, unsigned long ioctl_param)
{
return 0;
}
------------------------------------------------end-Code-----------------------------------------------------------
How can i resolve this issue
Regards
Santhosh
Solved! Go to Solution.
The Issue got resolved, Its the GCC revision issue
Added a library and Recompiled it worked
Reference Link:c - Why am I getting an initialization from incompatible pointer type warning? - Stack Overflow
one can try to recompile from scratch image (including application) using documentation :
Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
The Issue got resolved, Its the GCC revision issue
Added a library and Recompiled it worked
Reference Link:c - Why am I getting an initialization from incompatible pointer type warning? - Stack Overflow
It seems you have -Werror compiler flag enabled. See this link link.