diff options
Diffstat (limited to 'drivers/gpu/drm/drm_crtc.c')
-rw-r--r-- | drivers/gpu/drm/drm_crtc.c | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index 293eb4c24f35..37a3e0791ddf 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c | |||
@@ -257,21 +257,11 @@ void drm_connector_ida_destroy(void) | |||
257 | 257 | ||
258 | /** | 258 | /** |
259 | * drm_get_encoder_name - return a string for encoder | 259 | * drm_get_encoder_name - return a string for encoder |
260 | * @encoder: encoder to compute name of | 260 | * @encoder: the encoder to get name for |
261 | * | ||
262 | * Note that the buffer used by this function is globally shared and owned by | ||
263 | * the function itself. | ||
264 | * | ||
265 | * FIXME: This isn't really multithreading safe. | ||
266 | */ | 261 | */ |
267 | const char *drm_get_encoder_name(const struct drm_encoder *encoder) | 262 | const char *drm_get_encoder_name(const struct drm_encoder *encoder) |
268 | { | 263 | { |
269 | static char buf[32]; | 264 | return encoder->name; |
270 | |||
271 | snprintf(buf, 32, "%s-%d", | ||
272 | drm_encoder_enum_list[encoder->encoder_type].name, | ||
273 | encoder->base.id); | ||
274 | return buf; | ||
275 | } | 265 | } |
276 | EXPORT_SYMBOL(drm_get_encoder_name); | 266 | EXPORT_SYMBOL(drm_get_encoder_name); |
277 | 267 | ||
@@ -986,16 +976,27 @@ int drm_encoder_init(struct drm_device *dev, | |||
986 | 976 | ||
987 | ret = drm_mode_object_get(dev, &encoder->base, DRM_MODE_OBJECT_ENCODER); | 977 | ret = drm_mode_object_get(dev, &encoder->base, DRM_MODE_OBJECT_ENCODER); |
988 | if (ret) | 978 | if (ret) |
989 | goto out; | 979 | goto out_unlock; |
990 | 980 | ||
991 | encoder->dev = dev; | 981 | encoder->dev = dev; |
992 | encoder->encoder_type = encoder_type; | 982 | encoder->encoder_type = encoder_type; |
993 | encoder->funcs = funcs; | 983 | encoder->funcs = funcs; |
984 | encoder->name = kasprintf(GFP_KERNEL, "%s-%d", | ||
985 | drm_encoder_enum_list[encoder_type].name, | ||
986 | encoder->base.id); | ||
987 | if (!encoder->name) { | ||
988 | ret = -ENOMEM; | ||
989 | goto out_put; | ||
990 | } | ||
994 | 991 | ||
995 | list_add_tail(&encoder->head, &dev->mode_config.encoder_list); | 992 | list_add_tail(&encoder->head, &dev->mode_config.encoder_list); |
996 | dev->mode_config.num_encoder++; | 993 | dev->mode_config.num_encoder++; |
997 | 994 | ||
998 | out: | 995 | out_put: |
996 | if (ret) | ||
997 | drm_mode_object_put(dev, &encoder->base); | ||
998 | |||
999 | out_unlock: | ||
999 | drm_modeset_unlock_all(dev); | 1000 | drm_modeset_unlock_all(dev); |
1000 | 1001 | ||
1001 | return ret; | 1002 | return ret; |
@@ -1013,6 +1014,8 @@ void drm_encoder_cleanup(struct drm_encoder *encoder) | |||
1013 | struct drm_device *dev = encoder->dev; | 1014 | struct drm_device *dev = encoder->dev; |
1014 | drm_modeset_lock_all(dev); | 1015 | drm_modeset_lock_all(dev); |
1015 | drm_mode_object_put(dev, &encoder->base); | 1016 | drm_mode_object_put(dev, &encoder->base); |
1017 | kfree(encoder->name); | ||
1018 | encoder->name = NULL; | ||
1016 | list_del(&encoder->head); | 1019 | list_del(&encoder->head); |
1017 | dev->mode_config.num_encoder--; | 1020 | dev->mode_config.num_encoder--; |
1018 | drm_modeset_unlock_all(dev); | 1021 | drm_modeset_unlock_all(dev); |