Received: by 2002:a05:7412:d008:b0:f9:6acb:47ec with SMTP id bd8csp142512rdb; Tue, 19 Dec 2023 11:46:31 -0800 (PST) X-Google-Smtp-Source: AGHT+IFe2/hCKEN29R7+4w1SdQhtB9CX7u58QiKS/aoStAiR8Vu2sTTUjTJfc2bs9BeDfRnyWOms X-Received: by 2002:a17:906:d6:b0:a1f:a0f1:ec60 with SMTP id 22-20020a17090600d600b00a1fa0f1ec60mr10304129eji.14.1703015190902; Tue, 19 Dec 2023 11:46:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703015190; cv=none; d=google.com; s=arc-20160816; b=KGjg9p4rD8c3l9iLFkAF3sMiU7xlRi20DtL5sxKPjODcX9XLeTlXVh3uV9bWnUD6Q3 7pcDevym0Jd+6YbHhpvR8cwLQX9KaLGPs9j0CQGIel/Flt9RkXjhZwIvjc2VLQlfsz2g IWo/ajFGsSgA1RcrX5cIi2k2aqFwK1BZRD5OINesnPObCloswPN+KfiIunuVp5T7pZRn ZYET1I5vung9WOXrFcDr27yMI8M0CEOoX/o2qz8Shoezm9UmCSlcR4khthwEU1WHD1cU jpZk7NC44/HFeoe4Rd6qxpapV44J3Xw4v28/1HpJoQNFuttkMzOI7E06ytT6CoMxmYND /uWA== 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=7M2CUQpwgjxF1irpAVXAbKH37iRCkSgrRaBNR4Uhpg4=; fh=jSo4oGMCFlATFHpxXDHEzRfmMKyFjdOwQh3DTunHiHo=; b=lGn6e36xtS/Us9hY3yeDMvUXI+hqIBU5QoQ+Aj8EvGL2O5XWcVvleUC4pP3yy3PrIQ m4TuL7xXz8XZHmf/p/FbHMfK0hyWrkueVXC0jcMt9SnIgbe7NjG+vnyBtKpmcxRnqhXo bq17X2krLsyZlnbOiHixJng/UmJV+GmgHI1asA08KCd2Kw+BulPFkZ6pFrLx0L/mjwOu IsN9LA7y+QJB40+8wNO0n2xMAaNvT5wsQXAj1PJp7P9GrUIV83hGW2uqPF8SiKUM0ffs ycWgmQUpdMBHfJGMWeE+LWcYW8IdOaxccjQFCEtty5fH3QwE5RFwIyqAh4W2eesfOVEz d6Bw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=URI7oMNT; spf=pass (google.com: domain of linux-kernel+bounces-5883-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5883-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id b25-20020a1709062b5900b00a268a585037si197354ejg.916.2023.12.19.11.46.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 Dec 2023 11:46:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-5883-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=URI7oMNT; spf=pass (google.com: domain of linux-kernel+bounces-5883-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-5883-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 545151F27120 for ; Tue, 19 Dec 2023 19:37:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C2CC640C07; Tue, 19 Dec 2023 19:34:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b="URI7oMNT" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.smtpout.orange.fr (smtp-27.smtpout.orange.fr [80.12.242.27]) (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 A162C405CB for ; Tue, 19 Dec 2023 19:34:02 +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 pop-os.home ([92.140.202.140]) by smtp.orange.fr with ESMTPA id FfqmrwJWBO9apFfqmrMy24; Tue, 19 Dec 2023 20:33:59 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1703014439; bh=7M2CUQpwgjxF1irpAVXAbKH37iRCkSgrRaBNR4Uhpg4=; h=From:To:Cc:Subject:Date; b=URI7oMNTP6dtjUHuREZTiAp0OXCfjCKk/WxX8Z/5LWVRXDE6iNQ8sZd5ELg062+Ed X26VgA/780AmEnGx6WzjoWPYTAxGCH7BGp7Vc3liOwUs5ETw5dtP78U1/0uCU0DIKa nQ876NuA0/sNogK10tU83cGBjnfgqdYz2DLPDwKmY82QIZoy3hz4I/1XGDrPMOlzx4 bIL4uyOzTcgX5s+eGsk9gz7c8FDA6zYn9p9E79MPdPzcuACPg0mFHeBVJALAtPX0V+ 9q9CwQCgqCJN0GL82AlnXvnn4N0iOYDPjunx4xtwVP7IDnPTusJvKKh1yxAj+xgBId IGu30uiXGzy4g== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Tue, 19 Dec 2023 20:33:59 +0100 X-ME-IP: 92.140.202.140 From: Christophe JAILLET To: Fenghua Yu , Dave Jiang , Vinod Koul Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , dmaengine@vger.kernel.org Subject: [PATCH v2] dmaengine: idxd: Remove usage of the deprecated ida_simple_xx() API Date: Tue, 19 Dec 2023 20:33:50 +0100 Message-Id: X-Mailer: git-send-email 2.34.1 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(). This is less verbose. Note that the upper limit of ida_simple_get() is exclusive, but the one of ida_alloc_range() is inclusive. Sothis change allows one more device. MINORMASK is ((1U << MINORBITS) - 1), so allowing MINORMASK as a maximum value makes sense. It is also consistent with other "ida_.*MINORMASK" and "ida_*MINOR()" usages. Signed-off-by: Christophe JAILLET --- Changes v2: - remove note about compile tested only, now tested on hw by Fenghua Yu - fix some wording in the commit description [Fenghua Yu] v1: https://lore.kernel.org/all/a899125f42c12fa782a881d341d147519cbb4a23.1702967302.git.christophe.jaillet@wanadoo.fr/ --- drivers/dma/idxd/cdev.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/dma/idxd/cdev.c b/drivers/dma/idxd/cdev.c index 0423655f5a88..b00926abc69a 100644 --- a/drivers/dma/idxd/cdev.c +++ b/drivers/dma/idxd/cdev.c @@ -165,7 +165,7 @@ static void idxd_cdev_dev_release(struct device *dev) struct idxd_wq *wq = idxd_cdev->wq; cdev_ctx = &ictx[wq->idxd->data->type]; - ida_simple_remove(&cdev_ctx->minor_ida, idxd_cdev->minor); + ida_free(&cdev_ctx->minor_ida, idxd_cdev->minor); kfree(idxd_cdev); } @@ -463,7 +463,7 @@ int idxd_wq_add_cdev(struct idxd_wq *wq) cdev = &idxd_cdev->cdev; dev = cdev_dev(idxd_cdev); cdev_ctx = &ictx[wq->idxd->data->type]; - minor = ida_simple_get(&cdev_ctx->minor_ida, 0, MINORMASK, GFP_KERNEL); + minor = ida_alloc_max(&cdev_ctx->minor_ida, MINORMASK, GFP_KERNEL); if (minor < 0) { kfree(idxd_cdev); return minor; -- 2.34.1