Lines Matching refs:mtty_dev
69 static struct mtty_dev {
76 } mtty_dev;
1393 pr_info("mtty_dev: %s\n", __func__);
1395 memset(&mtty_dev, 0, sizeof(mtty_dev));
1397 idr_init(&mtty_dev.vd_idr);
1399 ret = alloc_chrdev_region(&mtty_dev.vd_devt, 0, MINORMASK + 1,
1403 pr_err("Error: failed to register mtty_dev, err:%d\n", ret);
1407 cdev_init(&mtty_dev.vd_cdev, &vd_fops);
1408 cdev_add(&mtty_dev.vd_cdev, mtty_dev.vd_devt, MINORMASK + 1);
1410 pr_info("major_number:%d\n", MAJOR(mtty_dev.vd_devt));
1416 mtty_dev.vd_class = class_create(MTTY_CLASS_NAME);
1418 if (IS_ERR(mtty_dev.vd_class)) {
1419 pr_err("Error: failed to register mtty_dev class\n");
1420 ret = PTR_ERR(mtty_dev.vd_class);
1424 mtty_dev.dev.class = mtty_dev.vd_class;
1425 mtty_dev.dev.release = mtty_device_release;
1426 dev_set_name(&mtty_dev.dev, "%s", MTTY_NAME);
1428 ret = device_register(&mtty_dev.dev);
1432 ret = mdev_register_parent(&mtty_dev.parent, &mtty_dev.dev,
1440 device_del(&mtty_dev.dev);
1442 put_device(&mtty_dev.dev);
1443 class_destroy(mtty_dev.vd_class);
1447 cdev_del(&mtty_dev.vd_cdev);
1448 unregister_chrdev_region(mtty_dev.vd_devt, MINORMASK + 1);
1454 mtty_dev.dev.bus = NULL;
1455 mdev_unregister_parent(&mtty_dev.parent);
1457 device_unregister(&mtty_dev.dev);
1458 idr_destroy(&mtty_dev.vd_idr);
1460 cdev_del(&mtty_dev.vd_cdev);
1461 unregister_chrdev_region(mtty_dev.vd_devt, MINORMASK + 1);
1462 class_destroy(mtty_dev.vd_class);
1463 mtty_dev.vd_class = NULL;
1464 pr_info("mtty_dev: Unloaded!\n");