Created
October 4, 2020 04:45
-
-
Save sepfy/ec91b2cc364f0ca207cc98569594f96f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static struct miscdevice my_miscdev = { | |
.minor = 11, | |
.name = "misc_dev", | |
.fops = &mydev_fops, | |
}; | |
static int __init init_modules(void) | |
{ | |
int ret; | |
ret = misc_register(&my_miscdev); | |
if (ret != 0) { | |
printk("cannot register miscdev on minor=11 (err=%d)\n",ret); | |
} | |
return 0; | |
} | |
static void __exit exit_modules(void) | |
{ | |
misc_deregister(&my_miscdev); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment