在kernel 2.6.36 中已经完全删除了struct file_operations 中的ioctl 函数指针,取而代之的是unlocked_ioctl
1 驱动程序的修改:
static struct file_operations hi_i2c_fops = { .owner = THIS_MODULE, // .ioctl = I2C_Ioctl , .unlocked_ioctl = I2C_Ioctl , .open = I2C_Open , .release = I2C_Close , };
2 main.c中还是使用ioctl()函数
int main() { ... ret = ioctl(fd, GPIO_I2C_WRITE, &value); ... }