Lines Matching refs:blob
4187 struct drm_property_blob *blob; in drm_property_create_blob() local
4193 blob = kzalloc(sizeof(struct drm_property_blob)+length, GFP_KERNEL); in drm_property_create_blob()
4194 if (!blob) in drm_property_create_blob()
4199 INIT_LIST_HEAD(&blob->head_file); in drm_property_create_blob()
4200 blob->length = length; in drm_property_create_blob()
4201 blob->dev = dev; in drm_property_create_blob()
4204 memcpy(blob->data, data, length); in drm_property_create_blob()
4208 ret = drm_mode_object_get(dev, &blob->base, DRM_MODE_OBJECT_BLOB); in drm_property_create_blob()
4210 kfree(blob); in drm_property_create_blob()
4215 kref_init(&blob->refcount); in drm_property_create_blob()
4217 list_add_tail(&blob->head_global, in drm_property_create_blob()
4222 return blob; in drm_property_create_blob()
4235 struct drm_property_blob *blob = in drm_property_free_blob() local
4238 WARN_ON(!mutex_is_locked(&blob->dev->mode_config.blob_lock)); in drm_property_free_blob()
4240 list_del(&blob->head_global); in drm_property_free_blob()
4241 list_del(&blob->head_file); in drm_property_free_blob()
4242 drm_mode_object_put(blob->dev, &blob->base); in drm_property_free_blob()
4244 kfree(blob); in drm_property_free_blob()
4254 void drm_property_unreference_blob(struct drm_property_blob *blob) in drm_property_unreference_blob() argument
4258 if (!blob) in drm_property_unreference_blob()
4261 dev = blob->dev; in drm_property_unreference_blob()
4263 DRM_DEBUG("%p: blob ID: %d (%d)\n", blob, blob->base.id, atomic_read(&blob->refcount.refcount)); in drm_property_unreference_blob()
4265 if (kref_put_mutex(&blob->refcount, drm_property_free_blob, in drm_property_unreference_blob()
4281 static void drm_property_unreference_blob_locked(struct drm_property_blob *blob) in drm_property_unreference_blob_locked() argument
4283 if (!blob) in drm_property_unreference_blob_locked()
4286 DRM_DEBUG("%p: blob ID: %d (%d)\n", blob, blob->base.id, atomic_read(&blob->refcount.refcount)); in drm_property_unreference_blob_locked()
4288 kref_put(&blob->refcount, drm_property_free_blob); in drm_property_unreference_blob_locked()
4299 struct drm_property_blob *blob, *bt; in drm_property_destroy_user_blobs() local
4303 list_for_each_entry_safe(blob, bt, &file_priv->blobs, head_file) { in drm_property_destroy_user_blobs()
4304 list_del_init(&blob->head_file); in drm_property_destroy_user_blobs()
4305 drm_property_unreference_blob_locked(blob); in drm_property_destroy_user_blobs()
4318 struct drm_property_blob *drm_property_reference_blob(struct drm_property_blob *blob) in drm_property_reference_blob() argument
4320 DRM_DEBUG("%p: blob ID: %d (%d)\n", blob, blob->base.id, atomic_read(&blob->refcount.refcount)); in drm_property_reference_blob()
4321 kref_get(&blob->refcount); in drm_property_reference_blob()
4322 return blob; in drm_property_reference_blob()
4334 struct drm_property_blob *blob; in __drm_property_lookup_blob() local
4341 blob = NULL; in __drm_property_lookup_blob()
4343 blob = obj_to_blob(obj); in __drm_property_lookup_blob()
4346 return blob; in __drm_property_lookup_blob()
4361 struct drm_property_blob *blob; in drm_property_lookup_blob() local
4364 blob = __drm_property_lookup_blob(dev, id); in drm_property_lookup_blob()
4365 if (blob) { in drm_property_lookup_blob()
4366 if (!kref_get_unless_zero(&blob->refcount)) in drm_property_lookup_blob()
4367 blob = NULL; in drm_property_lookup_blob()
4371 return blob; in drm_property_lookup_blob()
4468 struct drm_property_blob *blob; in drm_mode_getblob_ioctl() local
4477 blob = __drm_property_lookup_blob(dev, out_resp->blob_id); in drm_mode_getblob_ioctl()
4478 if (!blob) { in drm_mode_getblob_ioctl()
4483 if (out_resp->length == blob->length) { in drm_mode_getblob_ioctl()
4485 if (copy_to_user(blob_ptr, blob->data, blob->length)) { in drm_mode_getblob_ioctl()
4490 out_resp->length = blob->length; in drm_mode_getblob_ioctl()
4517 struct drm_property_blob *blob; in drm_mode_createblob_ioctl() local
4524 blob = drm_property_create_blob(dev, out_resp->length, NULL); in drm_mode_createblob_ioctl()
4525 if (IS_ERR(blob)) in drm_mode_createblob_ioctl()
4526 return PTR_ERR(blob); in drm_mode_createblob_ioctl()
4529 if (copy_from_user(blob->data, blob_ptr, out_resp->length)) { in drm_mode_createblob_ioctl()
4538 out_resp->blob_id = blob->base.id; in drm_mode_createblob_ioctl()
4539 list_add_tail(&blob->head_file, &file_priv->blobs); in drm_mode_createblob_ioctl()
4545 drm_property_unreference_blob(blob); in drm_mode_createblob_ioctl()
4566 struct drm_property_blob *blob = NULL, *bt; in drm_mode_destroyblob_ioctl() local
4574 blob = __drm_property_lookup_blob(dev, out_resp->blob_id); in drm_mode_destroyblob_ioctl()
4575 if (!blob) { in drm_mode_destroyblob_ioctl()
4582 if (bt == blob) { in drm_mode_destroyblob_ioctl()
4595 list_del_init(&blob->head_file); in drm_mode_destroyblob_ioctl()
4596 drm_property_unreference_blob_locked(blob); in drm_mode_destroyblob_ioctl()
4749 struct drm_property_blob *blob; in drm_property_change_valid_get() local
4754 blob = drm_property_lookup_blob(property->dev, value); in drm_property_change_valid_get()
4755 if (blob) { in drm_property_change_valid_get()
4756 *ref = &blob->base; in drm_property_change_valid_get()
5792 struct drm_property_blob *blob, *bt; in drm_mode_config_cleanup() local
5810 list_for_each_entry_safe(blob, bt, &dev->mode_config.property_blob_list, in drm_mode_config_cleanup()
5812 drm_property_unreference_blob(blob); in drm_mode_config_cleanup()