Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2279622iof; Wed, 8 Jun 2022 01:15:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyvKHcr8UpxtUP4Zc31hqdlOgtPyZ2DlBsZaYj36RnYUrnXFtVFLNqoRG/j0UEF9YpaO/Rh X-Received: by 2002:a63:89c1:0:b0:3fc:6001:e871 with SMTP id v184-20020a6389c1000000b003fc6001e871mr29558260pgd.14.1654676130815; Wed, 08 Jun 2022 01:15:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654676130; cv=none; d=google.com; s=arc-20160816; b=ShYJ/WzrW3bZodfw8wKrpArN7ZF4kHOda0TLeqLF0trx48Y6SjhnoIJLC5/TjXagkH 8WMhp/iSUsEBuWzicRjJXnMmaizSxhv97lJWVs/AVZgJWVIs6H9akpGF0ORDG1/kGP84 l7VYcEyBUsbyljr+b7rFpePa5gquK16YaAGm3sxhK4q7m0bATtAh/PsRuHkIIRajoXuQ geNL0RSngw8ppT9XY/hU9YmXznn41/P9ekELNmOy0NTiE7Rt43anjHUo8pR6ZqZEL5ke ZhxUMQX5edAJdyC4+Fv4+SxF0xZzFFqQAOdzWIEbU5UOG1Gi0h7kgwTu9hdheKwL0Efz Dk4g== 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=m3RMUFgpXq5DVsh7lGouClry4qr5I6+KIBxb97j6swg=; b=CH33a84zrgAh6JO7ljoCtKLt0B0Fgzf4pro/yNXAp2QBSQiTtuxjoGdAxum5tIwR8h 7iViKey0wUfWuH+xYyJnaY3c3T6BgtqHADuUkg+V7XPwNJiSLTKEMAgoR8fBi3nf0iR6 xfzKdlTsvpcgzw6280UYvk90bDT4HDnARsQQvBk5/Ux9LUQaSG7aMBl08ZU4V5H2b0uN V9ExiZj+Ke1PjFR5ChLo9dV7ePTrWAMArP/FQZFP8WFF+KAfaSWbZNcJjc/pnsesCP9P orgFmlJq7tXhn8x3TcvxufdKbLWm4JsvPV2/S/tKIC7OLDsIdc5W6E3a612GoFIiWlKH 61Wg== 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 133-20020a63028b000000b003fd6d250893si14779640pgc.621.2022.06.08.01.15.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 01:15:30 -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 8172839CAC9; Wed, 8 Jun 2022 00:47:06 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233126AbiFHFRB (ORCPT + 99 others); Wed, 8 Jun 2022 01:17:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233923AbiFHFQt (ORCPT ); Wed, 8 Jun 2022 01:16:49 -0400 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2F8E3C7802 for ; Tue, 7 Jun 2022 19:21:07 -0700 (PDT) Received: from dggpemm500022.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4LHr065K4vz16JVb; Wed, 8 Jun 2022 09:55:18 +0800 (CST) Received: from dggpemm500018.china.huawei.com (7.185.36.111) by dggpemm500022.china.huawei.com (7.185.36.162) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 8 Jun 2022 09:55:36 +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; Wed, 8 Jun 2022 09:55:36 +0800 From: Ke Liu To: CC: , , , Ke Liu , Jason Gunthorpe , "Michael S . Tsirkin" Subject: [PATCH v2] iommu: Directly use ida_alloc()/free() Date: Wed, 8 Jun 2022 02:16:55 +0000 Message-ID: <20220608021655.1538087-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: dggems701-chm.china.huawei.com (10.3.19.178) 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: Ke Liu Reviewed-by: Jason Gunthorpe Signed-off-by: Michael S. Tsirkin --- v2 subject change to iommu --- 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 847ad47a2dfd..cdc86c39954e 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -600,7 +600,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); @@ -641,7 +641,7 @@ struct iommu_group *iommu_group_alloc(void) INIT_LIST_HEAD(&group->devices); INIT_LIST_HEAD(&group->entry); - 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); @@ -651,7 +651,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