linux驅動程序 - ioctl與unlocked_ioctl區別

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


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章