static struct file_operations xxx_fops = {
.read = xxx_read,
.write = xxx_write,
.open = xxx_open,
.release = xxx_release,
.owner = THIS_MODULE,
};
static struct cdev xxx_cdev = {
.kobj = {.name = "xxx", },
.owner = THIS_MODULE,
};
static int __init xxx_init(void)
{
dev_t dev = MKDEV(XXX_MAJOR, 0);
if (register_chrdev_region(dev, MAX_XXX_MINORS, "xxx"))
goto error;
cdev_init(&xxx_cdev, &xxx_fops);
...