Lines Matching refs:mtty_dev
71 static struct mtty_dev { struct
77 } mtty_dev; argument
1318 memset(&mtty_dev, 0, sizeof(mtty_dev)); in mtty_dev_init()
1320 idr_init(&mtty_dev.vd_idr); in mtty_dev_init()
1322 ret = alloc_chrdev_region(&mtty_dev.vd_devt, 0, MINORMASK + 1, in mtty_dev_init()
1330 cdev_init(&mtty_dev.vd_cdev, &vd_fops); in mtty_dev_init()
1331 cdev_add(&mtty_dev.vd_cdev, mtty_dev.vd_devt, MINORMASK + 1); in mtty_dev_init()
1333 pr_info("major_number:%d\n", MAJOR(mtty_dev.vd_devt)); in mtty_dev_init()
1339 mtty_dev.vd_class = class_create(THIS_MODULE, MTTY_CLASS_NAME); in mtty_dev_init()
1341 if (IS_ERR(mtty_dev.vd_class)) { in mtty_dev_init()
1343 ret = PTR_ERR(mtty_dev.vd_class); in mtty_dev_init()
1347 mtty_dev.dev.class = mtty_dev.vd_class; in mtty_dev_init()
1348 mtty_dev.dev.release = mtty_device_release; in mtty_dev_init()
1349 dev_set_name(&mtty_dev.dev, "%s", MTTY_NAME); in mtty_dev_init()
1351 ret = device_register(&mtty_dev.dev); in mtty_dev_init()
1355 ret = mdev_register_device(&mtty_dev.dev, &mtty_driver); in mtty_dev_init()
1361 device_unregister(&mtty_dev.dev); in mtty_dev_init()
1363 class_destroy(mtty_dev.vd_class); in mtty_dev_init()
1367 cdev_del(&mtty_dev.vd_cdev); in mtty_dev_init()
1368 unregister_chrdev_region(mtty_dev.vd_devt, MINORMASK + 1); in mtty_dev_init()
1374 mtty_dev.dev.bus = NULL; in mtty_dev_exit()
1375 mdev_unregister_device(&mtty_dev.dev); in mtty_dev_exit()
1377 device_unregister(&mtty_dev.dev); in mtty_dev_exit()
1378 idr_destroy(&mtty_dev.vd_idr); in mtty_dev_exit()
1380 cdev_del(&mtty_dev.vd_cdev); in mtty_dev_exit()
1381 unregister_chrdev_region(mtty_dev.vd_devt, MINORMASK + 1); in mtty_dev_exit()
1382 class_destroy(mtty_dev.vd_class); in mtty_dev_exit()
1383 mtty_dev.vd_class = NULL; in mtty_dev_exit()