Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp481458pxb; Wed, 20 Jan 2021 11:45:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJzQ/N8toneulQGs0aWpzXgo5T9Pc8RJbg40AEDRtVYGwnx909pRbl/wgi+vS8XMtS0VuBL4 X-Received: by 2002:a17:906:470e:: with SMTP id y14mr2922569ejq.349.1611171941386; Wed, 20 Jan 2021 11:45:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611171941; cv=none; d=google.com; s=arc-20160816; b=miUr9dcgClFO34AY2hI+mKIN1BECVzwUlolyJ5atJ0E5jfRFQf2ICFqW3TOJcWH8oP gvtz/I3df79d9bJXHzwr8sTRzJyXJoP1gsZ10qUjoOjhLKKYhe/y+txLR2Q2yyaUxYux StCRz4dmNLzUjxlLUXTYQx4arst9/XSJ9zdb79HGSs9SKnnLBHzxWQnBnuaXWZodIyKv dNvRMUCcXnd/WTAsnZXmDWRW8fXxafCipxhWxXD5IzgO1BV4Pd6czHSXWNL0IVHmP6LB Q69tIUEQbY9wuOSXfjpGsH7K7+AiOD+RLPIWMm8P1DOxxH6AICSI1NQF1HDGMDnRHDMh EIhw== 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 :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:ironport-sdr:ironport-sdr; bh=4FE2JnlEk5RpYlH5fWOCA8ZQJQnoTlYxwjSLj2wosmw=; b=Wjn5Z1QUPG6lLDUWzw6qkafxCD8c1vzmqWaQnX7dzzHtWR0JwdLH26cr6vWZcthWEi Kb2qbmsDZTe4hxmLq7fYdmEDAlhYIT7tqoM9pkQ6XmO8nsMWqk2wKD9lfB15hS/HFGnf w/8dMGMWFR+B+6bL1fHJuo3R30zxS9aF6IoMMxToxjC3jh5bUQWbYfPzpCIVyUUzbxYT +0tjJvt7oLTxC0rvASyUYC9cBH0IboYAUQ9vJgMFX7IAkvQtXxXmzu+wPz+gHl3/2IZ8 y9ToCo9lZSzEz4hftqQsZUvHjf3ejmEPkzLiyWrAIRiemKaa02vKEv+xOkNtfYVPPck4 w1dg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dk22si969222ejb.736.2021.01.20.11.45.15; Wed, 20 Jan 2021 11:45:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387459AbhATToE (ORCPT + 99 others); Wed, 20 Jan 2021 14:44:04 -0500 Received: from mga11.intel.com ([192.55.52.93]:35296 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389952AbhATTkF (ORCPT ); Wed, 20 Jan 2021 14:40:05 -0500 IronPort-SDR: Xum/0Be7tWefl70lCdIggHE2KIAwSYzYnC04O8B7hKmx7fPB/4WogH4FZnsEePaOWbCuFwL3Tz vzguElU6ZNjw== X-IronPort-AV: E=McAfee;i="6000,8403,9870"; a="175660880" X-IronPort-AV: E=Sophos;i="5.79,361,1602572400"; d="scan'208";a="175660880" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jan 2021 11:39:03 -0800 IronPort-SDR: A3tq+YfoJkcUvYVuSJGsyf0zQsyBAJ86r71bERgJ64yfMKnnvdTRgckKg/hKXntycN1Q0RFCdW xZ5pUlI4l3vQ== X-IronPort-AV: E=Sophos;i="5.79,361,1602572400"; d="scan'208";a="570375737" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.25]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Jan 2021 11:39:03 -0800 Subject: [PATCH 2/3] libnvdimm/ida: Switch to non-deprecated ida helpers From: Dan Williams To: gregkh@linuxfoundation.org Cc: Vishal Verma , Dave Jiang , Ira Weiny , logang@deltatee.com, linux-kernel@vger.kernel.org, linux-nvdimm@lists.01.org Date: Wed, 20 Jan 2021 11:39:03 -0800 Message-ID: <161117154337.2853729.4507006194649324399.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <161117153248.2853729.2452425259045172318.stgit@dwillia2-desk3.amr.corp.intel.com> References: <161117153248.2853729.2452425259045172318.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.18-3-g996c MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In preparation for a rework of character device initialization, take the opportunity to cleanup ida usage. Cc: Vishal Verma Reviewed-by: Dave Jiang Cc: Ira Weiny Signed-off-by: Dan Williams --- 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 | 14 ++++++-------- drivers/nvdimm/pfn_devs.c | 4 ++-- 6 files changed, 17 insertions(+), 19 deletions(-) diff --git a/drivers/nvdimm/btt_devs.c b/drivers/nvdimm/btt_devs.c index 05feb97e11ce..e148fd16a47e 100644 --- a/drivers/nvdimm/btt_devs.c +++ b/drivers/nvdimm/btt_devs.c @@ -20,7 +20,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); } @@ -190,7 +190,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; @@ -215,7 +215,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 2304c6183822..0258ec90dce6 100644 --- a/drivers/nvdimm/bus.c +++ b/drivers/nvdimm/bus.c @@ -296,7 +296,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); } @@ -351,7 +351,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 99965077bac4..374b195ba8d5 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 b59032e0859b..3dec809ef20a 100644 --- a/drivers/nvdimm/dimm_devs.c +++ b/drivers/nvdimm/dimm_devs.c @@ -198,7 +198,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 6da67f4d641a..c34880310c40 100644 --- a/drivers/nvdimm/namespace_devs.c +++ b/drivers/nvdimm/namespace_devs.c @@ -26,7 +26,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); @@ -38,7 +38,7 @@ static void namespace_blk_release(struct device *dev) struct nd_region *nd_region = to_nd_region(dev->parent); if (nsblk->id >= 0) - ida_simple_remove(&nd_region->ns_ida, nsblk->id); + ida_free(&nd_region->ns_ida, nsblk->id); kfree(nsblk->alt_name); kfree(nsblk->uuid); kfree(nsblk->res); @@ -2114,7 +2114,7 @@ static struct device *nd_namespace_blk_create(struct nd_region *nd_region) dev = &nsblk->common.dev; dev->type = &namespace_blk_device_type; - nsblk->id = ida_simple_get(&nd_region->ns_ida, 0, 0, GFP_KERNEL); + nsblk->id = ida_alloc(&nd_region->ns_ida, GFP_KERNEL); if (nsblk->id < 0) { kfree(nsblk); return NULL; @@ -2145,7 +2145,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; @@ -2633,15 +2633,13 @@ int nd_region_register_namespaces(struct nd_region *nd_region, int *err) struct nd_namespace_blk *nsblk; nsblk = to_nd_namespace_blk(dev); - id = ida_simple_get(&nd_region->ns_ida, 0, 0, - GFP_KERNEL); + id = ida_alloc(&nd_region->ns_ida, GFP_KERNEL); nsblk->id = id; } else if (type == ND_DEVICE_NAMESPACE_PMEM) { 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 b499df630d4d..8edfe2d2c77c 100644 --- a/drivers/nvdimm/pfn_devs.c +++ b/drivers/nvdimm/pfn_devs.c @@ -21,7 +21,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); } @@ -322,7 +322,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;