diff options
author | Matthew Wilcox <willy@infradead.org> | 2018-06-18 08:35:52 -0400 |
---|---|---|
committer | Matthew Wilcox <willy@infradead.org> | 2018-08-21 23:54:18 -0400 |
commit | 5a2ab034396c063ceed167076424cf37d17cdc01 (patch) | |
tree | 58b4edfef292e48a9024ca087c1e9dd2456a1a73 | |
parent | b3fa64170e21393b5790be89ab16cdfe1f5bddbc (diff) |
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>
-rw-r--r-- | drivers/media/media-device.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c index ae59c3177555..d51088bcd735 100644 --- a/drivers/media/media-device.c +++ b/drivers/media/media-device.c | |||
@@ -575,18 +575,12 @@ int __must_check media_device_register_entity(struct media_device *mdev, | |||
575 | entity->num_links = 0; | 575 | entity->num_links = 0; |
576 | entity->num_backlinks = 0; | 576 | entity->num_backlinks = 0; |
577 | 577 | ||
578 | if (!ida_pre_get(&mdev->entity_internal_idx, GFP_KERNEL)) | 578 | ret = ida_alloc_min(&mdev->entity_internal_idx, 1, GFP_KERNEL); |
579 | return -ENOMEM; | 579 | if (ret < 0) |
580 | |||
581 | mutex_lock(&mdev->graph_mutex); | ||
582 | |||
583 | ret = ida_get_new_above(&mdev->entity_internal_idx, 1, | ||
584 | &entity->internal_idx); | ||
585 | if (ret < 0) { | ||
586 | mutex_unlock(&mdev->graph_mutex); | ||
587 | return ret; | 580 | return ret; |
588 | } | 581 | entity->internal_idx = ret; |
589 | 582 | ||
583 | mutex_lock(&mdev->graph_mutex); | ||
590 | mdev->entity_internal_idx_max = | 584 | mdev->entity_internal_idx_max = |
591 | max(mdev->entity_internal_idx_max, entity->internal_idx); | 585 | max(mdev->entity_internal_idx_max, entity->internal_idx); |
592 | 586 | ||
@@ -632,7 +626,7 @@ static void __media_device_unregister_entity(struct media_entity *entity) | |||
632 | struct media_interface *intf; | 626 | struct media_interface *intf; |
633 | unsigned int i; | 627 | unsigned int i; |
634 | 628 | ||
635 | ida_simple_remove(&mdev->entity_internal_idx, entity->internal_idx); | 629 | ida_free(&mdev->entity_internal_idx, entity->internal_idx); |
636 | 630 | ||
637 | /* Remove all interface links pointing to this entity */ | 631 | /* Remove all interface links pointing to this entity */ |
638 | list_for_each_entry(intf, &mdev->interfaces, graph_obj.list) { | 632 | list_for_each_entry(intf, &mdev->interfaces, graph_obj.list) { |