Lines Matching defs:unit
58 struct xilly_unit *unit, *u;
60 unit = kzalloc(sizeof(*unit), GFP_KERNEL);
62 if (!unit)
68 snprintf(unit->name, UNITNAMELEN, "%s", prefix);
71 snprintf(unit->name, UNITNAMELEN, "%s_%02d",
76 if (!strcmp(unit->name, u->name)) {
82 rc = alloc_chrdev_region(&mdev, 0, num_nodes, unit->name);
89 unit->major = MAJOR(mdev);
90 unit->lowest_minor = MINOR(mdev);
91 unit->num_nodes = num_nodes;
92 unit->private_data = private_data;
94 unit->cdev = cdev_alloc();
95 if (!unit->cdev) {
99 unit->cdev->ops = fops;
100 unit->cdev->owner = owner;
102 rc = cdev_add(unit->cdev, MKDEV(unit->major, unit->lowest_minor),
103 unit->num_nodes);
107 kobject_put(&unit->cdev->kobj);
121 unit->name, idt);
128 MKDEV(unit->major,
129 i + unit->lowest_minor),
147 list_add_tail(&unit->list_entry, &unit_list);
157 device_destroy(&xillybus_class, MKDEV(unit->major,
158 i + unit->lowest_minor));
160 cdev_del(unit->cdev);
163 unregister_chrdev_region(MKDEV(unit->major, unit->lowest_minor),
164 unit->num_nodes);
169 kfree(unit);
179 struct xilly_unit *unit = NULL, *iter;
185 unit = iter;
189 if (!unit) {
190 dev_err(dev, "Weird bug: Failed to find unit\n");
195 for (minor = unit->lowest_minor;
196 minor < (unit->lowest_minor + unit->num_nodes);
198 device_destroy(&xillybus_class, MKDEV(unit->major, minor));
200 cdev_del(unit->cdev);
202 unregister_chrdev_region(MKDEV(unit->major, unit->lowest_minor),
203 unit->num_nodes);
206 unit->num_nodes);
208 list_del(&unit->list_entry);
209 kfree(unit);
220 struct xilly_unit *unit = NULL, *iter;
228 unit = iter;
232 if (!unit) {
237 *private_data = unit->private_data;
238 *index = minor - unit->lowest_minor;