Explorar o código

media: Convert entity ID allocation to new IDA API

Removes a call to ida_pre_get().

Signed-off-by: Matthew Wilcox <willy@infradead.org>
Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Acked-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Matthew Wilcox %!s(int64=7) %!d(string=hai) anos
pai
achega
5a2ab03439
Modificáronse 1 ficheiros con 5 adicións e 11 borrados
  1. 5 11
      drivers/media/media-device.c

+ 5 - 11
drivers/media/media-device.c

@@ -575,18 +575,12 @@ int __must_check media_device_register_entity(struct media_device *mdev,
 	entity->num_links = 0;
 	entity->num_links = 0;
 	entity->num_backlinks = 0;
 	entity->num_backlinks = 0;
 
 
-	if (!ida_pre_get(&mdev->entity_internal_idx, GFP_KERNEL))
-		return -ENOMEM;
-
-	mutex_lock(&mdev->graph_mutex);
-
-	ret = ida_get_new_above(&mdev->entity_internal_idx, 1,
-				&entity->internal_idx);
-	if (ret < 0) {
-		mutex_unlock(&mdev->graph_mutex);
+	ret = ida_alloc_min(&mdev->entity_internal_idx, 1, GFP_KERNEL);
+	if (ret < 0)
 		return ret;
 		return ret;
-	}
+	entity->internal_idx = ret;
 
 
+	mutex_lock(&mdev->graph_mutex);
 	mdev->entity_internal_idx_max =
 	mdev->entity_internal_idx_max =
 		max(mdev->entity_internal_idx_max, entity->internal_idx);
 		max(mdev->entity_internal_idx_max, entity->internal_idx);
 
 
@@ -632,7 +626,7 @@ static void __media_device_unregister_entity(struct media_entity *entity)
 	struct media_interface *intf;
 	struct media_interface *intf;
 	unsigned int i;
 	unsigned int i;
 
 
-	ida_simple_remove(&mdev->entity_internal_idx, entity->internal_idx);
+	ida_free(&mdev->entity_internal_idx, entity->internal_idx);
 
 
 	/* Remove all interface links pointing to this entity */
 	/* Remove all interface links pointing to this entity */
 	list_for_each_entry(intf, &mdev->interfaces, graph_obj.list) {
 	list_for_each_entry(intf, &mdev->interfaces, graph_obj.list) {