标题 | 阅读 | 评论 | 转发 | 发布日期 | |
---|---|---|---|---|---|
【推荐】 深入理解Android系统第一弹 | 2833 | 0 | 1 | 2013-01-26 | |
android Vold Usb | 1286 | 0 | 0 | 2012-11-28 | |
Timed GPIO | 1145 | 0 | 0 | 2012-07-11 | |
Android: Android Light Sensor HOWTO . | 1152 | 0 | 1 | 2011-08-29 | |
Android: android sensors, HAL范例 | 2045 | 0 | 2 | 2011-05-24 | |
阅读android有关sensor的源码总结 | 1012 | 0 | 0 | 2011-05-20 | |
frescale9.1 move app to sdcard 记录 | 1457 | 0 | 0 | 2011-04-28 | |
Android HAL | 1594 | 0 | 0 | 2010-10-20 | |
android触摸屏坐标手工校准/调整成功 | 1288 | 0 | 1 | 2010-08-21 | |
Android 实现触摸屏校准 | 1233 | 0 | 0 | 2010-08-21 | |
Android 启动过程总结 | 1217 | 0 | 3 | 2010-07-05 | |
android的logcat详细用法 | 1259 | 0 | 1 | 2010-07-05 | |
Android Initialization Process | 1492 | 0 | 0 | 2010-07-05 | |
Android init 启动过程分析 | 1205 | 0 | 0 | 2010-07-05 | |
Android PMEM驱动研究 在应用程序中使用PMEM | 2830 | 0 | 0 | 2010-06-11 | |
Android电源管理 | 1016 | 0 | 0 | 2010-03-31 | |
Android对Kernel的改动汇总 | 2336 | 0 | 1 | 2010-03-29 | |
Android内核的简单分析 | 1174 | 0 | 1 | 2010-03-29 |
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 ,这两个函数不一样吗,自我感觉有点多次一举,,,不太明白