mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-04-30 18:10:59 -04:00
staging: fieldbus: 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(). 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 <christophe.jaillet@wanadoo.fr> Link: https://lore.kernel.org/r/d305b97b1064ba7e026232fb8c2a0783ba1b1098.1705227001.git.christophe.jaillet@wanadoo.fr Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
5500382eeb
commit
5b4ee6d1e1
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user