Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp864967lqp; Sun, 14 Apr 2024 03:14:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV3YA6+KDm7ppxKj3CRJvEUd2EL6OneBsiXO8b1rDET4dJ7+AVyo5zDaR1s4L7+yXGuCeTCq2SRc65LBnsXVOSYy7B6MItTZ0lcHEaTrQ== X-Google-Smtp-Source: AGHT+IETIdtdlSjj0u40vDa1LakE5yvR7f4k6b6F8aqOplVZKQToHzo4tiUskB8C9l34Sou9cZ5v X-Received: by 2002:a05:620a:2204:b0:789:e263:2e3c with SMTP id m4-20020a05620a220400b00789e2632e3cmr6896548qkh.28.1713089656308; Sun, 14 Apr 2024 03:14:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713089656; cv=pass; d=google.com; s=arc-20160816; b=jkHeDmv4Oc422WQZ0MySBVgtwB0pBTM98g8VB0mK7Bi3si/lnggQOZ9xrzJvONTpXq xxkUXefjTw5XWe8yapo0NnDmVndMv71M/PioEMsz/mGtva0NsMQeW5kY7zY1sGMmBaSk dBXXF4m1hNVrcPiNt2boO9OHlwKPUt6cb3DtzohbwPIlTXOFtml7W33/HttZii0c57xB C/OABIfcCNYbIPsEs+EJ5vxHNaPa8sQ14aHeRdfJBLSfl64YXXJKBrZ1hmKmoFyHNUqE 1uLrG7DfGRjo5pWExID4RvkVnlIP+A7nPwM3AdzTqT2m/ciyuQ2Ji57U4yxzguigEFfy MROA== ARC-Message-Signature: i=2; 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=Wu3eqlNZ33DIowcdMPCmbQIFZiK8nMriLzGayBQf0uE=; fh=hWBm74ZCE6n5d9HbKYseSGALs9Cs3/kQi373ZjWD9Bc=; b=MMPUASnFE98U/B3OatcfjYr1x5jXotep+GdO8RAjS0vxnKYJ6+ufwwGO4+346VeGAo LegLJhmOvS41fwkjQ36JFsItXmphF/mUMxzpjvzZ9sRT7z+FmFsODnrarVUn1RQ/4e52 bn18vhxj+erQ1QtyfflSawfj7XIXeaqOBP/cmMRWickjc7G8UqcZ4bD8HEyXTpbxoROI TAgTUTFoKtFGGYe6YEEoLmax+3ckhIj7a+ptwfNJo62tGDKmqlIRy8V9NWgQFmpnNZ/6 2HqPWJRHUC254pEbmO2QfEh0CBtn9YAt/8vIEsek4fJD/YvJfNdsoPqV3MUjN9OEC+fU KjwQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=oibIlkcH; arc=pass (i=1 spf=pass spfdomain=wanadoo.fr dkim=pass dkdomain=wanadoo.fr dmarc=pass fromdomain=wanadoo.fr); spf=pass (google.com: domain of linux-kernel+bounces-144099-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-144099-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=wanadoo.fr Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id k15-20020ae9f10f000000b0078ec8244f78si6223753qkg.28.2024.04.14.03.14.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Apr 2024 03:14:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-144099-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=oibIlkcH; arc=pass (i=1 spf=pass spfdomain=wanadoo.fr dkim=pass dkdomain=wanadoo.fr dmarc=pass fromdomain=wanadoo.fr); spf=pass (google.com: domain of linux-kernel+bounces-144099-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-144099-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE 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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 0C8951C20E93 for ; Sun, 14 Apr 2024 10:14:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4B1772E413; Sun, 14 Apr 2024 10:14:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b="oibIlkcH" Received: from smtp.smtpout.orange.fr (smtp-22.smtpout.orange.fr [80.12.242.22]) (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 9CCF22374C; Sun, 14 Apr 2024 10:13:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.12.242.22 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713089641; cv=none; b=PVnCQo6kbzvN5bbFhTc7eK3hRHHvMj4ObOMOSUwQSHJn0YKJhv625deOrlPzAKe0lF4EDLb7uUKYxoVtF8LS31b5fpz3FdeMi8hXAEPxjACrScFMROpH2a+BG/riHYoZ6fGosCUsAjy040xgh6XhbCwww1+zXhqp/12DcSs8Oto= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713089641; c=relaxed/simple; bh=wTUGgeFPL6oQbMhkQ07Xn7K8s7vcqSJwRTRQoc9gkOk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=TJYFPkhVCnRU5KBjZC5EmQLiEEnnYIyVdOTEaZZpXM9Mg98foIa+NerzOl5wSliT8zid5c2JUrerx9NBDe/6L8mU6wLfGBacNBJ2gLvMQOgKSoWYhpiPamWuYw8RkmmoYEuJ/86glPyI/ijzJpoy0ZVeyJYq98P8kM+jbAJnvpc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wanadoo.fr; spf=pass smtp.mailfrom=wanadoo.fr; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b=oibIlkcH; arc=none smtp.client-ip=80.12.242.22 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wanadoo.fr Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wanadoo.fr Received: from fedora.home ([86.243.17.157]) by smtp.orange.fr with ESMTPA id vwiyrPARNVYR4vwiyrSi3R; Sun, 14 Apr 2024 12:04:38 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1713089078; bh=Wu3eqlNZ33DIowcdMPCmbQIFZiK8nMriLzGayBQf0uE=; h=From:To:Subject:Date:Message-ID:MIME-Version; b=oibIlkcH8xzA74tG14bNIc95dw9UMTiPq2/ZH1PEN04vNkXvakJMWi8NEYvyr8qMJ 2sAG+CYsU3K8c5IDPPYvYUt2i1Sj1DFPLWueSs/HtN0ajbWqVCXQehJX3XheMAxS0y 7D3HJ1rczDBOK4m8TBWsU/9CtIkehZJlaGCqgE6y+5hSGCiq35aDNXdfKiq+686Tj9 b94OJw9qrzDAyNoHyy0tvWP+CwNpmEzyVp97ahEN5p5GT657VtTlSzIOfzbf6sTlHW M4O5dd0p4DHttexu8yM5AVwFdshbugyuzlJq6zzc8cUwg7pzFr6nhuhWIvGV4Ij1CF CWgLb9T6EHI1A== X-ME-Helo: fedora.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 14 Apr 2024 12:04:38 +0200 X-ME-IP: 86.243.17.157 From: Christophe JAILLET To: "Michael S. Tsirkin" , Jason Wang Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , Simon Horman , kvm@vger.kernel.org, virtualization@lists.linux.dev, netdev@vger.kernel.org Subject: [PATCH v2] vhost-vdpa: Remove usage of the deprecated ida_simple_xx() API Date: Sun, 14 Apr 2024 12:04:26 +0200 Message-ID: <67c2edf49788c27d5f7a49fc701520b9fcf739b5.1713088999.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.44.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, but the one of ida_alloc_max() is inclusive. So a -1 has been added when needed. Signed-off-by: Christophe JAILLET Reviewed-by: Simon Horman --- Changes in V2: - fix a typo in the commit message - Add a R-b tag V1: https://lore.kernel.org/all/bd27d4066f7749997a75cf4111fbf51e11d5898d.1705350942.git.christophe.jaillet@wanadoo.fr/ --- 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 ba52d128aeb7..63a53680a85c 100644 --- a/drivers/vhost/vdpa.c +++ b/drivers/vhost/vdpa.c @@ -1548,7 +1548,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); } @@ -1571,8 +1571,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.44.0