Lines Matching refs:tcd

49 	struct tape_class_device *	tcd;  in register_tape_dev()  local
53 tcd = kzalloc(sizeof(struct tape_class_device), GFP_KERNEL); in register_tape_dev()
54 if (!tcd) in register_tape_dev()
57 strlcpy(tcd->device_name, device_name, TAPECLASS_NAME_LEN); in register_tape_dev()
58 for (s = strchr(tcd->device_name, '/'); s; s = strchr(s, '/')) in register_tape_dev()
60 strlcpy(tcd->mode_name, mode_name, TAPECLASS_NAME_LEN); in register_tape_dev()
61 for (s = strchr(tcd->mode_name, '/'); s; s = strchr(s, '/')) in register_tape_dev()
64 tcd->char_device = cdev_alloc(); in register_tape_dev()
65 if (!tcd->char_device) { in register_tape_dev()
70 tcd->char_device->owner = fops->owner; in register_tape_dev()
71 tcd->char_device->ops = fops; in register_tape_dev()
73 rc = cdev_add(tcd->char_device, dev, 1); in register_tape_dev()
77 tcd->class_device = device_create(tape_class, device, in register_tape_dev()
78 tcd->char_device->dev, NULL, in register_tape_dev()
79 "%s", tcd->device_name); in register_tape_dev()
80 rc = PTR_ERR_OR_ZERO(tcd->class_device); in register_tape_dev()
85 &tcd->class_device->kobj, in register_tape_dev()
86 tcd->mode_name in register_tape_dev()
91 return tcd; in register_tape_dev()
94 device_destroy(tape_class, tcd->char_device->dev); in register_tape_dev()
97 cdev_del(tcd->char_device); in register_tape_dev()
100 kfree(tcd); in register_tape_dev()
106 void unregister_tape_dev(struct device *device, struct tape_class_device *tcd) in unregister_tape_dev() argument
108 if (tcd != NULL && !IS_ERR(tcd)) { in unregister_tape_dev()
109 sysfs_remove_link(&device->kobj, tcd->mode_name); in unregister_tape_dev()
110 device_destroy(tape_class, tcd->char_device->dev); in unregister_tape_dev()
111 cdev_del(tcd->char_device); in unregister_tape_dev()
112 kfree(tcd); in unregister_tape_dev()