Received: by 2002:a05:7412:8d09:b0:fa:4c10:6cad with SMTP id bj9csp73435rdb; Mon, 15 Jan 2024 12:36:33 -0800 (PST) X-Google-Smtp-Source: AGHT+IFh7+P2zMjk+kcpYO32K0ivZZGHAq0d9Yp1IDkFi7QKZLRVrb3mIMdihwzD0H37VULbB1zA X-Received: by 2002:a92:d704:0:b0:35f:ea84:83d9 with SMTP id m4-20020a92d704000000b0035fea8483d9mr7346219iln.27.1705350993123; Mon, 15 Jan 2024 12:36:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705350993; cv=none; d=google.com; s=arc-20160816; b=aD26q1vF3ZHOnQ7MZGNJoJNvd0cFsgxyocN3deflWmLRXc96299E+n7K6lG8cmHFsX oOUufhuBFwGVbfIaOqzmylPcboW/Vi+LG6vr8FHOpLOsoqdNZ+C7nAA/dpX3VWu+jYF1 CC/nVs3tTwFeQ8/XoyEfOGC9K5s6CswXIqjWrNt57X8RPryd77FoWD3WNzaJNINDewXu k1f+ixiisjNl0gE6UoOc5S4Iff+coDsl9CYYOkKeHBONG3uuGPZGFRrX0BhuaHJbPMrr HxpGglFCnkDow2hdiSecRaicdhB0TYN3/BIR+F5l4xFZR+EoGa/Cv0eqcsb7RLQiDJ5P MPSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=RzPoGp/tpKwUV6J2m7F/ChKKY33YyoyaYVUsLe/NOrA=; fh=3lNLG2mUEwZpfTs0PpCDTFojHgB5WLmjR+a6B29YeHg=; b=G9MVXrqzGZ60h/c33cA4kBjzgmzg/an3X1aL4w5cUADg0yBYPPzHlt6hbeszvUvWuG BmVhdBZdqQWjyjGq80KEYXZxekOx1KrEflEVdtFgduRFRGOlbwZN3/qJie778elXVgwC YO+wQMpINnjV/XQd31LpBv5jAfMZ4n+d/k+THBawEFx1hjaplIRR3jNxWeYlPSodsNhA YV/rFXqj8ngHhnwvQmsnkgBUPIWZdHgB7n7iYruGRNdUZWmGHSIJnFWgkNBj5ylbB5Gm nZTfVIOA91Fo3+X4v3RhXM7ECiNxgXvkRRpIuxxgtTopJwsenK09sLwjS7e89HFbuMv5 QB5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=crIDZxkV; spf=pass (google.com: domain of linux-kernel+bounces-26483-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26483-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id b4-20020a6567c4000000b005ce0053096fsi9351667pgs.486.2024.01.15.12.36.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 12:36:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-26483-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=crIDZxkV; spf=pass (google.com: domain of linux-kernel+bounces-26483-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26483-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 5A97CB21F21 for ; Mon, 15 Jan 2024 20:36:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 71CFA1AADC; Mon, 15 Jan 2024 20:36:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b="crIDZxkV" Received: from smtp.smtpout.orange.fr (smtp-24.smtpout.orange.fr [80.12.242.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 007A91AAAE for ; Mon, 15 Jan 2024 20:36:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=wanadoo.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wanadoo.fr Received: from fedora.home ([92.140.202.140]) by smtp.orange.fr with ESMTPA id PTgYrIbDj9TFdPTgYrCsdD; Mon, 15 Jan 2024 21:35:58 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1705350958; bh=RzPoGp/tpKwUV6J2m7F/ChKKY33YyoyaYVUsLe/NOrA=; h=From:To:Cc:Subject:Date; b=crIDZxkVsvRRgoM4QE6wFLEjnsbeL4mCoTxXi0nzroXsopuYsC9MuN7/SMLzMDMl+ +ONLtm6NaS1G2zYyR4T8yHq83QNwAkOV1dcTCWdhiFXWMXM71PUkmTuk0xsublfOXR CQF3Xer8zFOUn7MxW+CP3/g5wu4tRDlAN4eczas4tkT+4eYvi1/+7xmoTZj+SfFJt9 eD4UUstx3So1LO55nB2mSnMA/wRuie20L3w7RuJzmjLlU6Qjkq7Ssun78WiSz0rXGS NDEq98gNbu3W4UjnZ5yBSutr7Vh+/jqXULenRmKLdaNSt73dIDwkefstUFPHEeQeAy agWlTIKpET0lQ== X-ME-Helo: fedora.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Mon, 15 Jan 2024 21:35:58 +0100 X-ME-IP: 92.140.202.140 From: Christophe JAILLET To: "Michael S. Tsirkin" , Jason Wang Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , kvm@vger.kernel.org, virtualization@lists.linux.dev, netdev@vger.kernel.org Subject: [PATCH] vhost-vdpa: Remove usage of the deprecated ida_simple_xx() API Date: Mon, 15 Jan 2024 21:35:50 +0100 Message-ID: X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit ida_alloc() and ida_free() should be preferred to the deprecated ida_simple_get() and ida_simple_remove(). Note that the upper limit of ida_simple_get() is exclusive, buInputt the one of ida_alloc_max() is inclusive. So a -1 has been added when needed. Signed-off-by: Christophe JAILLET --- drivers/vhost/vdpa.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/vhost/vdpa.c b/drivers/vhost/vdpa.c index bc4a51e4638b..849b9d2dd51f 100644 --- a/drivers/vhost/vdpa.c +++ b/drivers/vhost/vdpa.c @@ -1534,7 +1534,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); } @@ -1557,8 +1557,8 @@ 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_max(&vhost_vdpa_ida, VHOST_VDPA_DEV_MAX - 1, + GFP_KERNEL); if (minor < 0) { kfree(v); return minor; -- 2.43.0