Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp6262473rdb; Thu, 14 Dec 2023 12:59:05 -0800 (PST) X-Google-Smtp-Source: AGHT+IF/Z4UbD+QWQcOn1SfoIpYzJ+hFh6fN+wVnj/xEJZNis7MedUFhIC1WrIIWk9m+z5UUhQRr X-Received: by 2002:a05:6214:501c:b0:67f:8a1:864e with SMTP id jo28-20020a056214501c00b0067f08a1864emr2276324qvb.131.1702587544887; Thu, 14 Dec 2023 12:59:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702587544; cv=none; d=google.com; s=arc-20160816; b=kYUm90m+a6naa5bV9x3T3QqoYTSz4sQbgzAdf5WP+WdDvx5mu0cYXS7RE7gag4psby wegRXs/Q3rYQXa4fgKGYG3i+RmoI9pYch32JjuaYg+cj/+gyAIegrhEkE8xQEHVAWtlJ wdN3fnbOqkmENPF6OBkLyGuHAifAMShge+JwXkOipMlOMGj/Hv2563Uexu12M7DF3I4Z zoyCZAU9527NJShLGGtYfNyy2qajhfFzgydiXtS6uXcBqQ4q0RaIbMZ/6MDMxPCwUYVn +sfJyJ334tDM7zdbIuAgaH7FBAz1octuyCnMGNgiIAw8pBWQd89hzVQg1wTvixYpB0h8 26+g== 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=hcT2b/b6xTR+1AfrfpvlyfQ5cS5UMi2KsmeUgQqFiK4=; fh=cl+6YDN9/MzhYCY7GwAQxN/akaUxoqmNAH0L5wFBAOc=; b=FWcQhPRsny/wkC1ASoaYZ17uFzWITQPdZHEyZ9ewXo0+FSR1m7mpXS6dU1e9rJT74r +Dr/iFkE2ojO7yH9hw6EV6Vi2iBUb/rFauSFP2RUODOfme8ffq9etBHM6bCGGhlUdH0v 9IAAB5CZ9bbh9Dfw9rAdwStSY+O6ffJ1eZ0kQdU8oDaSaprr2kEA/YoahXvk7XVcqFGm 9BrcVXPfNnRMo1J0tL4c2GqBfwmtqiB8URIwVtMYp7jojx1Z3MbxdKJXwby8dervDpbY 7XPJv4e0fzSh6EK40fvZpX7boVGXmFF8kcZHGGYoBV0JkUggKGvoZG/k2LomjwMRGE06 BfBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=no427WYR; spf=pass (google.com: domain of linux-kernel+bounces-101-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id o13-20020a0ceccd000000b0067a95adb6bdsi16049476qvq.57.2023.12.14.12.59.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 12:59:04 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-101-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=no427WYR; spf=pass (google.com: domain of linux-kernel+bounces-101-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-101-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id A2DC81C21C1D for ; Thu, 14 Dec 2023 20:59:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 53E5D6D1AB; Thu, 14 Dec 2023 20:58:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b="no427WYR" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.smtpout.orange.fr (smtp-24.smtpout.orange.fr [80.12.242.24]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C6734282E7 for ; Thu, 14 Dec 2023 20:58:39 +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 Dsfdr7wPcMO0QDsfdrnicB; Thu, 14 Dec 2023 21:51:02 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1702587062; bh=hcT2b/b6xTR+1AfrfpvlyfQ5cS5UMi2KsmeUgQqFiK4=; h=From:To:Cc:Subject:Date; b=no427WYRMy2s0aygADy5g9EOe3diE20SSlJA9Ki1nMexv59xQQBKtdfRVknJt7lxW 7ZI8PULUI+71968sLXcPHJDOb18fFhXcHf/qgaZpys3dLwPMUlyeFWWFLV4yzLq379 +pSk1Y0KK9S83D9DRHw6Hra0+3t72JoawwJkB0hhnKeMQCj+L0XyWspl6f2jeJG3PO Dk9v6YaO5GlQcJEtqlZFQpzj5Pb5ZQOg5H+pjpaGAiK8aKxFZJLWJXfTAbzKKxBFuj acLiDQPiE14pzTJAsV5mCl4MdHK9CwR3G3fnZhN425yAT838E/VIntia6SiaaqNnHm VdAelwxBBQHXA== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Thu, 14 Dec 2023 21:51:02 +0100 X-ME-IP: 92.140.202.140 From: Christophe JAILLET To: Namjae Jeon , Steve French , Sergey Senozhatsky , Tom Talpey Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-cifs@vger.kernel.org Subject: [PATCH] ksmbd: Remove usage of the deprecated ida_simple_xx() API Date: Thu, 14 Dec 2023 21:50:55 +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. So change a 0xFFFFFFFF into a 0xFFFFFFFE in order to keep the same behavior. Signed-off-by: Christophe JAILLET --- fs/smb/server/mgmt/ksmbd_ida.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/fs/smb/server/mgmt/ksmbd_ida.c b/fs/smb/server/mgmt/ksmbd_ida.c index 54194d959a5e..a18e27e9e0cd 100644 --- a/fs/smb/server/mgmt/ksmbd_ida.c +++ b/fs/smb/server/mgmt/ksmbd_ida.c @@ -5,42 +5,33 @@ #include "ksmbd_ida.h" -static inline int __acquire_id(struct ida *ida, int from, int to) -{ - return ida_simple_get(ida, from, to, GFP_KERNEL); -} - int ksmbd_acquire_smb2_tid(struct ida *ida) { - int id; - - id = __acquire_id(ida, 1, 0xFFFFFFFF); - - return id; + return ida_alloc_range(ida, 1, 0xFFFFFFFE, GFP_KERNEL); } int ksmbd_acquire_smb2_uid(struct ida *ida) { int id; - id = __acquire_id(ida, 1, 0); + id = ida_alloc_min(ida, 1, GFP_KERNEL); if (id == 0xFFFE) - id = __acquire_id(ida, 1, 0); + id = ida_alloc_min(ida, 1, GFP_KERNEL); return id; } int ksmbd_acquire_async_msg_id(struct ida *ida) { - return __acquire_id(ida, 1, 0); + return ida_alloc_min(ida, 1, GFP_KERNEL); } int ksmbd_acquire_id(struct ida *ida) { - return __acquire_id(ida, 0, 0); + return ida_alloc(ida, GFP_KERNEL); } void ksmbd_release_id(struct ida *ida, int id) { - ida_simple_remove(ida, id); + ida_free(ida, id); } -- 2.34.1