From patchwork Sun Jan 14 10:10:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 187956 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2614:b0:101:6a76:bbe3 with SMTP id mm20csp1132054dyc; Sun, 14 Jan 2024 02:10:42 -0800 (PST) X-Google-Smtp-Source: AGHT+IF2rAIgky4cShaX6I3G8qxGldS+MAzfl0vWZ/byZu+uAbigO1YyxCNmQfd31COBnR5vcEiT X-Received: by 2002:a05:6300:8081:b0:199:8cf3:8654 with SMTP id ap1-20020a056300808100b001998cf38654mr5337665pzc.9.1705227042094; Sun, 14 Jan 2024 02:10:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705227042; cv=none; d=google.com; s=arc-20160816; b=yjfsPnccN8Tl4Fin3dSgwVBI0Nzf3MI0jOf0TJN9V6Fk7dQgthaTH+U5d4scQxU1He OHkrL8RTIYPRjVPV5fAvVG9lISs5nBmRUbWObkhwLXmR0d4PlPaE4rNyPBul+YebkXsK gFzitbq09CZvyBCRN+QopAeXpKFranFQ/6DBEPSDXH49h8x8NaxU3bNlgNkk3GumhljI H5Rdx3mbWBvvEVJl87MJG0Rf4JXlvPYnkEbMLH9CpbxA2BH10gjyqXjbrxSh56rYSjgb 5igtkg19TJJf0fDwYRmRy7nQ57HaRK9wIj+9GuPhTh50xHcTmGS+zhJZ5RO8r5K8KwZh 4k1g== 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=52Rd6d5faJ4c/W4ztruf+D+m4SC9RWyWzcn6xVRATJk=; fh=Mse7wrnvBZgPvAVCaOse2QsIiU5Sskyxdic1TZ7C6rw=; b=JSjzAkzvMTvvFgxs6yTKZGMuOOdMlEQ77UTp0i353Yep/XvE21AZc1zLQEdF3IJFgB cB1CsyR8liQpeL4elowcoLMJSHLrrNHfaIiBPUD7dFNIYkt7rHRmTUQgfVoYPkZgHMx2 jiBDHHCvfH8HHzHHkM9Oy/pnZrRO4zgO52Yx6IFWBuQZABMcn4bJNnIqGPG2RuNXOrVt DVjTx9f59JY/G8+DDbuhJUsV69UyoCYW3JXxqaNYrT2qtc+xGt4Q28BjJE2gridrElar PyiWaeFV7NfFVOn6SdEJVvDzmNsfSIVD/WKxIrbVX0kmQx2+fpFfOXOx2BlcFBprZwEi FciQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=LBwRvL1l; spf=pass (google.com: domain of linux-kernel+bounces-25434-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25434-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id ka3-20020a056a00938300b006dac91d7374si6861457pfb.357.2024.01.14.02.10.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Jan 2024 02:10:42 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-25434-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=LBwRvL1l; spf=pass (google.com: domain of linux-kernel+bounces-25434-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-25434-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id D80CB282841 for ; Sun, 14 Jan 2024 10:10:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9916E23BE; Sun, 14 Jan 2024 10:10:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=wanadoo.fr header.i=@wanadoo.fr header.b="LBwRvL1l" Received: from smtp.smtpout.orange.fr (smtp-29.smtpout.orange.fr [80.12.242.29]) (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 E4F2F1FAD for ; Sun, 14 Jan 2024 10:10:22 +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 fedora.home ([92.140.202.140]) by smtp.orange.fr with ESMTPA id OxRbrry6VIwxKOxRbrHroW; Sun, 14 Jan 2024 11:10:21 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1705227021; bh=52Rd6d5faJ4c/W4ztruf+D+m4SC9RWyWzcn6xVRATJk=; h=From:To:Cc:Subject:Date; b=LBwRvL1lmo0J+pYr4CMZ064bd7yJzvGgTeJOFdtg92EgWa4i4z7dxsTO5VG9H6C2j ISGyBX7ioUXQY+4pExpZy2tlMVuts4NGOtwM8nv/YY4SlZ5g+bXNcpduc2PLWcYOMJ 5CCrQfag8OM1kmKnGPodNse+LY+TS+1rPJfBGC5SMbx5YH/NNrRWFvgc3h7Xpk4Mia h9BD8vwIIQDUqEJmGwef4VjnkVFi42t3xhxVUurV/83flw+OhEv33ViGVABXJh/O2C c8t2ujbqS1R/gP8Q9Xy3rEBtIFxtwStUCM80AG99exOk0IkAR1s2YXlhD19Og0DIrw zFliSMuH3cYxQ== X-ME-Helo: fedora.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 14 Jan 2024 11:10:21 +0100 X-ME-IP: 92.140.202.140 From: Christophe JAILLET To: Sven Van Asbroeck , Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , linux-staging@lists.linux.dev Subject: [PATCH] staging: fieldbus: Remove usage of the deprecated ida_simple_xx() API Date: Sun, 14 Jan 2024 11:10:15 +0100 Message-ID: X-Mailer: git-send-email 2.43.0 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: 1788060150638274610 X-GMAIL-MSGID: 1788060150638274610 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/staging/fieldbus/anybuss/arcx-anybus.c | 6 +++--- drivers/staging/fieldbus/dev_core.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/fieldbus/anybuss/arcx-anybus.c b/drivers/staging/fieldbus/anybuss/arcx-anybus.c index 34d18b09bedd..fcd3e3722ae0 100644 --- a/drivers/staging/fieldbus/anybuss/arcx-anybus.c +++ b/drivers/staging/fieldbus/anybuss/arcx-anybus.c @@ -285,7 +285,7 @@ static int controller_probe(struct platform_device *pdev) } } - id = ida_simple_get(&controller_index_ida, 0, 0, GFP_KERNEL); + id = ida_alloc(&controller_index_ida, GFP_KERNEL); if (id < 0) { err = id; goto out_reset; @@ -318,7 +318,7 @@ static int controller_probe(struct platform_device *pdev) out_dev: put_device(cd->class_dev); out_ida: - ida_simple_remove(&controller_index_ida, id); + ida_free(&controller_index_ida, id); out_reset: gpiod_set_value_cansleep(cd->reset_gpiod, 1); return err; @@ -330,7 +330,7 @@ static void controller_remove(struct platform_device *pdev) int id = cd->class_dev->id; device_unregister(cd->class_dev); - ida_simple_remove(&controller_index_ida, id); + ida_free(&controller_index_ida, id); gpiod_set_value_cansleep(cd->reset_gpiod, 1); } diff --git a/drivers/staging/fieldbus/dev_core.c b/drivers/staging/fieldbus/dev_core.c index bf1812d8924f..370a229443a1 100644 --- a/drivers/staging/fieldbus/dev_core.c +++ b/drivers/staging/fieldbus/dev_core.c @@ -247,7 +247,7 @@ static void __fieldbus_dev_unregister(struct fieldbus_dev *fb) return; device_destroy(&fieldbus_class, fb->cdev.dev); cdev_del(&fb->cdev); - ida_simple_remove(&fieldbus_ida, fb->id); + ida_free(&fieldbus_ida, fb->id); } void fieldbus_dev_unregister(struct fieldbus_dev *fb) @@ -267,7 +267,7 @@ static int __fieldbus_dev_register(struct fieldbus_dev *fb) return -EINVAL; if (!fb->read_area || !fb->write_area || !fb->fieldbus_id_get) return -EINVAL; - fb->id = ida_simple_get(&fieldbus_ida, 0, MAX_FIELDBUSES, GFP_KERNEL); + fb->id = ida_alloc_max(&fieldbus_ida, MAX_FIELDBUSES - 1, GFP_KERNEL); if (fb->id < 0) return fb->id; devno = MKDEV(MAJOR(fieldbus_devt), fb->id); @@ -290,7 +290,7 @@ static int __fieldbus_dev_register(struct fieldbus_dev *fb) err_dev_create: cdev_del(&fb->cdev); err_cdev: - ida_simple_remove(&fieldbus_ida, fb->id); + ida_free(&fieldbus_ida, fb->id); return err; }