Commit b5f06893 authored by Shayenne da Luz Moura's avatar Shayenne da Luz Moura Committed by Daniel Vetter

drm: Rename crtc_idr as object_idr to KMS cleanups

This patch solves this TODO task:
 drm_mode_config.crtc_idr is misnamed, since it contains all KMS object.
 Should be renamed to drm_mode_config.object_idr.
Signed-off-by: default avatarShayenne da Luz Moura <shayenneluzmoura@gmail.com>
[danvet: resolve conflict with addition of privobj_list.]
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: https://patchwork.freedesktop.org/patch/msgid/20181213212957.vkitkyl5cj2qh7qr@smtp.gmail.com
parent 63d5e06a
...@@ -218,7 +218,7 @@ static struct drm_master *drm_lease_create(struct drm_master *lessor, struct idr ...@@ -218,7 +218,7 @@ static struct drm_master *drm_lease_create(struct drm_master *lessor, struct idr
idr_for_each_entry(leases, entry, object) { idr_for_each_entry(leases, entry, object) {
error = 0; error = 0;
if (!idr_find(&dev->mode_config.crtc_idr, object)) if (!idr_find(&dev->mode_config.object_idr, object))
error = -ENOENT; error = -ENOENT;
else if (!_drm_lease_held_master(lessor, object)) else if (!_drm_lease_held_master(lessor, object))
error = -EACCES; error = -EACCES;
...@@ -439,7 +439,7 @@ static int fill_object_idr(struct drm_device *dev, ...@@ -439,7 +439,7 @@ static int fill_object_idr(struct drm_device *dev,
/* /*
* We're using an IDR to hold the set of leased * We're using an IDR to hold the set of leased
* objects, but we don't need to point at the object's * objects, but we don't need to point at the object's
* data structure from the lease as the main crtc_idr * data structure from the lease as the main object_idr
* will be used to actually find that. Instead, all we * will be used to actually find that. Instead, all we
* really want is a 'leased/not-leased' result, for * really want is a 'leased/not-leased' result, for
* which any non-NULL pointer will work fine. * which any non-NULL pointer will work fine.
...@@ -687,7 +687,7 @@ int drm_mode_get_lease_ioctl(struct drm_device *dev, ...@@ -687,7 +687,7 @@ int drm_mode_get_lease_ioctl(struct drm_device *dev,
if (lessee->lessor == NULL) if (lessee->lessor == NULL)
/* owner can use all objects */ /* owner can use all objects */
object_idr = &lessee->dev->mode_config.crtc_idr; object_idr = &lessee->dev->mode_config.object_idr;
else else
/* lessee can only use allowed object */ /* lessee can only use allowed object */
object_idr = &lessee->leases; object_idr = &lessee->leases;
......
...@@ -382,7 +382,7 @@ void drm_mode_config_init(struct drm_device *dev) ...@@ -382,7 +382,7 @@ void drm_mode_config_init(struct drm_device *dev)
INIT_LIST_HEAD(&dev->mode_config.property_blob_list); INIT_LIST_HEAD(&dev->mode_config.property_blob_list);
INIT_LIST_HEAD(&dev->mode_config.plane_list); INIT_LIST_HEAD(&dev->mode_config.plane_list);
INIT_LIST_HEAD(&dev->mode_config.privobj_list); INIT_LIST_HEAD(&dev->mode_config.privobj_list);
idr_init(&dev->mode_config.crtc_idr); idr_init(&dev->mode_config.object_idr);
idr_init(&dev->mode_config.tile_idr); idr_init(&dev->mode_config.tile_idr);
ida_init(&dev->mode_config.connector_ida); ida_init(&dev->mode_config.connector_ida);
spin_lock_init(&dev->mode_config.connector_list_lock); spin_lock_init(&dev->mode_config.connector_list_lock);
...@@ -485,7 +485,7 @@ void drm_mode_config_cleanup(struct drm_device *dev) ...@@ -485,7 +485,7 @@ void drm_mode_config_cleanup(struct drm_device *dev)
ida_destroy(&dev->mode_config.connector_ida); ida_destroy(&dev->mode_config.connector_ida);
idr_destroy(&dev->mode_config.tile_idr); idr_destroy(&dev->mode_config.tile_idr);
idr_destroy(&dev->mode_config.crtc_idr); idr_destroy(&dev->mode_config.object_idr);
drm_modeset_lock_fini(&dev->mode_config.connection_mutex); drm_modeset_lock_fini(&dev->mode_config.connection_mutex);
} }
EXPORT_SYMBOL(drm_mode_config_cleanup); EXPORT_SYMBOL(drm_mode_config_cleanup);
...@@ -38,7 +38,7 @@ int __drm_mode_object_add(struct drm_device *dev, struct drm_mode_object *obj, ...@@ -38,7 +38,7 @@ int __drm_mode_object_add(struct drm_device *dev, struct drm_mode_object *obj,
int ret; int ret;
mutex_lock(&dev->mode_config.idr_mutex); mutex_lock(&dev->mode_config.idr_mutex);
ret = idr_alloc(&dev->mode_config.crtc_idr, register_obj ? obj : NULL, ret = idr_alloc(&dev->mode_config.object_idr, register_obj ? obj : NULL,
1, 0, GFP_KERNEL); 1, 0, GFP_KERNEL);
if (ret >= 0) { if (ret >= 0) {
/* /*
...@@ -79,7 +79,7 @@ void drm_mode_object_register(struct drm_device *dev, ...@@ -79,7 +79,7 @@ void drm_mode_object_register(struct drm_device *dev,
struct drm_mode_object *obj) struct drm_mode_object *obj)
{ {
mutex_lock(&dev->mode_config.idr_mutex); mutex_lock(&dev->mode_config.idr_mutex);
idr_replace(&dev->mode_config.crtc_idr, obj, obj->id); idr_replace(&dev->mode_config.object_idr, obj, obj->id);
mutex_unlock(&dev->mode_config.idr_mutex); mutex_unlock(&dev->mode_config.idr_mutex);
} }
...@@ -99,7 +99,7 @@ void drm_mode_object_unregister(struct drm_device *dev, ...@@ -99,7 +99,7 @@ void drm_mode_object_unregister(struct drm_device *dev,
{ {
mutex_lock(&dev->mode_config.idr_mutex); mutex_lock(&dev->mode_config.idr_mutex);
if (object->id) { if (object->id) {
idr_remove(&dev->mode_config.crtc_idr, object->id); idr_remove(&dev->mode_config.object_idr, object->id);
object->id = 0; object->id = 0;
} }
mutex_unlock(&dev->mode_config.idr_mutex); mutex_unlock(&dev->mode_config.idr_mutex);
...@@ -131,7 +131,7 @@ struct drm_mode_object *__drm_mode_object_find(struct drm_device *dev, ...@@ -131,7 +131,7 @@ struct drm_mode_object *__drm_mode_object_find(struct drm_device *dev,
struct drm_mode_object *obj = NULL; struct drm_mode_object *obj = NULL;
mutex_lock(&dev->mode_config.idr_mutex); mutex_lock(&dev->mode_config.idr_mutex);
obj = idr_find(&dev->mode_config.crtc_idr, id); obj = idr_find(&dev->mode_config.object_idr, id);
if (obj && type != DRM_MODE_OBJECT_ANY && obj->type != type) if (obj && type != DRM_MODE_OBJECT_ANY && obj->type != type)
obj = NULL; obj = NULL;
if (obj && obj->id != id) if (obj && obj->id != id)
......
...@@ -391,18 +391,18 @@ struct drm_mode_config { ...@@ -391,18 +391,18 @@ struct drm_mode_config {
/** /**
* @idr_mutex: * @idr_mutex:
* *
* Mutex for KMS ID allocation and management. Protects both @crtc_idr * Mutex for KMS ID allocation and management. Protects both @object_idr
* and @tile_idr. * and @tile_idr.
*/ */
struct mutex idr_mutex; struct mutex idr_mutex;
/** /**
* @crtc_idr: * @object_idr:
* *
* Main KMS ID tracking object. Use this idr for all IDs, fb, crtc, * Main KMS ID tracking object. Use this idr for all IDs, fb, crtc,
* connector, modes - just makes life easier to have only one. * connector, modes - just makes life easier to have only one.
*/ */
struct idr crtc_idr; struct idr object_idr;
/** /**
* @tile_idr: * @tile_idr:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment