Menu Home

linux kernel driver自动创建设备

static int watchdog_init(void)
{
wdt_major = register_chrdev(0, "lte8718wdt", <e8718wdt_fopts);
wdt_class = class_create(THIS_MODULE, wdt_name);
device_create(wdt_class, NULL, MKDEV(wdt_major, 0), NULL, wdt_name);
}

static int watchdog_exit(void)
{
device_destroy(wdt_class, MKDEV(wdt_major, 0));
class_destroy(wdt_class);
unregister_chrdev(lte8718wdt_major, "lte8718wdt");
}

Categories: linux linux kernel 硬件驱动

Tagged as:

lnmcc

Leave a Reply

Your email address will not be published.