From cfe53129702549011e3ae981560755d5f19d010e Mon Sep 17 00:00:00 2001 From: Matthew Wilcox Date: Mon, 18 Feb 2019 16:11:16 -0500 Subject: [PATCH] pci: Convert endpoint functions_idr to IDA Signed-off-by: Matthew Wilcox --- drivers/pci/endpoint/pci-ep-cfs.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/drivers/pci/endpoint/pci-ep-cfs.c b/drivers/pci/endpoint/pci-ep-cfs.c index d1288a0bd530..0cb5ae77eefe 100644 --- a/drivers/pci/endpoint/pci-ep-cfs.c +++ b/drivers/pci/endpoint/pci-ep-cfs.c @@ -14,8 +14,7 @@ #include #include -static DEFINE_IDR(functions_idr); -static DEFINE_MUTEX(functions_mutex); +static DEFINE_IDA(function_ids); static struct config_group *functions_group; static struct config_group *controllers_group; @@ -371,9 +370,7 @@ static void pci_epf_release(struct config_item *item) { struct pci_epf_group *epf_group = to_pci_epf_group(item); - mutex_lock(&functions_mutex); - idr_remove(&functions_idr, epf_group->index); - mutex_unlock(&functions_mutex); + ida_free(&function_ids, epf_group->index); pci_epf_destroy(epf_group->epf); kfree(epf_group); } @@ -400,9 +397,7 @@ static struct config_group *pci_epf_make(struct config_group *group, if (!epf_group) return ERR_PTR(-ENOMEM); - mutex_lock(&functions_mutex); - index = idr_alloc(&functions_idr, epf_group, 0, 0, GFP_KERNEL); - mutex_unlock(&functions_mutex); + index = ida_alloc(&function_ids, GFP_KERNEL); if (index < 0) { err = index; goto free_group; @@ -436,9 +431,7 @@ free_name: kfree(epf_name); remove_idr: - mutex_lock(&functions_mutex); - idr_remove(&functions_idr, epf_group->index); - mutex_unlock(&functions_mutex); + ida_free(&function_ids, epf_group->index); free_group: kfree(epf_group); -- 2.50.1