标题 | 阅读 | 评论 | 转发 | 发布日期 | |
---|---|---|---|---|---|
打开Android C文件中的LOG | 1194 | 0 | 0 | 2011-05-31 | |
一个打通jni,java framework,application三层的练习 | 1341 | 0 | 1 | 2011-05-30 | |
Android NDK 学习笔记 | 981 | 0 | 1 | 2011-05-30 | |
JNI Hello World | 1275 | 0 | 0 | 2011-05-27 | |
Android: android sensors, HAL范例 | 2045 | 0 | 2 | 2011-05-24 | |
Android Sensor工作流程 | 1392 | 0 | 0 | 2011-05-23 | |
udev与硬件抽象层HAL的实现原理 | 872 | 0 | 0 | 2011-05-23 | |
阅读android有关sensor的源码总结 | 1012 | 0 | 0 | 2011-05-20 | |
Android属性系统 | 724 | 0 | 1 | 2011-05-20 | |
ADROID 2.1 架构解析 3 亮度设置 | 644 | 0 | 0 | 2011-05-18 | |
android读写光传感器数据的程序 | 1076 | 0 | 0 | 2011-05-18 | |
How to setup Marvell 88w8686 SDIO wifi | 1556 | 0 | 1 | 2011-05-16 | |
linux-2.6.26下开发marvell 88w8686 wifi驱动 | 1268 | 0 | 1 | 2011-05-16 | |
Ubuntu 10.04上腾达W541U V2.0 无线网卡驱动的使用 | 1916 | 0 | 0 | 2011-05-15 | |
Wireless Tools for Linux | 939 | 0 | 0 | 2011-05-15 | |
RT3070wifi模块的移植 | 772 | 1 | 0 | 2011-05-15 | |
linux无线网络配置 | 756 | 0 | 0 | 2011-05-15 | |
java环境变量配置 | 748 | 0 | 1 | 2011-05-12 | |
ARM平台上蓝牙协议栈Bluez的移植使用和配置 | 1759 | 0 | 1 | 2011-05-09 | |
libCurl/openssl/Zlib的ARM移植 | 1426 | 0 | 0 | 2011-05-08 |
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 ,这两个函数不一样吗,自我感觉有点多次一举,,,不太明白