Lines Matching full:minor

82  * device. However, this doesn't mean that the minor is active. Minors are
115 struct drm_minor *minor = data; in drm_minor_alloc_release() local
117 WARN_ON(dev != minor->dev); in drm_minor_alloc_release()
119 put_device(minor->kdev); in drm_minor_alloc_release()
121 xa_erase(drm_minor_get_xa(minor->type), minor->index); in drm_minor_alloc_release()
126 * minor allocation scheme where minors 0-63 are primary nodes, 64-127 are control nodes,
140 struct drm_minor *minor; in drm_minor_alloc() local
143 minor = drmm_kzalloc(dev, sizeof(*minor), GFP_KERNEL); in drm_minor_alloc()
144 if (!minor) in drm_minor_alloc()
147 minor->type = type; in drm_minor_alloc()
148 minor->dev = dev; in drm_minor_alloc()
150 r = xa_alloc(drm_minor_get_xa(type), &minor->index, in drm_minor_alloc()
153 r = xa_alloc(&drm_minors_xa, &minor->index, in drm_minor_alloc()
158 r = drmm_add_action_or_reset(dev, drm_minor_alloc_release, minor); in drm_minor_alloc()
162 minor->kdev = drm_sysfs_minor_alloc(minor); in drm_minor_alloc()
163 if (IS_ERR(minor->kdev)) in drm_minor_alloc()
164 return PTR_ERR(minor->kdev); in drm_minor_alloc()
166 *drm_minor_get_slot(dev, type) = minor; in drm_minor_alloc()
172 struct drm_minor *minor; in drm_minor_register() local
178 minor = *drm_minor_get_slot(dev, type); in drm_minor_register()
179 if (!minor) in drm_minor_register()
182 if (minor->type != DRM_MINOR_ACCEL) { in drm_minor_register()
183 ret = drm_debugfs_register(minor, minor->index, in drm_minor_register()
191 ret = device_add(minor->kdev); in drm_minor_register()
195 /* replace NULL with @minor so lookups will succeed from now on */ in drm_minor_register()
196 entry = xa_store(drm_minor_get_xa(type), minor->index, minor, GFP_KERNEL); in drm_minor_register()
203 DRM_DEBUG("new minor registered %d\n", minor->index); in drm_minor_register()
207 drm_debugfs_unregister(minor); in drm_minor_register()
213 struct drm_minor *minor; in drm_minor_unregister() local
215 minor = *drm_minor_get_slot(dev, type); in drm_minor_unregister()
216 if (!minor || !device_is_registered(minor->kdev)) in drm_minor_unregister()
219 /* replace @minor with NULL so lookups will fail from now on */ in drm_minor_unregister()
220 xa_store(drm_minor_get_xa(type), minor->index, NULL, GFP_KERNEL); in drm_minor_unregister()
222 device_del(minor->kdev); in drm_minor_unregister()
223 dev_set_drvdata(minor->kdev, NULL); /* safety belt */ in drm_minor_unregister()
224 drm_debugfs_unregister(minor); in drm_minor_unregister()
228 * Looks up the given minor-ID and returns the respective DRM-minor object. The
232 * As long as you hold this minor, it is guaranteed that the object and the
233 * minor->dev pointer will stay valid! However, the device may get unplugged and
234 * unregistered while you hold the minor.
238 struct drm_minor *minor; in drm_minor_acquire() local
241 minor = xa_load(minor_xa, minor_id); in drm_minor_acquire()
242 if (minor) in drm_minor_acquire()
243 drm_dev_get(minor->dev); in drm_minor_acquire()
246 if (!minor) { in drm_minor_acquire()
248 } else if (drm_dev_is_unplugged(minor->dev)) { in drm_minor_acquire()
249 drm_dev_put(minor->dev); in drm_minor_acquire()
253 return minor; in drm_minor_acquire()
256 void drm_minor_release(struct drm_minor *minor) in drm_minor_release() argument
258 drm_dev_put(minor->dev); in drm_minor_release()
825 struct drm_minor *minor; in create_compat_control_link() local
832 minor = *drm_minor_get_slot(dev, DRM_MINOR_PRIMARY); in create_compat_control_link()
833 if (!minor) in create_compat_control_link()
845 name = kasprintf(GFP_KERNEL, "controlD%d", minor->index + 64); in create_compat_control_link()
849 ret = sysfs_create_link(minor->kdev->kobj.parent, in create_compat_control_link()
850 &minor->kdev->kobj, in create_compat_control_link()
860 struct drm_minor *minor; in remove_compat_control_link() local
866 minor = *drm_minor_get_slot(dev, DRM_MINOR_PRIMARY); in remove_compat_control_link()
867 if (!minor) in remove_compat_control_link()
870 name = kasprintf(GFP_KERNEL, "controlD%d", minor->index + 64); in remove_compat_control_link()
874 sysfs_remove_link(minor->kdev->kobj.parent, name); in remove_compat_control_link()
948 DRM_INFO("Initialized %s %d.%d.%d for %s on minor %d\n", in drm_dev_register()
949 driver->name, driver->major, driver->minor, in drm_dev_register()
1018 * - DRM minor management
1023 * interface registered on a DRM device, you can request minor numbers from DRM
1026 * registered minor.
1032 struct drm_minor *minor; in drm_stub_open() local
1037 minor = drm_minor_acquire(&drm_minors_xa, iminor(inode)); in drm_stub_open()
1038 if (IS_ERR(minor)) in drm_stub_open()
1039 return PTR_ERR(minor); in drm_stub_open()
1041 new_fops = fops_get(minor->dev->driver->fops); in drm_stub_open()
1054 drm_minor_release(minor); in drm_stub_open()