From patchwork Tue Dec 19 05:01:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 180755 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:24d3:b0:fb:cd0c:d3e with SMTP id r19csp1720001dyi; Mon, 18 Dec 2023 21:02:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IHDFln1StvDUxgsSBP1jco4DdwaVjtdn64Dbu44wBtmvwEE/8XlX1CLzpVr6KkgrjT4eWJ2 X-Received: by 2002:a05:600c:44e:b0:40c:6e8:610a with SMTP id s14-20020a05600c044e00b0040c06e8610amr9263375wmb.56.1702962139467; Mon, 18 Dec 2023 21:02:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702962139; cv=none; d=google.com; s=arc-20160816; b=JK4YqY4eU+BbWE3buQLqH1i19yPbp+h3yoOU7Woc3gXu6YfRSKzHIRQbBogh8vBoOm 2+Wokhb694kbfS++d0tBEktBFJlaOgWKNgiD1N1pDynDPWga/FNQDtqBXPChlF18vljv NieZrIxTh4gb5KLjzypeiHKF0I81Z0Yg+G7G6kKvTizbT2A1rxGQtfU3QPvsc7N7UgUh bWJMM9Hp1Rtk15ieRx2D0xbJh6lONbLzMIC6XKYqRYN3F/vZ7ZYfkS8YFtZXlPnwvT0+ TTd3/PXGCHTM4y8dhRFOXAHN+gt6OaX0LioMlDZEXHV0dQ7Uwhodg7axPgwIiJ6AD6ZO LKfg== 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=1HXfZutebd4IF1uNL0rih5Mj5PnxGJrPUITlr9cOY+Q=; fh=pdxrQNlG6JVc6YgRytcvfeapxe5HU2SsK+HoXilt+ag=; b=dN1RUV6xWKNBxGeE/jb2jXWX0z0l75riqq30o8Kvfv4SNkd29ukvnaunAarB9+g0Dx i/a6gbALZalp82IW42+Xivh7v1SnIkyLMpwgWgg9b5XyPuDgcea3fZi7SBgfifVQTw7d UjQRdF2J9QkLl+2f6b8sxK4l1VMGIAssBFoPB+EurWWiLp5wbY/6/nt/I594YsFKbBV2 ydHuXmPwuHZuCl3CgTtQjOz0vd3gcLw7Enqkav4TcNh86p7jOIz0Kyrj7VgKd+WE6qPF vAAvTy52QuXHzMCjtzQ6zGHPiyHbj2swmDrg/w6yGptdm995EhXzIyuhBZN/xJj1tpOJ V38g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=NrHNZz+Y; spf=pass (google.com: domain of linux-kernel+bounces-4702-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4702-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id h25-20020a1709062dd900b00a2349bf39fasi1844495eji.1007.2023.12.18.21.02.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Dec 2023 21:02:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-4702-ouuuleilei=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=NrHNZz+Y; spf=pass (google.com: domain of linux-kernel+bounces-4702-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-4702-ouuuleilei=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 127FA1F24B99 for ; Tue, 19 Dec 2023 05:02:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 248627479; Tue, 19 Dec 2023 05:02:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b="NrHNZz+Y" X-Original-To: linux-kernel@vger.kernel.org Received: from smtp.smtpout.orange.fr (smtp-21.smtpout.orange.fr [80.12.242.21]) (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 E506C6FAE for ; Tue, 19 Dec 2023 05:01:58 +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 FSEnr9yeXuIvyFSEnrRqtn; Tue, 19 Dec 2023 06:01:51 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1702962111; bh=1HXfZutebd4IF1uNL0rih5Mj5PnxGJrPUITlr9cOY+Q=; h=From:To:Cc:Subject:Date; b=NrHNZz+Yny3Q/Iv0otUfEvoRtvi0dFyGFaHfyAqn+F4rQnidWt7ZI4nw46d/JwhRA mu9Iim9JSQsw/fppcAa1w6airT6gQ1nxftBwY9gBisw0P878G1h3wpteqx26Vc/7V4 LGvbQmR6wdvW5WVav7v/E04tw460U5nmlht0AmsFCR4QY8Cs7cO/frZuRK6Dz3GTbI Sm3FqWHny6m+K9Lc0Ti7J6CBuE/NE6YZ4cmo/NkTrz52gBd2kYnPrIgnTcg1kldj/5 L+qgP9yONmxZX4yzMl0b91HTm0B/EgqqhoYeFIer4jN59Om4FEzUdx3M66MTRFL8cN fdlMJPwO5eWHg== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Tue, 19 Dec 2023 06:01:51 +0100 X-ME-IP: 92.140.202.140 From: Christophe JAILLET To: Sudip Mukherjee , Arnd Bergmann , Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET Subject: [PATCH] ppdev: Remove usage of the deprecated ida_simple_xx() API Date: Tue, 19 Dec 2023 06:01:47 +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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1785685228017173173 X-GMAIL-MSGID: 1785685228017173173 ida_alloc() and ida_free() should be preferred to the deprecated ida_simple_get() and ida_simple_remove(). This is less verbose. Signed-off-by: Christophe JAILLET --- drivers/char/ppdev.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c index 4c188e9e477c..ee951b265213 100644 --- a/drivers/char/ppdev.c +++ b/drivers/char/ppdev.c @@ -299,7 +299,7 @@ static int register_device(int minor, struct pp_struct *pp) goto err; } - index = ida_simple_get(&ida_index, 0, 0, GFP_KERNEL); + index = ida_alloc(&ida_index, GFP_KERNEL); memset(&ppdev_cb, 0, sizeof(ppdev_cb)); ppdev_cb.irq_func = pp_irq; ppdev_cb.flags = (pp->flags & PP_EXCL) ? PARPORT_FLAG_EXCL : 0; @@ -310,7 +310,7 @@ static int register_device(int minor, struct pp_struct *pp) if (!pdev) { pr_warn("%s: failed to register device!\n", name); rc = -ENXIO; - ida_simple_remove(&ida_index, index); + ida_free(&ida_index, index); goto err; } @@ -750,7 +750,7 @@ static int pp_release(struct inode *inode, struct file *file) if (pp->pdev) { parport_unregister_device(pp->pdev); - ida_simple_remove(&ida_index, pp->index); + ida_free(&ida_index, pp->index); pp->pdev = NULL; pr_debug(CHRDEV "%x: unregistered pardevice\n", minor); }