I'm writing a kernel driver that needs to perform an ioctl on another device. I realize this is not the best way to handle the code, but this is just a temporary fix for now. I'm getting back error code -22 (Invalid argument) from my ioctl call in the function, but I don't see what could be wrong with the arguments. Here are the relevant sections of code.
#define GPIO74 "/dev/gpio/74"
struct file* gpio74FD;
.
.
.
gpio74FD = filp_open(GPIO74,O_RDWR,0)
.
.
.
int device_ioctl(struct inode* inode,struct file *file, unsigned int ioctl_num,unsigned long ioctl_param)
{
.
.
.
ret_val = gpio74FD->f_op->ioctl(inode, gpio74FD, GPIO_CONFIG_AS_INP, 0); //returns error code -22 (Invlaid Argument)
.
.
.
return ret_val;
}
I suspect it may have something to do with passing the incorrect inode here, but im not even sure how to get the correct inode if its not the one passed to ioctl from the user space.