Skip to content

Commit deb369e

Browse files
tititiou36weiny2
authored andcommitted
nvdimm: Remove usage of the deprecated ida_simple_xx() API
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 <[email protected]> Reviewed-by: Dave Jiang <[email protected]> Link: https://lore.kernel.org/r/50719568e4108f65f3b989ba05c1563e17afba3f.1702228319.git.christophe.jaillet@wanadoo.fr Signed-off-by: Ira Weiny <[email protected]>
1 parent f7e2910 commit deb369e

File tree

6 files changed

+14
-15
lines changed

6 files changed

+14
-15
lines changed

drivers/nvdimm/btt_devs.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ static void nd_btt_release(struct device *dev)
1919

2020
dev_dbg(dev, "trace\n");
2121
nd_detach_ndns(&nd_btt->dev, &nd_btt->ndns);
22-
ida_simple_remove(&nd_region->btt_ida, nd_btt->id);
22+
ida_free(&nd_region->btt_ida, nd_btt->id);
2323
kfree(nd_btt->uuid);
2424
kfree(nd_btt);
2525
}
@@ -191,7 +191,7 @@ static struct device *__nd_btt_create(struct nd_region *nd_region,
191191
if (!nd_btt)
192192
return NULL;
193193

194-
nd_btt->id = ida_simple_get(&nd_region->btt_ida, 0, 0, GFP_KERNEL);
194+
nd_btt->id = ida_alloc(&nd_region->btt_ida, GFP_KERNEL);
195195
if (nd_btt->id < 0)
196196
goto out_nd_btt;
197197

@@ -217,7 +217,7 @@ static struct device *__nd_btt_create(struct nd_region *nd_region,
217217
return dev;
218218

219219
out_put_id:
220-
ida_simple_remove(&nd_region->btt_ida, nd_btt->id);
220+
ida_free(&nd_region->btt_ida, nd_btt->id);
221221

222222
out_nd_btt:
223223
kfree(nd_btt);

drivers/nvdimm/bus.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ static void nvdimm_bus_release(struct device *dev)
285285
struct nvdimm_bus *nvdimm_bus;
286286

287287
nvdimm_bus = container_of(dev, struct nvdimm_bus, dev);
288-
ida_simple_remove(&nd_ida, nvdimm_bus->id);
288+
ida_free(&nd_ida, nvdimm_bus->id);
289289
kfree(nvdimm_bus);
290290
}
291291

@@ -342,7 +342,7 @@ struct nvdimm_bus *nvdimm_bus_register(struct device *parent,
342342
INIT_LIST_HEAD(&nvdimm_bus->list);
343343
INIT_LIST_HEAD(&nvdimm_bus->mapping_list);
344344
init_waitqueue_head(&nvdimm_bus->wait);
345-
nvdimm_bus->id = ida_simple_get(&nd_ida, 0, 0, GFP_KERNEL);
345+
nvdimm_bus->id = ida_alloc(&nd_ida, GFP_KERNEL);
346346
if (nvdimm_bus->id < 0) {
347347
kfree(nvdimm_bus);
348348
return NULL;

drivers/nvdimm/dax_devs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ static void nd_dax_release(struct device *dev)
1818

1919
dev_dbg(dev, "trace\n");
2020
nd_detach_ndns(dev, &nd_pfn->ndns);
21-
ida_simple_remove(&nd_region->dax_ida, nd_pfn->id);
21+
ida_free(&nd_region->dax_ida, nd_pfn->id);
2222
kfree(nd_pfn->uuid);
2323
kfree(nd_dax);
2424
}
@@ -55,7 +55,7 @@ static struct nd_dax *nd_dax_alloc(struct nd_region *nd_region)
5555
return NULL;
5656

5757
nd_pfn = &nd_dax->nd_pfn;
58-
nd_pfn->id = ida_simple_get(&nd_region->dax_ida, 0, 0, GFP_KERNEL);
58+
nd_pfn->id = ida_alloc(&nd_region->dax_ida, GFP_KERNEL);
5959
if (nd_pfn->id < 0) {
6060
kfree(nd_dax);
6161
return NULL;

drivers/nvdimm/dimm_devs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ static void nvdimm_release(struct device *dev)
194194
{
195195
struct nvdimm *nvdimm = to_nvdimm(dev);
196196

197-
ida_simple_remove(&dimm_ida, nvdimm->id);
197+
ida_free(&dimm_ida, nvdimm->id);
198198
kfree(nvdimm);
199199
}
200200

@@ -592,7 +592,7 @@ struct nvdimm *__nvdimm_create(struct nvdimm_bus *nvdimm_bus,
592592
if (!nvdimm)
593593
return NULL;
594594

595-
nvdimm->id = ida_simple_get(&dimm_ida, 0, 0, GFP_KERNEL);
595+
nvdimm->id = ida_alloc(&dimm_ida, GFP_KERNEL);
596596
if (nvdimm->id < 0) {
597597
kfree(nvdimm);
598598
return NULL;

drivers/nvdimm/namespace_devs.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ static void namespace_pmem_release(struct device *dev)
2727
struct nd_region *nd_region = to_nd_region(dev->parent);
2828

2929
if (nspm->id >= 0)
30-
ida_simple_remove(&nd_region->ns_ida, nspm->id);
30+
ida_free(&nd_region->ns_ida, nspm->id);
3131
kfree(nspm->alt_name);
3232
kfree(nspm->uuid);
3333
kfree(nspm);
@@ -1810,7 +1810,7 @@ static struct device *nd_namespace_pmem_create(struct nd_region *nd_region)
18101810
res->name = dev_name(&nd_region->dev);
18111811
res->flags = IORESOURCE_MEM;
18121812

1813-
nspm->id = ida_simple_get(&nd_region->ns_ida, 0, 0, GFP_KERNEL);
1813+
nspm->id = ida_alloc(&nd_region->ns_ida, GFP_KERNEL);
18141814
if (nspm->id < 0) {
18151815
kfree(nspm);
18161816
return NULL;
@@ -2188,8 +2188,7 @@ int nd_region_register_namespaces(struct nd_region *nd_region, int *err)
21882188
struct nd_namespace_pmem *nspm;
21892189

21902190
nspm = to_nd_namespace_pmem(dev);
2191-
id = ida_simple_get(&nd_region->ns_ida, 0, 0,
2192-
GFP_KERNEL);
2191+
id = ida_alloc(&nd_region->ns_ida, GFP_KERNEL);
21932192
nspm->id = id;
21942193
} else
21952194
id = i;

drivers/nvdimm/pfn_devs.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ static void nd_pfn_release(struct device *dev)
2222

2323
dev_dbg(dev, "trace\n");
2424
nd_detach_ndns(&nd_pfn->dev, &nd_pfn->ndns);
25-
ida_simple_remove(&nd_region->pfn_ida, nd_pfn->id);
25+
ida_free(&nd_region->pfn_ida, nd_pfn->id);
2626
kfree(nd_pfn->uuid);
2727
kfree(nd_pfn);
2828
}
@@ -326,7 +326,7 @@ static struct nd_pfn *nd_pfn_alloc(struct nd_region *nd_region)
326326
if (!nd_pfn)
327327
return NULL;
328328

329-
nd_pfn->id = ida_simple_get(&nd_region->pfn_ida, 0, 0, GFP_KERNEL);
329+
nd_pfn->id = ida_alloc(&nd_region->pfn_ida, GFP_KERNEL);
330330
if (nd_pfn->id < 0) {
331331
kfree(nd_pfn);
332332
return NULL;

0 commit comments

Comments
 (0)