Lines Matching refs:minor
96 * device. However, this doesn't mean that the minor is active. Minors are
115 struct drm_minor *minor;
119 minor = kzalloc(sizeof(*minor), GFP_KERNEL);
120 if (!minor)
123 minor->type = type;
124 minor->dev = dev;
139 minor->index = r;
142 minor->kdev = drm_sysfs_minor_alloc(minor);
143 if (IS_ERR(minor->kdev)) {
144 r = PTR_ERR(minor->kdev);
149 *drm_minor_get_slot(dev, type) = minor;
154 idr_remove(&drm_minors_idr, minor->index);
157 kfree(minor);
163 struct drm_minor **slot, *minor;
167 minor = *slot;
168 if (!minor)
172 put_device(minor->kdev);
176 idr_remove(&drm_minors_idr, minor->index);
179 kfree(minor);
185 struct drm_minor *minor;
193 minor = *drm_minor_get_slot(dev, type);
194 if (!minor)
198 ret = drm_debugfs_init(minor, minor->index, drm_debugfs_root);
204 ret = device_add(minor->kdev);
209 /* replace NULL with @minor so lookups will succeed from now on */
211 idr_replace(&drm_minors_idr, minor, minor->index);
214 DRM_DEBUG("new minor registered %d\n", minor->index);
219 drm_debugfs_cleanup(minor);
226 struct drm_minor *minor;
229 minor = *drm_minor_get_slot(dev, type);
231 if (!minor)
233 if (!minor || !device_is_registered(minor->kdev))
237 /* replace @minor with NULL so lookups will fail from now on */
239 idr_replace(&drm_minors_idr, NULL, minor->index);
243 device_del(minor->kdev);
244 dev_set_drvdata(minor->kdev, NULL); /* safety belt */
245 drm_debugfs_cleanup(minor);
250 * Looks up the given minor-ID and returns the respective DRM-minor object. The
254 * As long as you hold this minor, it is guaranteed that the object and the
255 * minor->dev pointer will stay valid! However, the device may get unplugged and
256 * unregistered while you hold the minor.
260 struct drm_minor *minor;
264 minor = idr_find(&drm_minors_idr, minor_id);
265 if (minor)
266 drm_dev_get(minor->dev);
269 if (!minor) {
271 } else if (drm_dev_is_unplugged(minor->dev)) {
272 drm_dev_put(minor->dev);
276 return minor;
279 void drm_minor_release(struct drm_minor *minor)
281 drm_dev_put(minor->dev);
965 struct drm_minor *minor;
972 minor = *drm_minor_get_slot(dev, DRM_MINOR_PRIMARY);
973 if (!minor)
985 name = kasprintf(GFP_KERNEL, "controlD%d", minor->index + 64);
992 ret = sysfs_create_link(minor->kdev->kobj.parent,
993 &minor->kdev->kobj,
1004 struct drm_minor *minor;
1010 minor = *drm_minor_get_slot(dev, DRM_MINOR_PRIMARY);
1011 if (!minor)
1014 name = kasprintf(GFP_KERNEL, "controlD%d", minor->index + 64);
1019 sysfs_remove_link(minor->kdev->kobj.parent, name);
1079 DRM_INFO("Initialized %s %d.%d.%d %s for %s on minor %d\n",
1080 driver->name, driver->major, driver->minor,
1172 * - DRM minor management
1177 * interface registered on a DRM device, you can request minor numbers from DRM
1180 * registered minor.
1186 struct drm_minor *minor;
1192 minor = drm_minor_acquire(iminor(inode));
1193 if (IS_ERR(minor)) {
1194 err = PTR_ERR(minor);
1198 new_fops = fops_get(minor->dev->driver->fops);
1211 drm_minor_release(minor);