全部博文(674)
标题 | 阅读 | 评论 | 转发 | 发布日期 | |
---|---|---|---|---|---|
嵌入式Linux的实时性分析和改进 | 929 | 0 | 1 | 2012-06-04 | |
linux内核的nohz与hres | 1438 | 0 | 0 | 2010-06-22 | |
Linux时钟基本概念 | 1300 | 0 | 0 | 2010-05-25 | |
Linux 时钟处理机制 | 904 | 0 | 0 | 2010-05-25 | |
linux新内核的时钟机制代码读后感 | 1520 | 0 | 0 | 2010-05-24 | |
hrtimer小记 | 2851 | 0 | 0 | 2010-05-24 | |
hrtimer + clockevent + Timekeeping | 1026 | 0 | 0 | 2010-05-24 | |
s3c2410 Timer工作原理 | 935 | 0 | 0 | 2010-05-16 | |
Linux内核的时钟中断机制 (8) | 1213 | 0 | 0 | 2010-03-31 | |
Linux内核的时钟中断机制 (7) | 755 | 0 | 0 | 2010-03-31 | |
Linux内核的时钟中断机制 (6) | 751 | 0 | 0 | 2010-03-31 | |
Linux内核的时钟中断机制 (5) | 967 | 0 | 0 | 2010-03-31 | |
Linux内核的时钟中断机制 (4) | 1150 | 0 | 0 | 2010-03-31 | |
Linux内核的时钟中断机制 (3) | 815 | 0 | 0 | 2010-03-30 | |
如何启用2410的第二个时钟 | 814 | 0 | 0 | 2010-03-30 | |
linux HZ Tick Jiffies | 850 | 0 | 0 | 2010-03-30 | |
2410 PWM Timer | 1097 | 0 | 0 | 2010-03-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 ,这两个函数不一样吗,自我感觉有点多次一举,,,不太明白