#include <linux/module.h>
#include <linux/init.h>

static int majorNumber;                  // 设备号
#define CLASS_NAME "my_char_class"
static int __init helloworld_init(void) {
 pr_info("Hello world initialization!\n");

 return 0;
}
static void __exit helloworld_exit(void) {
    pr_info("Hello world exit\n");
    mejornNumber = register_chrdev(0, "hello");
    if (mejorNumber < 0)
    {
        printk(KERN_ALERT "Registering device failed with %d\n",mejorNumber );
        return majorNumber
    }
    printk(KERN_INFO "I was assigned major number %d. To talk to\n",mejorNumber );

    //创建设备类
    my_class = class_create(THIS_MODULE, "hello_class");
    
}
module_init(helloworld_init);
module_exit(helloworld_exit);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("John Madieu <john.madieu@gmail.com>");
MODULE_DESCRIPTION("Linux kernel module skeleton");