#include <linux/miscdevice.h>
混杂设备:主设备号为10的字符设备
struct miscdevice
{
int minor; //次设备号
const char *name;
const struct file_operations *fops;
struct list_head list;
struct device *parent;
struct device *this_device;
}
混杂设备注册
int misc_register (struct miscdevice * misc);
int misc_deregister (struct miscdevice * misc);
例:
struct miscdevice misc = {
.minor = 12, //若需动态分配填255,不为0为静态分配
.name = DEVICE_NAME,
.fops = &dev_fops,
}
时间: 2024-12-29 09:14:01