Running ioctl from kernel space

I am writing a kernel driver that ioctl should run on another device. I understand that this is not the best way to process the code, but this is only a temporary fix. I am returning an error code -22 (Invalid argument) from my ioctl call in a function, but I do not see what could be wrong with the arguments. Here are the relevant sections of the 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 this may be due to passing the wrong inode here, but I'm not even sure how to get the right inode if it is not the one that was passed ioctl from user space.

+3
source share
1 answer

" " , printk gpio, .

- : gpio,

+1

All Articles