From patchwork Sun Dec 10 17:13:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christophe JAILLET X-Patchwork-Id: 176371 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp6615832vqy; Sun, 10 Dec 2023 09:14:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IHYEEjPlcXLduBwECox/3TqttwXzBr8WTzL6VMfVDuQbJY6EzfBBZAEvmKtqDOO3kmh/88+ X-Received: by 2002:a17:903:120b:b0:1d0:c55b:c55a with SMTP id l11-20020a170903120b00b001d0c55bc55amr1571942plh.60.1702228495711; Sun, 10 Dec 2023 09:14:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702228495; cv=none; d=google.com; s=arc-20160816; b=Jal/y24/CFNwR3D3R1ETsxGeNY4Txj8j/Q5FwS9K7QaENNwopBzK+im2G/bNTuIhyN S6fFQCu9e4yx+xK4hpsU/BmDf0uZ//vwehXbnSMvblXMPoAizIKVwutENOP6kVdy8nIk Z9yVoXhs4j8hrduzKhmoAB6yYmoGxaToUGxbE/rfdP/Gb+0rIGEFVVF9+fLe2CdidmX6 N2Sp+IJK5YvWv2A3gqWQIoR17s0XyAVTYMi4s7vqVlE1x9yEietoE9yMOuKkrCcuWmTF J7hsqeNQWgivnr0HR2o3zrevv7KB8vVhedMJsjTPWYZrVYCWe1nyz94YR650SP/hbC8N ePxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=rcjCWYjJHAMlpZ0Yk1Euqbw2V9DTH6RMOjoIxBb+Yi8=; fh=iOTh0dja0zRkGPJsuM1o4fAC2SelmeuRAHgiWFSkP0Q=; b=Ggp4Yh3owZGRV0vuS/I2aM8KuMqjyiwYDU1TJ10SeG2kN2JaKVkxPwli5cHJc/p8XS iQrQkmbzPOFTj3lB5syWYZA9aSDV0nmIK81eKZL8PbtbeRu+gyn/BOOi0iONIGicPInO HP8oO10ARDVGo1eQCiEz9PI0y3apE6FBdxVO9Ar8iyhk0N3S0J2wKtKBwu6L3JnQNdTl 0E5If/ASF0paUR/6wgCPlos7UR1ZIpvx7jUREZ/2xaLrUHNJ+LrUDZCamf0P+jmbIwnv EC8EOxsOH5rzSYVWbxz1iAPXGfo6o7HzJ1t1i9G/rfxt+ARKG4FNe3JRZ7eGNCDUqSzg iCbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b="Ym/78Ppf"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id t12-20020a170902bc4c00b001cf8be14168si4745033plz.552.2023.12.10.09.14.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 10 Dec 2023 09:14:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b="Ym/78Ppf"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=wanadoo.fr Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 288BA808EF7B; Sun, 10 Dec 2023 09:14:53 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231893AbjLJRNR (ORCPT + 99 others); Sun, 10 Dec 2023 12:13:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55608 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229503AbjLJRNQ (ORCPT ); Sun, 10 Dec 2023 12:13:16 -0500 Received: from smtp.smtpout.orange.fr (smtp-25.smtpout.orange.fr [80.12.242.25]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E1E4FC for ; Sun, 10 Dec 2023 09:13:18 -0800 (PST) Received: from pop-os.home ([92.140.202.140]) by smtp.orange.fr with ESMTPA id CNMfrZCRcvumxCNMgrCEpi; Sun, 10 Dec 2023 18:13:16 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1702228396; bh=rcjCWYjJHAMlpZ0Yk1Euqbw2V9DTH6RMOjoIxBb+Yi8=; h=From:To:Cc:Subject:Date; b=Ym/78PpfeJGeur44+gRGBXxG75EXyjCRCalSoudtmzKt2SWfHwM46nXPBjSRpL9q3 5pM+69VDDlCUVxdQouaYxN6MYzZyCBHUAGUSx9PXL6QAQnPLJFFlvao3J6fdGDL6un O19DKLiL8cMyalwsKr2A6aZjw8SX8oX2U9SD6vHlf9ptAZnQaUKaFexSyYUzmFdvy5 y4Ed0DpGtftzHZCdLea3o+hfr9FLd27GWpTpd0y/n9zF0+MF48N33+oWHfxskexQTo tD+2YIf1nccFQmhAaNdZR4+3dHQiGtj6VDM63g3oFsgBY0kaFdauq8m+yEvtsOOat1 QYjSPNk/gEMSw== X-ME-Helo: pop-os.home X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Sun, 10 Dec 2023 18:13:16 +0100 X-ME-IP: 92.140.202.140 From: Christophe JAILLET To: Vishal Verma , Dan Williams , Dave Jiang , Ira Weiny Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, Christophe JAILLET , nvdimm@lists.linux.dev Subject: [PATCH] nvdimm: Remove usage of the deprecated ida_simple_xx() API Date: Sun, 10 Dec 2023 18:13:09 +0100 Message-Id: <50719568e4108f65f3b989ba05c1563e17afba3f.1702228319.git.christophe.jaillet@wanadoo.fr> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Sun, 10 Dec 2023 09:14:53 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784915947186005915 X-GMAIL-MSGID: 1784915947186005915 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 Reviewed-by: Dave Jiang --- drivers/nvdimm/btt_devs.c | 6 +++--- drivers/nvdimm/bus.c | 4 ++-- drivers/nvdimm/dax_devs.c | 4 ++-- drivers/nvdimm/dimm_devs.c | 4 ++-- drivers/nvdimm/namespace_devs.c | 7 +++---- drivers/nvdimm/pfn_devs.c | 4 ++-- 6 files changed, 14 insertions(+), 15 deletions(-) diff --git a/drivers/nvdimm/btt_devs.c b/drivers/nvdimm/btt_devs.c index fabbb31f2c35..497fd434a6a1 100644 --- a/drivers/nvdimm/btt_devs.c +++ b/drivers/nvdimm/btt_devs.c @@ -19,7 +19,7 @@ static void nd_btt_release(struct device *dev) dev_dbg(dev, "trace\n"); nd_detach_ndns(&nd_btt->dev, &nd_btt->ndns); - ida_simple_remove(&nd_region->btt_ida, nd_btt->id); + ida_free(&nd_region->btt_ida, nd_btt->id); kfree(nd_btt->uuid); kfree(nd_btt); } @@ -191,7 +191,7 @@ static struct device *__nd_btt_create(struct nd_region *nd_region, if (!nd_btt) return NULL; - nd_btt->id = ida_simple_get(&nd_region->btt_ida, 0, 0, GFP_KERNEL); + nd_btt->id = ida_alloc(&nd_region->btt_ida, GFP_KERNEL); if (nd_btt->id < 0) goto out_nd_btt; @@ -217,7 +217,7 @@ static struct device *__nd_btt_create(struct nd_region *nd_region, return dev; out_put_id: - ida_simple_remove(&nd_region->btt_ida, nd_btt->id); + ida_free(&nd_region->btt_ida, nd_btt->id); out_nd_btt: kfree(nd_btt); diff --git a/drivers/nvdimm/bus.c b/drivers/nvdimm/bus.c index 5852fe290523..ef3d0f83318b 100644 --- a/drivers/nvdimm/bus.c +++ b/drivers/nvdimm/bus.c @@ -285,7 +285,7 @@ static void nvdimm_bus_release(struct device *dev) struct nvdimm_bus *nvdimm_bus; nvdimm_bus = container_of(dev, struct nvdimm_bus, dev); - ida_simple_remove(&nd_ida, nvdimm_bus->id); + ida_free(&nd_ida, nvdimm_bus->id); kfree(nvdimm_bus); } @@ -342,7 +342,7 @@ struct nvdimm_bus *nvdimm_bus_register(struct device *parent, INIT_LIST_HEAD(&nvdimm_bus->list); INIT_LIST_HEAD(&nvdimm_bus->mapping_list); init_waitqueue_head(&nvdimm_bus->wait); - nvdimm_bus->id = ida_simple_get(&nd_ida, 0, 0, GFP_KERNEL); + nvdimm_bus->id = ida_alloc(&nd_ida, GFP_KERNEL); if (nvdimm_bus->id < 0) { kfree(nvdimm_bus); return NULL; diff --git a/drivers/nvdimm/dax_devs.c b/drivers/nvdimm/dax_devs.c index 3bd61f245788..6b4922de3047 100644 --- a/drivers/nvdimm/dax_devs.c +++ b/drivers/nvdimm/dax_devs.c @@ -18,7 +18,7 @@ static void nd_dax_release(struct device *dev) dev_dbg(dev, "trace\n"); nd_detach_ndns(dev, &nd_pfn->ndns); - ida_simple_remove(&nd_region->dax_ida, nd_pfn->id); + ida_free(&nd_region->dax_ida, nd_pfn->id); kfree(nd_pfn->uuid); kfree(nd_dax); } @@ -55,7 +55,7 @@ static struct nd_dax *nd_dax_alloc(struct nd_region *nd_region) return NULL; nd_pfn = &nd_dax->nd_pfn; - nd_pfn->id = ida_simple_get(&nd_region->dax_ida, 0, 0, GFP_KERNEL); + nd_pfn->id = ida_alloc(&nd_region->dax_ida, GFP_KERNEL); if (nd_pfn->id < 0) { kfree(nd_dax); return NULL; diff --git a/drivers/nvdimm/dimm_devs.c b/drivers/nvdimm/dimm_devs.c index 1273873582be..3ceddae0509f 100644 --- a/drivers/nvdimm/dimm_devs.c +++ b/drivers/nvdimm/dimm_devs.c @@ -194,7 +194,7 @@ static void nvdimm_release(struct device *dev) { struct nvdimm *nvdimm = to_nvdimm(dev); - ida_simple_remove(&dimm_ida, nvdimm->id); + ida_free(&dimm_ida, nvdimm->id); kfree(nvdimm); } @@ -592,7 +592,7 @@ struct nvdimm *__nvdimm_create(struct nvdimm_bus *nvdimm_bus, if (!nvdimm) return NULL; - nvdimm->id = ida_simple_get(&dimm_ida, 0, 0, GFP_KERNEL); + nvdimm->id = ida_alloc(&dimm_ida, GFP_KERNEL); if (nvdimm->id < 0) { kfree(nvdimm); return NULL; diff --git a/drivers/nvdimm/namespace_devs.c b/drivers/nvdimm/namespace_devs.c index 07177eadc56e..fa1202e848d9 100644 --- a/drivers/nvdimm/namespace_devs.c +++ b/drivers/nvdimm/namespace_devs.c @@ -27,7 +27,7 @@ static void namespace_pmem_release(struct device *dev) struct nd_region *nd_region = to_nd_region(dev->parent); if (nspm->id >= 0) - ida_simple_remove(&nd_region->ns_ida, nspm->id); + ida_free(&nd_region->ns_ida, nspm->id); kfree(nspm->alt_name); kfree(nspm->uuid); kfree(nspm); @@ -1810,7 +1810,7 @@ static struct device *nd_namespace_pmem_create(struct nd_region *nd_region) res->name = dev_name(&nd_region->dev); res->flags = IORESOURCE_MEM; - nspm->id = ida_simple_get(&nd_region->ns_ida, 0, 0, GFP_KERNEL); + nspm->id = ida_alloc(&nd_region->ns_ida, GFP_KERNEL); if (nspm->id < 0) { kfree(nspm); return NULL; @@ -2188,8 +2188,7 @@ int nd_region_register_namespaces(struct nd_region *nd_region, int *err) struct nd_namespace_pmem *nspm; nspm = to_nd_namespace_pmem(dev); - id = ida_simple_get(&nd_region->ns_ida, 0, 0, - GFP_KERNEL); + id = ida_alloc(&nd_region->ns_ida, GFP_KERNEL); nspm->id = id; } else id = i; diff --git a/drivers/nvdimm/pfn_devs.c b/drivers/nvdimm/pfn_devs.c index 0d08e21a1cea..586348125b61 100644 --- a/drivers/nvdimm/pfn_devs.c +++ b/drivers/nvdimm/pfn_devs.c @@ -22,7 +22,7 @@ static void nd_pfn_release(struct device *dev) dev_dbg(dev, "trace\n"); nd_detach_ndns(&nd_pfn->dev, &nd_pfn->ndns); - ida_simple_remove(&nd_region->pfn_ida, nd_pfn->id); + ida_free(&nd_region->pfn_ida, nd_pfn->id); kfree(nd_pfn->uuid); kfree(nd_pfn); } @@ -326,7 +326,7 @@ static struct nd_pfn *nd_pfn_alloc(struct nd_region *nd_region) if (!nd_pfn) return NULL; - nd_pfn->id = ida_simple_get(&nd_region->pfn_ida, 0, 0, GFP_KERNEL); + nd_pfn->id = ida_alloc(&nd_region->pfn_ida, GFP_KERNEL); if (nd_pfn->id < 0) { kfree(nd_pfn); return NULL;