diff options
author | keliu <liuke94@huawei.com> | 2022-05-27 09:17:39 +0000 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2022-06-11 14:35:29 +0100 |
commit | 319dbcd84fd2676afb2bcfee575fbc1fce474ec3 (patch) | |
tree | 04be51193fd82e82636c50a53d05ed26d42838bb /drivers/iio/industrialio-core.c | |
parent | 1e800c060cf416f21ede7ca0297c1c76a86bbadc (diff) |
iio: Directly use ida_alloc()/free()
Use ida_alloc()/ida_free() instead of deprecated
ida_simple_get()/ida_simple_remove() .
Signed-off-by: keliu <liuke94@huawei.com>
Link: https://lore.kernel.org/r/20220527091739.2949426-1-liuke94@huawei.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio/industrialio-core.c')
-rw-r--r-- | drivers/iio/industrialio-core.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c index adf054c7a75e..7517deec501e 100644 --- a/drivers/iio/industrialio-core.c +++ b/drivers/iio/industrialio-core.c @@ -1631,7 +1631,7 @@ static void iio_dev_release(struct device *device) iio_device_detach_buffers(indio_dev); - ida_simple_remove(&iio_ida, iio_dev_opaque->id); + ida_free(&iio_ida, iio_dev_opaque->id); kfree(iio_dev_opaque); } @@ -1673,7 +1673,7 @@ struct iio_dev *iio_device_alloc(struct device *parent, int sizeof_priv) mutex_init(&iio_dev_opaque->info_exist_lock); INIT_LIST_HEAD(&iio_dev_opaque->channel_attr_list); - iio_dev_opaque->id = ida_simple_get(&iio_ida, 0, 0, GFP_KERNEL); + iio_dev_opaque->id = ida_alloc(&iio_ida, GFP_KERNEL); if (iio_dev_opaque->id < 0) { /* cannot use a dev_err as the name isn't available */ pr_err("failed to get device id\n"); @@ -1682,7 +1682,7 @@ struct iio_dev *iio_device_alloc(struct device *parent, int sizeof_priv) } if (dev_set_name(&indio_dev->dev, "iio:device%d", iio_dev_opaque->id)) { - ida_simple_remove(&iio_ida, iio_dev_opaque->id); + ida_free(&iio_ida, iio_dev_opaque->id); kfree(iio_dev_opaque); return NULL; } |