全部博文(674)
标题 | 阅读 | 评论 | 转发 | 发布日期 | |
---|---|---|---|---|---|
移植wireless tools 到android并测试 | 1936 | 0 | 0 | 2012-08-23 | |
Android 4.0 的Linux Kernel 下载方法 | 1618 | 0 | 1 | 2011-11-19 | |
[6410][android]成功移植android 1.5cupcake内核到S3C6410 | 2319 | 0 | 0 | 2010-08-21 | |
android移植 | 1345 | 0 | 3 | 2010-08-21 | |
移植Android2.1(转自友善之臂) | 1921 | 0 | 2 | 2010-08-21 | |
移植android 到诺基亚 N810(Android kernel和通用kernel的区别) | 1271 | 0 | 0 | 2010-08-21 | |
Simple Guide for Porting Android Kernel | 1334 | 0 | 0 | 2010-07-05 | |
内核移植和Android文件系统 | 1907 | 0 | 1 | 2010-07-05 | |
移植 Android 到 QQ2440 | 1648 | 0 | 1 | 2010-07-01 | |
Simple Android Porting Guide | 1251 | 0 | 1 | 2010-06-30 |
chen_chuang2012-10-11 16:33
高手,有本书上写cdev初始化和注册是这样写的
static void VirtualDisk_setup_cdev(struct VirtualDisk *dev, int minor)
{
int err;
devno = MDDEV(VirtualDisk_major, minor);
cdev_init(&dev->cdev, &VirtualDisk_fops);
dev->cdev.owner = THIS_MOUDULE;
dev->cdev.ops = &VirtualDisk_fops;
err = cdev_add(&dev->cdev, debno, 1);
if (err)
printk(KERN_NOTICE "Error in cdev_add()\n");
}
而cdev_init里
void cdev_init(struct cdev *cdev, const struct file_operations *fops)
{
memset(cdev, 0, sizeof *cdev);
INIT_LIST_HEAD(&cdev->list);
kobject_init(&cdev->kobj, &ktype_cdev_default);
cdev->ops = fops;
}
已经有cdev->ops = fops了
那上面的代码cdev_init之后又有dev->cdev.ops ,这两个函数不一样吗,自我感觉有点多次一举,,,不太明白