结构体添加到系统中,并将dev(注册好的设备编号)放入cdev-> dev里, count(次设备编号个数)放入cdev->count里*/
int cdev_add(struct cdev *p,.../module.h>
#include
#include
#include
#include
#include
static int hello_fops1_open(struct inode *inode, struct file *file)...(&hello1_cdev, &hello1_fops);
cdev_add(&hello1_cdev, MKDEV(major,0), 2); //(major,0) (...major,1)
cdev_init(&hello2_cdev, &hello2_fops);
cdev_add(&hello2_cdev,MKDEV(major,2), 2);