cdev_del — remove a cdev from the system Synopsis void fsfunc cdev_del( struct cdev * p); Arguments p : the cdev structure to be removed Description cdev_del removes p from the system, possibly freeing the structure itself. void cdev_del(struct cdev *p) { cdev_unmap(p->dev, p->co...
cdev_init(&cdev,&hello_ops); error = cdev_add(&cdev,devno,1); if(error <0) { printk("cdev_add fail \n"); unregister_chrdev_region(devno,1); returnerror; } return0; } staticvoidhello_exit(void) { printk("hello_exit \n"); cdev_del(cdev); unregister_chrdev_region(devno,1);...
* cdev_init() - initialize a cdev structure * @cdev: the structure to initialize * @fops: the file_operations for this device * * Initializes @cdev, remembering @fops, making it ready to add to the * system with cdev_add(). */voidcdev_init(structcdev *cdev,conststructfile_operations...
当一个字符设备驱动不再需要的时候(比如模块卸载),就可以用 cdev_del() 函数来释放 cdev 占用的内存。 void cdev_del(struct cdev *p) { cdev_unmap(p->dev, p->count); kobject_put(&p->kobj); } 其中cdev_unmap() 调用 kobj_unmap() 来释放 cdev_map 散列表中的对象。kobject_put() 释放 cdev...
5.当一个字符设备驱动不再需要的时候(比如模块卸载),就可以用cdev_del()函数来释放cdev占用的内存 void cdev_del(struct cdev *p) { cdev_unmap(p->dev, p->count); kobject_put(&p->kobj); } 其中cdev_unmap()调用kobj_unmap()来释放cdev_map散列表中的对象。kobject_put()释放cdev结构本身。
cdev_del(&my_cdev);return-1; }return0; } 开发者ID:gurugio,项目名称:ldd,代码行数:39,代码来源:drv.c 示例2: mod_gpio_init ▲点赞 5▼ staticintmod_gpio_init(void){ S32 s32Ret;dev_tdev; GPIO_PRINT("%s is invoked\n", __FUNCTION__);if(GPIODev.s32MajorGPIO) ...
void cdev_del(struct cdev *p) { cdev_unmap(p->dev, p->count); kobject_put(&p->kobj); } 其中cdev_unmap() 调用 kobj_unmap() 来释放 cdev_map 散列表中的对象。kobject_put() 释放 cdev 结构本身。
("register_chrdev_region fail \n");returnresult;}cdev_init(&cdev,&hello_ops);error = cdev_add(&cdev,devno,1);if(error < 0){printk("cdev_add fail \n");unregister_chrdev_region(devno,1);returnerror;}return0;}staticvoid hello_exit(void){printk("hello_exit \n");cdev_del(cdev);...
error = cdev_add(&cdev,devno,1); if(error <0) { printk("cdev_add fail \n"); unregister_chrdev_region(devno,1); returnerror; } return0; } staticvoidhello_exit(void) { printk("hello_exit \n"); cdev_del(cdev); unregister_chrdev_region(devno,1); ...
cdev = cdev_alloc(); if (!cdev) goto out2; cdev->owner = fops->owner; cdev->ops = fops; kobject_set_name(&cdev->kobj, "%s", name); err = cdev_add(cdev, MKDEV(cd->major, baseminor), count); if (err) goto out;