Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2291100iof; Wed, 8 Jun 2022 01:35:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZsNL4jnqvorFzodqj5xgGQP6MO6hYq6Ks3W0V0Kjh6I83goBr/zAWvF0Wu4IWHGU6WRAY X-Received: by 2002:a63:2117:0:b0:3fd:d5d7:ad12 with SMTP id h23-20020a632117000000b003fdd5d7ad12mr11113638pgh.255.1654677346258; Wed, 08 Jun 2022 01:35:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654677346; cv=none; d=google.com; s=arc-20160816; b=asekw6vsarY4wY+7ASDLCS4Zgh3A7Zshni8p2FXZglq0d83vOKz88nayoFZfXqplmT 7/ZYmJtzuUnwagEUsSipcuqja3mrXfHA4Y/fHvKM1iT/M0ccFzqOdCWy1q2uRAqoYz/K hkUOUfTBiyT+ldtSzKpKVEYv7ceFEkh3EDOVh7oXSon5678lvnhQFXIcWFkpJHaurWzq S4flMxTdUeEO1tRkP8wRd0eZAO6sMdOavWPYCTqyR4qeBx/87yp+HOkqZ1X57hRD23ur oVsmcy8XdR8u7VIipyIWgfozpIXu5R7bmgUl2tvDzj9VRoDbndDMXJzUEO8S93FGyftT Ju4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:abuse-reports-to:tuid:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from; bh=6iajZ/DEYG+mU0Re4/suGIaA6fJx922mnrEipGed8gM=; b=d9eMnxNKlmCIC5qSvK9KTKURDMOFQXIdR6u2rKmsLXeGGKTPUoNlQmtBTyIVjG7Wlh sYp1Lq71AVeOA9qQsxqDoVwGG+StIbxkptXP5QBw4JnxLwbbmKJ7aChRGO4V/k+zIQV6 n+dSASaXZ9qHT6iFcgUfSf5Ns8az0xcrLezqsK/Bu3R8gr5x0EsSJWsyjwQHCH92WKiZ OaKmYlmsXW/+qxppmPPWC3iBP4vWZ1b2QIuLICNvSPfM/zkgk4LvWoW1ymaX9NIAiGmW m1+Dtkf4EgPoZN7oDZU+CB40g/Pd0oUD6k86S6xC0zhQi+it924NpJ54swfN7JQLdODL zTWQ== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id j15-20020a056a00174f00b0051bcf483183si26049656pfc.291.2022.06.08.01.35.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 01:35:46 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E98AF1ABA7E; Wed, 8 Jun 2022 01:01:35 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236556AbiFHHAx (ORCPT + 99 others); Wed, 8 Jun 2022 03:00:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354811AbiFHGTq (ORCPT ); Wed, 8 Jun 2022 02:19:46 -0400 X-Greylist: delayed 94 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Tue, 07 Jun 2022 23:16:20 PDT Received: from ssh249.corpemail.net (ssh249.corpemail.net [210.51.61.249]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1B2B01E3E3; Tue, 7 Jun 2022 23:16:17 -0700 (PDT) Received: from ([60.208.111.195]) by ssh248.corpemail.net ((D)) with ASMTP (SSL) id CCQ00146; Wed, 08 Jun 2022 14:08:46 +0800 Received: from localhost.localdomain (10.200.104.82) by jtjnmail201612.home.langchao.com (10.100.2.12) with Microsoft SMTP Server id 15.1.2308.27; Wed, 8 Jun 2022 14:08:47 +0800 From: Deming Wang To: , CC: , , , , Deming Wang Subject: [PATCH] virtio: Directly use ida_alloc_range()/ida_free() Date: Wed, 8 Jun 2022 02:08:26 -0400 Message-ID: <20220608060826.1681-1-wangdeming@inspur.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.200.104.82] tUid: 2022608140846640643a74332369a4aa4a55b1bfc3fae X-Abuse-Reports-To: service@corp-email.com Abuse-Reports-To: service@corp-email.com X-Complaints-To: service@corp-email.com X-Report-Abuse-To: service@corp-email.com 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_range()/ida_free() instead of deprecated ida_simple_get()/ida_simple_remove() . Signed-off-by: Deming Wang --- drivers/vhost/vdpa.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c index 935a1d0ddb97..384049cfca8d 100644 --- a/drivers/vhost/vdpa.c +++ b/drivers/vhost/vdpa.c @@ -1293,7 +1293,7 @@ static void vhost_vdpa_release_dev(struct device *device) struct vhost_vdpa *v = container_of(device, struct vhost_vdpa, dev); - ida_simple_remove(&vhost_vdpa_ida, v->minor); + ida_free(&vhost_vdpa_ida, v->minor); kfree(v->vqs); kfree(v); } @@ -1316,8 +1316,7 @@ static int vhost_vdpa_probe(struct vdpa_device *vdpa) if (!v) return -ENOMEM; - minor = ida_simple_get(&vhost_vdpa_ida, 0, - VHOST_VDPA_DEV_MAX, GFP_KERNEL); + minor = ida_alloc_range(&vhost_vdpa_ida, 0, VHOST_VDPA_DEV_MAX - 1, GFP_KERNEL); if (minor < 0) { kfree(v); return minor; -- 2.27.0