Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1eb51d6

Browse files
brglgregkh
authored andcommitted
nvmem: switch to simpler IDA interface
We don't need to specify any ranges when allocating IDs so we can switchto ida_alloc() and ida_free() instead of the ida_simple_ counterparts.ida_simple_get(ida, 0, 0, gfp) is equivalent toida_alloc_range(ida, 0, UINT_MAX, gfp) which is equivalent toida_alloc(ida, gfp). Note: IDR will never actually allocate an IDlarger than INT_MAX.Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>Link:https://lore.kernel.org/r/20200917134437.16637-4-srinivas.kandagatla@linaro.orgSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent28371cc commit1eb51d6

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

‎drivers/nvmem/core.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ static void nvmem_release(struct device *dev)
321321
{
322322
structnvmem_device*nvmem=to_nvmem_device(dev);
323323

324-
ida_simple_remove(&nvmem_ida,nvmem->id);
324+
ida_free(&nvmem_ida,nvmem->id);
325325
gpiod_put(nvmem->wp_gpio);
326326
kfree(nvmem);
327327
}
@@ -596,7 +596,7 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config)
596596
if (!nvmem)
597597
returnERR_PTR(-ENOMEM);
598598

599-
rval=ida_simple_get(&nvmem_ida,0,0,GFP_KERNEL);
599+
rval=ida_alloc(&nvmem_ida,GFP_KERNEL);
600600
if (rval<0) {
601601
kfree(nvmem);
602602
returnERR_PTR(rval);
@@ -608,7 +608,7 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config)
608608
nvmem->wp_gpio=gpiod_get_optional(config->dev,"wp",
609609
GPIOD_OUT_HIGH);
610610
if (IS_ERR(nvmem->wp_gpio)) {
611-
ida_simple_remove(&nvmem_ida,nvmem->id);
611+
ida_free(&nvmem_ida,nvmem->id);
612612
rval=PTR_ERR(nvmem->wp_gpio);
613613
kfree(nvmem);
614614
returnERR_PTR(rval);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp