Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2438995ioo; Sat, 28 May 2022 13:44:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwQoAGkRAR1JSfTlMm5XaLF02uR1qUs6L6Er7RQ1CBwlS0UC2OLobwGa5ENDMY4BE3irEvb X-Received: by 2002:a17:902:cf4c:b0:161:e3aa:2708 with SMTP id e12-20020a170902cf4c00b00161e3aa2708mr45295816plg.127.1653770650015; Sat, 28 May 2022 13:44:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653770650; cv=none; d=google.com; s=arc-20160816; b=cSYTLw7qzT+t/KBrsC2otuh/8HiALH0SLbVRfOLZKSvYYVLPcPPwfWClYvfEz8FbEE FCre0dFEFeWg7apAsLVZ06Hh57bMqLfhqhB/AUiNF8hixPBr1T+56KHH8Nidc5F8Yd/h M4jUIHtPjSInyHrjjrXX9XaPuJf3q3ykGLYbP0yxksObgZeTnKlkIwIH9RgfEczbdYmJ IKER7KdIalPkQie9ynYidfx73+dnmd6zls35m9Lxni2yup/9WPyF1h0/9rKtr4/z5D5e dxvnUqxxxrnqpnUQIqqoKUK2axMM52xgv4NKqKQObhDMxpcOVkzvo3Tmd4shFrjv+HpL ZXSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=6QDRkipahB1Gshuhg1LCWwWqOnvJIiAaq2yKQZEIhkU=; b=Wa7wG3OSJFD3gqzHpnD5Cw2XOQ7CO54vTWdArc2ndKDxdCeZbEimila/d4R+ZaRBhb 1xSvt6LlJ2KXBy8J3bzN3g+5j2Ap+dSs0HGwj2lMwsKNBkEy8633cBO8peARFqNd3e3p cKtPr0YrmFqwxrb/YdgqqeKLcfCWORzKbRktnOOUmE4dviwVvEA1EfkuFnJyLCSCvAbB hfZSN/P67o8ACTTTW4//183Y2X0yEx+nY9MWWqy95+g0Vp3fl6aqKGl4fk82aW9h8BeH 4i5sguScBPY6MCCazEpKUMXe3j7j4G5+Y4XJ7j5XIz7pHXZ/+UFe04LPOzdM9oLDk0A0 NzwA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id w2-20020a63fb42000000b003c64ad569fdsi9994203pgj.674.2022.05.28.13.44.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 May 2022 13:44:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DD80E1A004C; Sat, 28 May 2022 12:43:47 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343748AbiE0Glq (ORCPT + 99 others); Fri, 27 May 2022 02:41:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57668 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243375AbiE0Glo (ORCPT ); Fri, 27 May 2022 02:41:44 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BCD4768FAC for ; Thu, 26 May 2022 23:41:43 -0700 (PDT) Received: from dggpemm500020.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4L8ZtJ2PCYzbbhg; Fri, 27 May 2022 14:40:08 +0800 (CST) Received: from dggpemm500018.china.huawei.com (7.185.36.111) by dggpemm500020.china.huawei.com (7.185.36.49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 27 May 2022 14:41:40 +0800 Received: from localhost.localdomain (10.175.112.125) by dggpemm500018.china.huawei.com (7.185.36.111) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Fri, 27 May 2022 14:41:40 +0800 From: keliu To: , , , CC: keliu Subject: [PATCH] drivers: iommu: Directly use ida_alloc()/free() Date: Fri, 27 May 2022 07:03:07 +0000 Message-ID: <20220527070307.2359150-1-liuke94@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.112.125] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm500018.china.huawei.com (7.185.36.111) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use ida_alloc()/ida_free() instead of deprecated ida_simple_get()/ida_simple_remove() . Signed-off-by: keliu --- drivers/iommu/iommu.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 857d4c2fd1a2..8d56146a0b44 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -595,7 +595,7 @@ static void iommu_group_release(struct kobject *kobj) if (group->iommu_data_release) group->iommu_data_release(group->iommu_data); - ida_simple_remove(&iommu_group_ida, group->id); + ida_free(&iommu_group_ida, group->id); if (group->default_domain) iommu_domain_free(group->default_domain); @@ -635,7 +635,7 @@ struct iommu_group *iommu_group_alloc(void) INIT_LIST_HEAD(&group->entry); BLOCKING_INIT_NOTIFIER_HEAD(&group->notifier); - ret = ida_simple_get(&iommu_group_ida, 0, 0, GFP_KERNEL); + ret = ida_alloc(&iommu_group_ida, GFP_KERNEL); if (ret < 0) { kfree(group); return ERR_PTR(ret); @@ -645,7 +645,7 @@ struct iommu_group *iommu_group_alloc(void) ret = kobject_init_and_add(&group->kobj, &iommu_group_ktype, NULL, "%d", group->id); if (ret) { - ida_simple_remove(&iommu_group_ida, group->id); + ida_free(&iommu_group_ida, group->id); kobject_put(&group->kobj); return ERR_PTR(ret); } -- 2.25.1