全部博文(674)
标题 | 阅读 | 评论 | 转发 | 发布日期 | |
---|---|---|---|---|---|
【推荐】 android switch模块 | 2560 | 0 | 0 | 2013-01-29 | |
I2S PCM温故知新 | 1482 | 0 | 0 | 2012-07-06 | |
Android实现检测耳机插入和拔出 | 2396 | 0 | 0 | 2012-06-25 | |
耳机检测 | 1392 | 0 | 0 | 2012-06-25 | |
【推荐】 Linux音频驱动之一:ALSA架构简介 | 1327 | 0 | 0 | 2011-04-12 | |
linux音频alsa-uda134x驱动文档阅读之九(咔咔声) | 1999 | 0 | 0 | 2011-01-14 | |
linux音频alsa-uda134x驱动文档阅读之七(机器驱动) | 1986 | 0 | 0 | 2011-01-14 | |
linux音频alsa-uda134x驱动文档阅读之六 | 1877 | 0 | 0 | 2011-01-14 | |
linux音频alsa-uda134x驱动文档阅读之三(解码器) | 855 | 0 | 0 | 2011-01-14 | |
linux音频alsa-uda134x驱动文档阅读之二(时钟) | 913 | 0 | 0 | 2011-01-14 | |
linux音频alsa-uda134x驱动文档阅读之一(over-view) | 897 | 0 | 0 | 2011-01-14 |
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 ,这两个函数不一样吗,自我感觉有点多次一举,,,不太明白