Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp249707lqr; Wed, 5 Jun 2024 05:12:17 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUtwNlzY9NFa616Mu7spf4UQQwd04wmWFo8bkm9sSmbtBX8I7qiajbwQp8m36hWerEs4UTjdC3IN1qKnJVg7UOXh5qryRGtH3pDKtcymQ== X-Google-Smtp-Source: AGHT+IF4gd2cexZpxFz6B3y9eG3orVh2b0nERDJtHLtCO//f1rZzarxZVPEYFnwVfu6E/z2ZUS0l X-Received: by 2002:a17:902:ec8f:b0:1f6:8ae4:50de with SMTP id d9443c01a7336-1f6a5a852b4mr28614595ad.61.1717589536850; Wed, 05 Jun 2024 05:12:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717589536; cv=pass; d=google.com; s=arc-20160816; b=gu5m1zPr/o0FgP837wACwe1qPUsefEWEU/uFCsZ3PIfb1HiXzLzIRhfQqVHi8IKcdi DrisxSl+dCaJdJAv8FrL44rlmLvjX9NQBJL6EAFzZ/7wZIEAUyJ6/RmncMl/siSlL9ke YKRwZ60/RaPj1JAvK4Y8ZDEeUAyJnNKsKKFhY1F1S9U/NjyzG8hGX51MfTH3CTdT6rEX yrXQ3sh0vdZ/ubd1r4LFZXraKVcHT9fv+5IzjCg6fIxGBfI3gR9IYYZeTNxmVx1fN9eS s5LAIliEjLOFogaeHUu/F0ojbWLoz++78yy1rCiB4fECEmnRxXILr3QyxZefraStQVaZ U2LQ== 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=hxRSCb8Aw5+1sxLXGM7joKRjd19twPEvZjug9r4tFRQ=; fh=7hLlIN7bJqbqFplQXUjQEcxpsKywM0LX5fyfjiUPlWw=; b=BiTAKRhZ1EATrMjjbhZH/45r0oYQZIPrNZ6SkSodsZ9fMnfl+QwhkPTZKmG9q+oy3M YPWGVFkyp4VSh4z10UKvlqIn9vKxLmf8YgUpMqO7oK/vWiVUheIQZZ7FxSmdCmUbv1kp IrZ5i7jQKx4wqhOo74cc0ztYjeIHU7UtVMcugnwFhUFJDRp7bSrnKnIeMD/95bOGDaqh 1BvnGeWx8+XARjE1LmVz0YlgyjXGL0jl00cGL2VE3K0CFMXXUKriBJqQuY80qatWzz2S 0Y0Xn6++BvC1EH/ct1bwv+p3gH+pwqViidh4mLrOymIeFjfdPCGqU1vkPBWXsrVxinOm psrA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=p8KiMBdU; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202345-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202345-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d9443c01a7336-1f66f06ad6fsi62209495ad.394.2024.06.05.05.12.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 05:12:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-202345-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=p8KiMBdU; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-202345-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202345-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 52C6C284EFA for ; Wed, 5 Jun 2024 12:01:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E0E1319FA9C; Wed, 5 Jun 2024 11:51:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="p8KiMBdU" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E605D192B6D; Wed, 5 Jun 2024 11:51:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717588300; cv=none; b=bsMeby+FtCJIb9c5PVMIdYLZqjxWXhJygUllopYRcoTj0i5P6b5+zRq8rXT1RExIUltNjYbujuL7EBw8v8Q7iqCV1KT5KjzWgB1jpa+lfc5esLSv8g/oJah32gqA7IGtm9xOOl4tVG4g1LdS/L2qSpMiqwYNfL4GKCLTuKyXcDc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717588300; c=relaxed/simple; bh=ZPF7T9kuWu/BZfONDXqgsMzLC8AUBVBAEKzU6hLpZ9k=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mnqM3wQD5/5aoZlGe4zPFOjWtb+OFahUAve7aDdEB/qOH24kkAiWn4/o8uqDaxYmFmM0GG1R6MCpJNrwvS/saFgE7hfN45hLOExutOVp/aAOSldFc+oVdXSD5tcVJ/a/OXHfgpDMcmzY0rTnxT9Ha+/C03AoCVcs3jg9AIPESBM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=p8KiMBdU; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 89F64C4AF09; Wed, 5 Jun 2024 11:51:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1717588299; bh=ZPF7T9kuWu/BZfONDXqgsMzLC8AUBVBAEKzU6hLpZ9k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=p8KiMBdUIYOAwzHlE0Y43NU0GQJCA+6r+G2ePX8c4iQEge7RuxDyENA6WMVX4Xv8e aHkTq3ZthcADtMYzy6JvcsXYPWy3jK61tRkUB1kaAsoyPUsoFNY7ot4B9RZgfchi7f Y38ymOSkrX4XzPX5Nzokti100k7wCsP5LR8GJPRCWCmDwhmoJ5S0eeSZQ9seT9uLTo /6XtZ8RPzNvWHj+7tL3bZVi55Qgjm8cvSzIcJ6Id2qiWMh5k8aL3YsOvVi13LianrU sctiNbe0ZhwOfFWh9ilGhuAHX/ohU7V4+Z98RehcyThRb2XFMUA01NQJ8I4Gh7gfUD LJ3+m0HgYXLvw== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Christophe JAILLET , Greg Kroah-Hartman , Sasha Levin , aladyshev22@gmail.com, ivan.orlov0322@gmail.com, azeemshaikh38@gmail.com, linux-usb@vger.kernel.org Subject: [PATCH AUTOSEL 6.8 14/24] usb: gadget: function: Remove usage of the deprecated ida_simple_xx() API Date: Wed, 5 Jun 2024 07:50:24 -0400 Message-ID: <20240605115101.2962372-14-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240605115101.2962372-1-sashal@kernel.org> References: <20240605115101.2962372-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 6.8.12 Content-Transfer-Encoding: 8bit From: Christophe JAILLET [ Upstream commit 920e7522e3bab5ebc2fb0cc1a034f4470c87fa97 ] 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 Link: https://lore.kernel.org/r/7cd361e2b377a5373968fa7deee4169229992a1e.1713107386.git.christophe.jaillet@wanadoo.fr Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/usb/gadget/function/f_hid.c | 6 +++--- drivers/usb/gadget/function/f_printer.c | 6 +++--- drivers/usb/gadget/function/rndis.c | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget/function/f_hid.c index 3c8a9dd585c09..2db01e03bfbf0 100644 --- a/drivers/usb/gadget/function/f_hid.c +++ b/drivers/usb/gadget/function/f_hid.c @@ -1029,9 +1029,9 @@ static inline int hidg_get_minor(void) { int ret; - ret = ida_simple_get(&hidg_ida, 0, 0, GFP_KERNEL); + ret = ida_alloc(&hidg_ida, GFP_KERNEL); if (ret >= HIDG_MINORS) { - ida_simple_remove(&hidg_ida, ret); + ida_free(&hidg_ida, ret); ret = -ENODEV; } @@ -1176,7 +1176,7 @@ static const struct config_item_type hid_func_type = { static inline void hidg_put_minor(int minor) { - ida_simple_remove(&hidg_ida, minor); + ida_free(&hidg_ida, minor); } static void hidg_free_inst(struct usb_function_instance *f) diff --git a/drivers/usb/gadget/function/f_printer.c b/drivers/usb/gadget/function/f_printer.c index 076dd4c1be96c..ba7d180cc9e6d 100644 --- a/drivers/usb/gadget/function/f_printer.c +++ b/drivers/usb/gadget/function/f_printer.c @@ -1312,9 +1312,9 @@ static inline int gprinter_get_minor(void) { int ret; - ret = ida_simple_get(&printer_ida, 0, 0, GFP_KERNEL); + ret = ida_alloc(&printer_ida, GFP_KERNEL); if (ret >= PRINTER_MINORS) { - ida_simple_remove(&printer_ida, ret); + ida_free(&printer_ida, ret); ret = -ENODEV; } @@ -1323,7 +1323,7 @@ static inline int gprinter_get_minor(void) static inline void gprinter_put_minor(int minor) { - ida_simple_remove(&printer_ida, minor); + ida_free(&printer_ida, minor); } static int gprinter_setup(int); diff --git a/drivers/usb/gadget/function/rndis.c b/drivers/usb/gadget/function/rndis.c index 29bf8664bf582..12c5d9cf450c1 100644 --- a/drivers/usb/gadget/function/rndis.c +++ b/drivers/usb/gadget/function/rndis.c @@ -869,12 +869,12 @@ EXPORT_SYMBOL_GPL(rndis_msg_parser); static inline int rndis_get_nr(void) { - return ida_simple_get(&rndis_ida, 0, 1000, GFP_KERNEL); + return ida_alloc_max(&rndis_ida, 999, GFP_KERNEL); } static inline void rndis_put_nr(int nr) { - ida_simple_remove(&rndis_ida, nr); + ida_free(&rndis_ida, nr); } struct rndis_params *rndis_register(void (*resp_avail)(void *v), void *v) -- 2.43.0