Android 编译2.6.36的kernel akm8975 driver时unknown field 'ioctl' specified in initializer的问题

来源:互联网 发布:247143nx 4010淘宝价格 编辑:程序博客网 时间:2024/06/05 00:13

最近在学习Android源代码的结构,需要经常编译内核

在单独编译Andrioid linux kernel的时候再编译到/driver/misc/akm8975.c 时出现

问题主要是linux 2.6.36的驱动机制里file_operation关于ioctl这块改动比较大

所以导致了unknown field 'ioctl' specified in initializer的这个问题

 

原来内核的ioctl注册方法:

 

例:

static int ***_ioctl(Struct inode *in,struct file *filp,unsigned int cmd,unsigned long arg)

{

..........//内容

}

 

.........

 

static struct file_operations  ***_fops={

.open = ***_open,

.read = ***_read,

.ioctl  = ***_ioctl,

}

////////////////**********************************************//////////////////

 

2.6.36内核的ioctl改动:

去掉了原来的ioctl,添加两个新的成员,所以会出错

  1.  long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
  2.  long (*compat_ioctl) (struct file *, unsigned int, unsigned long);

例:

static long ***_unlocked_ioctl(struct file *filp,unsigned int cmd,unsigned long arg)

{

..........//内容

}

 

static struct file_operations ***_fops={

.open=***_open,

.....,

.unlocked = ***_unlocked_ioctl;

}

 

////////////////**********************************************//////////////////

 

运气好的话按照这个样子更改,是能够通过编译通过 :)

原创粉丝点击