Received: by 2002:ab2:69cc:0:b0:1f4:be93:e15a with SMTP id n12csp901833lqp; Sun, 14 Apr 2024 05:09:41 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWaxRO9auRDxoaORALPseZoRIpMwKIQnsnLwdibkPFnzytFBe32DkbL4178KeDM/7VwwWKKavr/OqoAQm0eyyapCOd+39eGbwZeMT0y9w== X-Google-Smtp-Source: AGHT+IGgtwB7fpXt3LkYXKAhbKH/KK5AvE4dJs184Nlh+hoSmFzrXWkreGzsxl602GLnA0eSMMmW X-Received: by 2002:a05:6a20:7491:b0:1a9:9c4a:a40d with SMTP id p17-20020a056a20749100b001a99c4aa40dmr10208439pzd.28.1713096581529; Sun, 14 Apr 2024 05:09:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713096581; cv=pass; d=google.com; s=arc-20160816; b=lIVyO+S1u2UcQK0LAC44QuMnxixKZ+dOKeKXClfZzqab37Y7KVanelafkTnm1WxeW0 xmn1ZvFLQTrSvLxUzJJWXT+be7vjSt+D2Eq229zNum4TGBtC2O0YxAVVjHofuF64VmwU HPy4fEwq3sBT5Y7Z92DTMP+4aibwH1n7l+Zcbuimr4lx93GWWMtJXQ2fYC1ZHyrvDAdq LqYmslTQvuA0ML/8M950DYiqOlGkQdoJFgodI+Qa0ahK3l6ck8hVSp59Z7e4kkiy/us7 5sGaD+CNXXfIJxWLewC9EdzIbZvr6lt6/r4c/HuPBpYFr1fnWBKl+B+JTnqsXZRK01oJ u4KQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=y4ec2/b3UC1Scrh9RirGlj8YTteHQuh4UxLRR7ROzEw=; fh=37G8GNHtIeZHcwMLGUW+Yipm6r8tQzYHtGyMUJTY+aM=; b=uGbKUzustRCnL/WgQ02trzHCzR7dzMD2FEYH40dM6XhUE+qp/Le9X84uHTAVOVpuwl PjvhO0S/owozjAei0zaE1q/6Q2xM+dC61+ZKuO6u2A5CaYMrIplPqTXWK6xAVQHd11Hj 3n+mAS26FaJyPU1Q6x/DpDBRXfH8aU0BOKlJOmZKpyD8awHzi8hXfJVX8y4O1/SIA7R3 X+oAfZZxCnKJtbDTMUCkg6OPPE/oWYMcNAKxc0dtJ1fQ8jW5a1ZmfzE8LlosgZKxX9nV aW2+3va6tZetrmz32fszo9kHoV/CCLlWydrE+GiuNtmDwuXVK5qK9GxDDoAXST6z6t/p wAeg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=AZRzS+fw; 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-144133-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-144133-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=wanadoo.fr Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id s6-20020a625e06000000b006ecf85e6addsi6405420pfb.14.2024.04.14.05.09.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Apr 2024 05:09:41 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-144133-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=AZRzS+fw; 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-144133-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-144133-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 031FDB215F4 for ; Sun, 14 Apr 2024 12:09:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 834F13FE55; Sun, 14 Apr 2024 12:09:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b="AZRzS+fw" Received: from smtp.smtpout.orange.fr (smtp-25.smtpout.orange.fr [80.12.242.25]) (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 71A141E53F; Sun, 14 Apr 2024 12:09:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=80.12.242.25 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713096556; cv=none; b=qejIiKIZkwz3v7SKskzP+qQ6CoPXApVvAfUHYwWaMOF1bkMAjR74g4iOSqRSdI1PvGIUALx9PCamJeCusB8pGajrDrtQvRGyUbyNlZ6JgCr6D8lmFC0JTBxS0/olZKOS6ayIi6ngl/F42uhyH3b9XhYTpAYMGiOadScD0rQc2cw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713096556; c=relaxed/simple; bh=sZ6MvvpYLG2csFo5XgIBgIcSCOrtryJDcKj3GuzJ0Y8=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=krZqjKDlywPvtgPqhHzuhzHvVJJc4Z/JoI0cfW+YGpm6AdDya2/vKZcXrVMTQK/1Qh3avUvW3Gkpms21GnQ6r+V1nvm1P+oMHcw5X9HNJPFjSYqLME+15KliKp+Rc+Gs0i5roc/YhK3Cf/rhGl43AMRZBvqupXaRIJKYmAAJP0U= 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=AZRzS+fw; arc=none smtp.client-ip=80.12.242.25 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 [192.168.1.18] ([86.243.17.157]) by smtp.orange.fr with ESMTPA id vyfUrUVZekBJPvyfUrFamz; Sun, 14 Apr 2024 14:09:11 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1713096551; bh=y4ec2/b3UC1Scrh9RirGlj8YTteHQuh4UxLRR7ROzEw=; h=Message-ID:Date:MIME-Version:Subject:To:From; b=AZRzS+fwP3bEkhXZWpY0zYNMG98IEvLCLDs+FxNFr9EK5hcWLkSEruhrpuFGXfEo1 Eli5eiG8m4daOp+jhENuVikOeba67zSzDChHbuPjb7PwUvQcDqe/s7+VFEGEiBmabZ okPwjlAn6a/ZrqeTmRcTRn0p9y8EXNpmvkUNK3Z7RotML+Nxgmf2cdHM2rq7taNVHZ N13LGs0gyo3auQUowhWC8pFSPe6hlIfRl0M2VKPZQuEIWyEegYJvP9yHPnBjWvvEta LxtNWKGMSWYUffVma5r17nq3BrjHo2oCo0+2XKtR69+Nd/Hj7g2BDEZZaLkk33DyWc Pshryi+mvfBgg== X-ME-Helo: [192.168.1.18] X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 14 Apr 2024 14:09:11 +0200 X-ME-IP: 86.243.17.157 Message-ID: <779bc8ae-0f24-4f34-8f20-633e6e6f2fc5@wanadoo.fr> Date: Sun, 14 Apr 2024 14:09:08 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] usb: gadget: function: Remove usage of the deprecated ida_simple_xx() API To: Greg KH Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org References: Content-Language: en-MW From: Christophe JAILLET In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Le 14/01/2024 à 12:39, Christophe JAILLET a écrit : > 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 > --- > 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(-) > Hi, polite reminder. CJ > diff --git a/drivers/usb/gadget/function/f_hid.c b/drivers/usb/gadget/function/f_hid.c > index 3c8a9dd585c0..2db01e03bfbf 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 076dd4c1be96..ba7d180cc9e6 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 29bf8664bf58..12c5d9cf450c 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)