static void dm_exit(void) { dev_t devno = MKDEV(gDrvrMajor, 0); /* Get rid of our char dev entries */ if (drvr_devices) { int i; for (i = 0; i < 2; i++) { if (i == 0) { i2c_unregister_device(drvr_devices[i].data.prog.i2c_io); } device_destroy(drvr_class, MKDEV(gDrvrMajor, i)); cdev_del(&drvr_devices[i].cdev); } kfree(drvr_devices); } class_destroy(drvr_class); /* cleanup_module is never called if registering failed */ unregister_chrdev_region(devno, 2); ioctl_exit(); }
static void dm_exit(void) { dev_t devno = MKDEV(gDrvrMajor, 0); /* Get rid of our char dev entries */ if (drvr_devices) { device_destroy(drvr_class, MKDEV(gDrvrMajor, 0)); cdev_del(&drvr_devices[0].cdev); kfree(drvr_devices); } class_destroy(drvr_class); /* cleanup_module is never called if registering failed */ unregister_chrdev_region(devno, 2); ioctl_exit(); }