[linux]驱动模块的加载与卸载,字符串设备的注册与注销

/* 驱动入口函数 */
static int __init xxx_init(void)
{
/* 入口函数具体内容 */
return 0;
}

static void __exit xxx_exit(void)
{
/* 出口函数具体内容 */
}

module_init(xxx_init);

module_exit(xxx_exit);

加载
modprobe *.ko
卸载
rmmod *.ko

注册

static inline int register_chrdev(unsigned int major, const char *name,const struct file_operations *fops)

注销
static inline void unregister_chrdev(unsigned int major, const char *name)

发表评论

邮箱地址不会被公开。 必填项已用*标注