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