summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <koverstreet@google.com>2013-06-16 17:14:29 -0700
committerKent Overstreet <koverstreet@google.com>2013-06-17 19:36:55 -0700
commit89bb56f9859f6cf0521d2b3ecb8b5b821f4a3837 (patch)
treeae99316ea319a2608fa98ecbba87aacd92feda11
parentcbb1cb646122276c3910caf3150f80b4c3f581d0 (diff)
idr: Rename ida_simple_get() -> ida_alloc_range()
The old ida interfaces that didn't do locking have been removed, the "simple" distinction doesn't make sense anymore. Also, add an ida_alloc() wrapper that doesn't take the start and end parameters. Signed-off-by: Kent Overstreet <koverstreet@google.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Paul Mackerras <paulus@samba.org> Cc: Jens Axboe <axboe@kernel.dk> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Matthew Wilcox <willy@linux.intel.com> Cc: Joshua Morris <josh.h.morris@us.ibm.com> Cc: Philip Kelleher <pjk1939@linux.vnet.ibm.com> Cc: Rusty Russell <rusty@rustcorp.com.au> Cc: "Michael S. Tsirkin" <mst@redhat.com> Cc: David Airlie <airlied@linux.ie> Cc: Jean Delvare <khali@linux-fr.org> Cc: Guenter Roeck <linux@roeck-us.net> Cc: Jonathan Cameron <jic23@cam.ac.uk> Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com> Cc: Samuel Iglesias Gonsalvez <siglesias@igalia.com> Cc: Jens Taprogge <jens.taprogge@taprogge.org> Cc: "Michał Mirosław" <mirq-linux@rere.qmqm.pl> Cc: Richard Cochran <richardcochran@gmail.com> Cc: Ohad Ben-Cohen <ohad@wizery.com> Cc: Alessandro Zummo <a.zummo@towertech.it> Cc: Boaz Harrosh <bharrosh@panasas.com> Cc: Benny Halevy <bhalevy@tonian.com> Cc: "James E.J. Bottomley" <JBottomley@parallels.com> Cc: Mike Christie <michaelc@cs.wisc.edu> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Evgeniy Polyakov <zbr@ioremap.net> Cc: Wim Van Sebroeck <wim@iguana.be> Cc: Alexander Viro <viro@zeniv.linux.org.uk> Cc: Trond Myklebust <Trond.Myklebust@netapp.com> Cc: Tejun Heo <tj@kernel.org> Cc: Li Zefan <lizefan@huawei.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Cc: Michal Hocko <mhocko@suse.cz> Cc: Balbir Singh <bsingharora@gmail.com> Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: Marcel Holtmann <marcel@holtmann.org> Cc: Gustavo Padovan <gustavo@padovan.org> Cc: Johan Hedberg <johan.hedberg@gmail.com> Cc: "David S. Miller" <davem@davemloft.net> Cc: Lauro Ramos Venancio <lauro.venancio@openbossa.org> Cc: Aloisio Almeida Jr <aloisio.almeida@openbossa.org> Cc: Samuel Ortiz <sameo@linux.intel.com> Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com> Cc: Asai Thambi S P <asamymuthupa@micron.com> Cc: Selvan Mani <smani@micron.com> Cc: Sam Bradshaw <sbradshaw@micron.com> Cc: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com> Cc: David Howells <dhowells@redhat.com> Cc: Dave Jones <davej@redhat.com> Cc: Dave Airlie <airlied@redhat.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Joerg Roedel <joro@8bytes.org> Cc: Alex Williamson <alex.williamson@redhat.com> Cc: Varun Sethi <Varun.Sethi@freescale.com> Cc: Alexey Kardashevskiy <aik@ozlabs.ru> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Jiri Slaby <jslaby@suse.cz> Cc: Alan Cox <alan@linux.intel.com> Cc: "Eric W. Biederman" <ebiederm@xmission.com> Cc: Serge Hallyn <serge.hallyn@canonical.com> Cc: Mauro Carvalho Chehab <mchehab@redhat.com> Cc: Stephen Rothwell <sfr@canb.auug.org.au> Cc: Fengguang Wu <fengguang.wu@intel.com> Cc: Randy Dunlap <rdunlap@infradead.org>
-rw-r--r--arch/powerpc/mm/icswx_pid.c4
-rw-r--r--arch/powerpc/mm/mmu_context_hash64.c4
-rw-r--r--block/blk-core.c4
-rw-r--r--block/blk-sysfs.c2
-rw-r--r--drivers/base/platform.c6
-rw-r--r--drivers/base/soc.c6
-rw-r--r--drivers/block/mtip32xx/mtip32xx.c8
-rw-r--r--drivers/block/nvme-core.c8
-rw-r--r--drivers/block/rsxx/core.c4
-rw-r--r--drivers/block/virtio_blk.c6
-rw-r--r--drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c4
-rw-r--r--drivers/hwmon/hwmon.c6
-rw-r--r--drivers/hwmon/ibmaem.c10
-rw-r--r--drivers/iio/industrialio-core.c4
-rw-r--r--drivers/iio/industrialio-trigger.c6
-rw-r--r--drivers/input/input.c6
-rw-r--r--drivers/iommu/iommu.c6
-rw-r--r--drivers/ipack/ipack.c4
-rw-r--r--drivers/misc/cb710/core.c4
-rw-r--r--drivers/ptp/ptp_clock.c4
-rw-r--r--drivers/remoteproc/remoteproc_core.c6
-rw-r--r--drivers/rtc/class.c6
-rw-r--r--drivers/scsi/osd/osd_uld.c6
-rw-r--r--drivers/scsi/scsi_transport_iscsi.c6
-rw-r--r--drivers/scsi/sd.c6
-rw-r--r--drivers/usb/chipidea/core.c6
-rw-r--r--drivers/virtio/virtio.c4
-rw-r--r--drivers/w1/slaves/w1_ds2760.c6
-rw-r--r--drivers/w1/slaves/w1_ds2780.c6
-rw-r--r--drivers/w1/slaves/w1_ds2781.c6
-rw-r--r--drivers/watchdog/watchdog_core.c12
-rw-r--r--fs/devpts/inode.c6
-rw-r--r--fs/namespace.c8
-rw-r--r--fs/nfs/nfs4state.c10
-rw-r--r--fs/proc/generic.c4
-rw-r--r--fs/super.c4
-rw-r--r--fs/sysfs/dir.c4
-rw-r--r--include/linux/idr.h9
-rw-r--r--kernel/cgroup.c10
-rw-r--r--lib/idr.c22
-rw-r--r--mm/memcontrol.c6
-rw-r--r--net/bluetooth/hci_core.c8
-rw-r--r--net/core/net_namespace.c6
-rw-r--r--net/nfc/core.c4
44 files changed, 141 insertions, 136 deletions
diff --git a/arch/powerpc/mm/icswx_pid.c b/arch/powerpc/mm/icswx_pid.c
index 41239fb9eb9e..6f1730c54ce0 100644
--- a/arch/powerpc/mm/icswx_pid.c
+++ b/arch/powerpc/mm/icswx_pid.c
@@ -30,7 +30,7 @@ int get_cop_pid(struct mm_struct *mm)
int pid;
if (mm->context.cop_pid == COP_PID_NONE) {
- pid = ida_simple_get(&cop_ida, COP_PID_MIN,
+ pid = ida_alloc_range(&cop_ida, COP_PID_MIN,
COP_PID_MAX, GFP_KERNEL);
if (pid >= 0)
mm->context.cop_pid = pid;
@@ -51,5 +51,5 @@ int disable_cop_pid(struct mm_struct *mm)
void free_cop_pid(int free_pid)
{
- ida_simple_remove(&cop_ida, free_pid);
+ ida_remove(&cop_ida, free_pid);
}
diff --git a/arch/powerpc/mm/mmu_context_hash64.c b/arch/powerpc/mm/mmu_context_hash64.c
index 42efac1895c3..e20a37bdb27e 100644
--- a/arch/powerpc/mm/mmu_context_hash64.c
+++ b/arch/powerpc/mm/mmu_context_hash64.c
@@ -31,7 +31,7 @@ static DEFINE_IDA(mmu_context_ida);
int __init_new_context(void)
{
- return ida_simple_get(ida, 1, MAX_USER_CONTEXT, GFP_KERNEL);
+ return ida_alloc_range(ida, 1, MAX_USER_CONTEXT, GFP_KERNEL);
}
EXPORT_SYMBOL_GPL(__init_new_context);
@@ -70,7 +70,7 @@ int init_new_context(struct task_struct *tsk, struct mm_struct *mm)
void __destroy_context(int context_id)
{
- ida_simple_remove(&mmu_context_ida, context_id);
+ ida_remove(&mmu_context_ida, context_id);
}
EXPORT_SYMBOL_GPL(__destroy_context);
diff --git a/block/blk-core.c b/block/blk-core.c
index 33c33bc99ddd..5bd2e65978c0 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -595,7 +595,7 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id)
if (!q)
return NULL;
- q->id = ida_simple_get(&blk_queue_ida, 0, 0, gfp_mask);
+ q->id = ida_alloc(&blk_queue_ida, gfp_mask);
if (q->id < 0)
goto fail_q;
@@ -650,7 +650,7 @@ struct request_queue *blk_alloc_queue_node(gfp_t gfp_mask, int node_id)
return q;
fail_id:
- ida_simple_remove(&blk_queue_ida, q->id);
+ ida_remove(&blk_queue_ida, q->id);
fail_q:
kmem_cache_free(blk_requestq_cachep, q);
return NULL;
diff --git a/block/blk-sysfs.c b/block/blk-sysfs.c
index 5efc5a647183..8f6129f18c66 100644
--- a/block/blk-sysfs.c
+++ b/block/blk-sysfs.c
@@ -546,7 +546,7 @@ static void blk_release_queue(struct kobject *kobj)
bdi_destroy(&q->backing_dev_info);
- ida_simple_remove(&blk_queue_ida, q->id);
+ ida_remove(&blk_queue_ida, q->id);
call_rcu(&q->rcu_head, blk_free_queue_rcu);
}
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index 9eda84246ffd..84eecc924da0 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -302,7 +302,7 @@ int platform_device_add(struct platform_device *pdev)
* that we remember it must be freed, and we append a suffix
* to avoid namespace collision with explicit IDs.
*/
- ret = ida_simple_get(&platform_devid_ida, 0, 0, GFP_KERNEL);
+ ret = ida_alloc(&platform_devid_ida, GFP_KERNEL);
if (ret < 0)
goto err_out;
pdev->id = ret;
@@ -341,7 +341,7 @@ int platform_device_add(struct platform_device *pdev)
failed:
if (pdev->id_auto) {
- ida_simple_remove(&platform_devid_ida, pdev->id);
+ ida_remove(&platform_devid_ida, pdev->id);
pdev->id = PLATFORM_DEVID_AUTO;
}
@@ -374,7 +374,7 @@ void platform_device_del(struct platform_device *pdev)
device_del(&pdev->dev);
if (pdev->id_auto) {
- ida_simple_remove(&platform_devid_ida, pdev->id);
+ ida_remove(&platform_devid_ida, pdev->id);
pdev->id = PLATFORM_DEVID_AUTO;
}
diff --git a/drivers/base/soc.c b/drivers/base/soc.c
index 72b9dc281e57..7826e6953385 100644
--- a/drivers/base/soc.c
+++ b/drivers/base/soc.c
@@ -120,7 +120,7 @@ struct soc_device *soc_device_register(struct soc_device_attribute *soc_dev_attr
goto out1;
}
- ret = ida_simple_get(&soc_ida, 0, 0, GFP_KERNEL);
+ ret = ida_alloc(&soc_ida, GFP_KERNEL);
if (ret < 0)
goto out2;
@@ -139,7 +139,7 @@ struct soc_device *soc_device_register(struct soc_device_attribute *soc_dev_attr
return soc_dev;
out3:
- ida_simple_remove(&soc_ida, soc_dev->soc_dev_num);
+ ida_remove(&soc_ida, soc_dev->soc_dev_num);
out2:
kfree(soc_dev);
out1:
@@ -149,7 +149,7 @@ out1:
/* Ensure soc_dev->attr is freed prior to calling soc_device_unregister. */
void soc_device_unregister(struct soc_device *soc_dev)
{
- ida_simple_remove(&soc_ida, soc_dev->soc_dev_num);
+ ida_remove(&soc_ida, soc_dev->soc_dev_num);
device_unregister(&soc_dev->dev);
}
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index c0b43909cd58..83c7db837046 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -3980,7 +3980,7 @@ static int mtip_block_initialize(struct driver_data *dd)
goto alloc_disk_error;
}
- rv = ida_simple_get(&rssd_index_ida, 0, 0, GFP_KERNEL);
+ rv = ida_alloc(&rssd_index_ida, GFP_KERNEL);
if (rv < 0)
goto ida_alloc_error;
@@ -4102,7 +4102,7 @@ read_capacity_error:
block_queue_alloc_init_error:
disk_index_error:
- ida_simple_remove(&rssd_index_ida, index);
+ ida_remove(&rssd_index_ida, index);
ida_alloc_error:
put_disk(dd->disk);
@@ -4155,7 +4155,7 @@ static int mtip_block_remove(struct driver_data *dd)
put_disk(dd->disk);
}
- ida_simple_remove(&rssd_index_ida, dd->index);
+ ida_remove(&rssd_index_ida, dd->index);
blk_cleanup_queue(dd->queue);
dd->disk = NULL;
@@ -4195,7 +4195,7 @@ static int mtip_block_shutdown(struct driver_data *dd)
dd->queue = NULL;
}
- ida_simple_remove(&rssd_index_ida, dd->index);
+ ida_remove(&rssd_index_ida, dd->index);
mtip_hw_shutdown(dd);
return 0;
diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c
index d882b91c1fdf..3667abb0e688 100644
--- a/drivers/block/nvme-core.c
+++ b/drivers/block/nvme-core.c
@@ -1519,12 +1519,12 @@ static DEFINE_IDA(nvme_index_ida);
static int nvme_get_ns_idx(void)
{
- return ida_simple_get(&nvme_index_ida, 0, 0, GFP_KERNEL);
+ return ida_alloc(&nvme_index_ida, GFP_KERNEL);
}
static void nvme_put_ns_idx(int index)
{
- ida_simple_remove(&nvme_index_ida, index);
+ ida_remove(&nvme_index_ida, index);
}
static void nvme_config_discard(struct nvme_ns *ns)
@@ -1808,7 +1808,7 @@ static int nvme_set_instance(struct nvme_dev *dev)
{
int instance;
- instance = ida_simple_get(&nvme_index_ida, 0, 0, GFP_KERNEL);
+ instance = ida_alloc(&nvme_index_ida, GFP_KERNEL);
if (instance < 0)
return -ENODEV;
@@ -1818,7 +1818,7 @@ static int nvme_set_instance(struct nvme_dev *dev)
static void nvme_release_instance(struct nvme_dev *dev)
{
- ida_simple_remove(&nvme_instance_ida, dev->instance);
+ ida_remove(&nvme_instance_ida, dev->instance);
}
static void nvme_free_dev(struct kref *kref)
diff --git a/drivers/block/rsxx/core.c b/drivers/block/rsxx/core.c
index 5487be017896..6d91f691a467 100644
--- a/drivers/block/rsxx/core.c
+++ b/drivers/block/rsxx/core.c
@@ -537,7 +537,7 @@ static int rsxx_pci_probe(struct pci_dev *dev,
card->dev = dev;
pci_set_drvdata(dev, card);
- st = ida_simple_get(&rsxx_disk_ida, 0, 0, GFP_KERNEL);
+ st = ida_alloc(&rsxx_disk_ida, GFP_KERNEL);
if (st < 0)
goto failed_ida_alloc;
@@ -696,7 +696,7 @@ failed_request_regions:
failed_dma_mask:
pci_disable_device(dev);
failed_enable:
- ida_simple_remove(&rsxx_disk_ida, card->disk_id);
+ ida_remove(&rsxx_disk_ida, card->disk_id);
failed_ida_alloc:
kfree(card);
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c
index 64723953e1c9..89b36a2660f9 100644
--- a/drivers/block/virtio_blk.c
+++ b/drivers/block/virtio_blk.c
@@ -692,7 +692,7 @@ static int virtblk_probe(struct virtio_device *vdev)
u16 min_io_size;
u8 physical_block_exp, alignment_offset;
- err = ida_simple_get(&vd_index_ida, 0, minor_to_index(1 << MINORBITS),
+ err = ida_alloc_range(&vd_index_ida, 0, minor_to_index(1 << MINORBITS),
GFP_KERNEL);
if (err < 0)
goto out;
@@ -864,7 +864,7 @@ out_free_vq:
out_free_vblk:
kfree(vblk);
out_free_index:
- ida_simple_remove(&vd_index_ida, index);
+ ida_remove(&vd_index_ida, index);
out:
return err;
}
@@ -896,7 +896,7 @@ static void virtblk_remove(struct virtio_device *vdev)
/* Only free device id if we don't have any users */
if (refc == 1)
- ida_simple_remove(&vd_index_ida, index);
+ ida_remove(&vd_index_ida, index);
}
#ifdef CONFIG_PM
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c b/drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c
index a74341752d5b..78156331adba 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_gmrid_manager.c
@@ -64,7 +64,7 @@ static int vmw_gmrid_man_get_node(struct ttm_mem_type_manager *man,
}
spin_unlock(&gman->lock);
- ret = ida_simple_get(&gman->gmr_ida, 0, gman->max_gmr_ids, GFP_KERNEL);
+ ret = ida_alloc_range(&gman->gmr_ida, 0, gman->max_gmr_ids, GFP_KERNEL);
spin_lock(&gman->lock);
if (ret < 0)
@@ -91,7 +91,7 @@ static void vmw_gmrid_man_put_node(struct ttm_mem_type_manager *man,
if (mem->mm_node) {
spin_lock(&gman->lock);
- ida_simple_remove(&gman->gmr_ida, mem->start);
+ ida_remove(&gman->gmr_ida, mem->start);
gman->used_gmr_pages -= mem->num_pages;
spin_unlock(&gman->lock);
mem->mm_node = NULL;
diff --git a/drivers/hwmon/hwmon.c b/drivers/hwmon/hwmon.c
index 646314f7c839..93f40ca5226d 100644
--- a/drivers/hwmon/hwmon.c
+++ b/drivers/hwmon/hwmon.c
@@ -43,7 +43,7 @@ struct device *hwmon_device_register(struct device *dev)
struct device *hwdev;
int id;
- id = ida_simple_get(&hwmon_ida, 0, 0, GFP_KERNEL);
+ id = ida_alloc(&hwmon_ida, GFP_KERNEL);
if (id < 0)
return ERR_PTR(id);
@@ -51,7 +51,7 @@ struct device *hwmon_device_register(struct device *dev)
HWMON_ID_FORMAT, id);
if (IS_ERR(hwdev))
- ida_simple_remove(&hwmon_ida, id);
+ ida_remove(&hwmon_ida, id);
return hwdev;
}
@@ -68,7 +68,7 @@ void hwmon_device_unregister(struct device *dev)
if (likely(sscanf(dev_name(dev), HWMON_ID_FORMAT, &id) == 1)) {
device_unregister(dev);
- ida_simple_remove(&hwmon_ida, id);
+ ida_remove(&hwmon_ida, id);
} else
dev_dbg(dev->parent,
"hwmon_device_unregister() failed: bad class ID!\n");
diff --git a/drivers/hwmon/ibmaem.c b/drivers/hwmon/ibmaem.c
index 1429f6e177f4..03085c43466d 100644
--- a/drivers/hwmon/ibmaem.c
+++ b/drivers/hwmon/ibmaem.c
@@ -495,7 +495,7 @@ static void aem_delete(struct aem_data *data)
ipmi_destroy_user(data->ipmi.user);
platform_set_drvdata(data->pdev, NULL);
platform_device_unregister(data->pdev);
- ida_simple_remove(&aem_ida, data->id);
+ ida_remove(&aem_ida, data->id);
kfree(data);
}
@@ -552,7 +552,7 @@ static int aem_init_aem1_inst(struct aem_ipmi_data *probe, u8 module_handle)
data->power_period[i] = AEM_DEFAULT_POWER_INTERVAL;
/* Create sub-device for this fw instance */
- data->id = ida_simple_get(&aem_ida, 0, 0, GFP_KERNEL);
+ data->id = ida_alloc(&aem_ida, GFP_KERNEL);
if (data->id < 0)
goto id_err;
@@ -613,7 +613,7 @@ ipmi_err:
platform_set_drvdata(data->pdev, NULL);
platform_device_unregister(data->pdev);
dev_err:
- ida_simple_remove(&aem_ida, data->id);
+ ida_remove(&aem_ida, data->id);
id_err:
kfree(data);
@@ -692,7 +692,7 @@ static int aem_init_aem2_inst(struct aem_ipmi_data *probe,
data->power_period[i] = AEM_DEFAULT_POWER_INTERVAL;
/* Create sub-device for this fw instance */
- data->id = ida_simple_get(&aem_ida, 0, 0, GFP_KERNEL);
+ data->id = ida_alloc(&aem_ida, GFP_KERNEL);
if (data->id < 0)
goto id_err;
@@ -753,7 +753,7 @@ ipmi_err:
platform_set_drvdata(data->pdev, NULL);
platform_device_unregister(data->pdev);
dev_err:
- ida_simple_remove(&aem_ida, data->id);
+ ida_remove(&aem_ida, data->id);
id_err:
kfree(data);
diff --git a/drivers/iio/industrialio-core.c b/drivers/iio/industrialio-core.c
index e145931ef1b8..033bd188e367 100644
--- a/drivers/iio/industrialio-core.c
+++ b/drivers/iio/industrialio-core.c
@@ -856,7 +856,7 @@ static void iio_dev_release(struct device *device)
iio_device_unregister_sysfs(indio_dev);
iio_device_unregister_debugfs(indio_dev);
- ida_simple_remove(&iio_ida, indio_dev->id);
+ ida_remove(&iio_ida, indio_dev->id);
kfree(indio_dev);
}
@@ -890,7 +890,7 @@ struct iio_dev *iio_device_alloc(int sizeof_priv)
mutex_init(&dev->info_exist_lock);
INIT_LIST_HEAD(&dev->channel_attr_list);
- dev->id = ida_simple_get(&iio_ida, 0, 0, GFP_KERNEL);
+ dev->id = ida_alloc(&iio_ida, GFP_KERNEL);
if (dev->id < 0) {
/* cannot use a dev_err as the name isn't available */
printk(KERN_ERR "Failed to get id\n");
diff --git a/drivers/iio/industrialio-trigger.c b/drivers/iio/industrialio-trigger.c
index 4d6c7d84e155..f12b146e132a 100644
--- a/drivers/iio/industrialio-trigger.c
+++ b/drivers/iio/industrialio-trigger.c
@@ -69,7 +69,7 @@ int iio_trigger_register(struct iio_trigger *trig_info)
{
int ret;
- trig_info->id = ida_simple_get(&iio_trigger_ida, 0, 0, GFP_KERNEL);
+ trig_info->id = ida_alloc(&iio_trigger_ida, GFP_KERNEL);
if (trig_info->id < 0) {
ret = trig_info->id;
goto error_ret;
@@ -90,7 +90,7 @@ int iio_trigger_register(struct iio_trigger *trig_info)
return 0;
error_unregister_id:
- ida_simple_remove(&iio_trigger_ida, trig_info->id);
+ ida_remove(&iio_trigger_ida, trig_info->id);
error_ret:
return ret;
}
@@ -102,7 +102,7 @@ void iio_trigger_unregister(struct iio_trigger *trig_info)
list_del(&trig_info->list);
mutex_unlock(&iio_trigger_list_lock);
- ida_simple_remove(&iio_trigger_ida, trig_info->id);
+ ida_remove(&iio_trigger_ida, trig_info->id);
/* Possible issue in here */
device_unregister(&trig_info->dev);
}
diff --git a/drivers/input/input.c b/drivers/input/input.c
index c04469928925..d42ea508f619 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -2329,7 +2329,7 @@ int input_get_new_minor(int legacy_base, unsigned int legacy_num,
* locking is needed here.
*/
if (legacy_base >= 0) {
- int minor = ida_simple_get(&input_ida,
+ int minor = ida_alloc_range(&input_ida,
legacy_base,
legacy_base + legacy_num,
GFP_KERNEL);
@@ -2337,7 +2337,7 @@ int input_get_new_minor(int legacy_base, unsigned int legacy_num,
return minor;
}
- return ida_simple_get(&input_ida,
+ return ida_alloc_range(&input_ida,
INPUT_FIRST_DYNAMIC_DEV, INPUT_MAX_CHAR_DEVICES,
GFP_KERNEL);
}
@@ -2352,7 +2352,7 @@ EXPORT_SYMBOL(input_get_new_minor);
*/
void input_free_minor(unsigned int minor)
{
- ida_simple_remove(&input_ida, minor);
+ ida_remove(&input_ida, minor);
}
EXPORT_SYMBOL(input_free_minor);
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index d12ca9b0412b..2e74a0949c93 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -123,7 +123,7 @@ static void iommu_group_release(struct kobject *kobj)
if (group->iommu_data_release)
group->iommu_data_release(group->iommu_data);
- ida_simple_remove(&iommu_group_ida, group->id);
+ ida_remove(&iommu_group_ida, group->id);
kfree(group->name);
kfree(group);
@@ -160,7 +160,7 @@ struct iommu_group *iommu_group_alloc(void)
INIT_LIST_HEAD(&group->devices);
BLOCKING_INIT_NOTIFIER_HEAD(&group->notifier);
- ret = ida_simple_get(&iommu_group_ida, 0, 0, GFP_KERNEL);
+ ret = ida_alloc(&iommu_group_ida, GFP_KERNEL);
if (ret < 0) {
kfree(group);
return ERR_PTR(-ENOMEM);
@@ -171,7 +171,7 @@ struct iommu_group *iommu_group_alloc(void)
ret = kobject_init_and_add(&group->kobj, &iommu_group_ktype,
NULL, "%d", group->id);
if (ret) {
- ida_simple_remove(&iommu_group_ida, group->id);
+ ida_remove(&iommu_group_ida, group->id);
kfree(group);
return ERR_PTR(ret);
}
diff --git a/drivers/ipack/ipack.c b/drivers/ipack/ipack.c
index 6e066c53acce..f8a6df200968 100644
--- a/drivers/ipack/ipack.c
+++ b/drivers/ipack/ipack.c
@@ -207,7 +207,7 @@ struct ipack_bus_device *ipack_bus_register(struct device *parent, int slots,
if (!bus)
return NULL;
- bus_nr = ida_simple_get(&ipack_ida, 0, 0, GFP_KERNEL);
+ bus_nr = ida_alloc(&ipack_ida, GFP_KERNEL);
if (bus_nr < 0) {
kfree(bus);
return NULL;
@@ -236,7 +236,7 @@ int ipack_bus_unregister(struct ipack_bus_device *bus)
{
bus_for_each_dev(&ipack_bus_type, NULL, bus,
ipack_unregister_bus_member);
- ida_simple_remove(&ipack_ida, bus->bus_nr);
+ ida_remove(&ipack_ida, bus->bus_nr);
kfree(bus);
return 0;
}
diff --git a/drivers/misc/cb710/core.c b/drivers/misc/cb710/core.c
index f664afa201e7..f287f505e89b 100644
--- a/drivers/misc/cb710/core.c
+++ b/drivers/misc/cb710/core.c
@@ -254,7 +254,7 @@ static int cb710_probe(struct pci_dev *pdev,
if (err)
return err;
- err = ida_simple_get(&cb710_ida, 0, 0, GFP_KERNEL);
+ err = ida_alloc(&cb710_ida, GFP_KERNEL);
if (err < 0)
return err;
@@ -308,7 +308,7 @@ static void cb710_remove_one(struct pci_dev *pdev)
BUG_ON(atomic_read(&chip->slot_refs_count) != 0);
#endif
- ida_simple_remove(&cb710_ida, chip->platform_id);
+ ida_remove(&cb710_ida, chip->platform_id);
}
static const struct pci_device_id cb710_pci_tbl[] = {
diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c
index 4a8c388364ca..6ae25ecd2047 100644
--- a/drivers/ptp/ptp_clock.c
+++ b/drivers/ptp/ptp_clock.c
@@ -169,7 +169,7 @@ static void delete_ptp_clock(struct posix_clock *pc)
struct ptp_clock *ptp = container_of(pc, struct ptp_clock, clock);
mutex_destroy(&ptp->tsevq_mux);
- ida_simple_remove(&ptp_clocks_map, ptp->index);
+ ida_remove(&ptp_clocks_map, ptp->index);
kfree(ptp);
}
@@ -190,7 +190,7 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
if (ptp == NULL)
goto no_memory;
- index = ida_simple_get(&ptp_clocks_map, 0, MINORMASK + 1, GFP_KERNEL);
+ index = ida_alloc_range(&ptp_clocks_map, 0, MINORMASK + 1, GFP_KERNEL);
if (index < 0) {
err = index;
goto no_slot;
diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c
index 022dc635d01e..1e2009e49957 100644
--- a/drivers/remoteproc/remoteproc_core.c
+++ b/drivers/remoteproc/remoteproc_core.c
@@ -1223,7 +1223,7 @@ static void rproc_type_release(struct device *dev)
idr_destroy(&rproc->notifyids);
if (rproc->index >= 0)
- ida_simple_remove(&rproc_dev_index, rproc->index);
+ ida_remove(&rproc_dev_index, rproc->index);
kfree(rproc);
}
@@ -1301,9 +1301,9 @@ struct rproc *rproc_alloc(struct device *dev, const char *name,
rproc->dev.type = &rproc_type;
/* Assign a unique device index and name */
- rproc->index = ida_simple_get(&rproc_dev_index, 0, 0, GFP_KERNEL);
+ rproc->index = ida_alloc(&rproc_dev_index, GFP_KERNEL);
if (rproc->index < 0) {
- dev_err(dev, "ida_simple_get failed: %d\n", rproc->index);
+ dev_err(dev, "ida_alloc failed: %d\n", rproc->index);
put_device(&rproc->dev);
return NULL;
}
diff --git a/drivers/rtc/class.c b/drivers/rtc/class.c
index 66385402d20e..4dffd787dd7c 100644
--- a/drivers/rtc/class.c
+++ b/drivers/rtc/class.c
@@ -29,7 +29,7 @@ struct class *rtc_class;
static void rtc_device_release(struct device *dev)
{
struct rtc_device *rtc = to_rtc_device(dev);
- ida_simple_remove(&rtc_ida, rtc->id);
+ ida_remove(&rtc_ida, rtc->id);
kfree(rtc);
}
@@ -158,7 +158,7 @@ struct rtc_device *rtc_device_register(const char *name, struct device *dev,
struct rtc_wkalrm alrm;
int id, err;
- id = ida_simple_get(&rtc_ida, 0, 0, GFP_KERNEL);
+ id = ida_alloc(&rtc_ida, GFP_KERNEL);
if (id < 0) {
err = id;
goto exit;
@@ -226,7 +226,7 @@ exit_kfree:
kfree(rtc);
exit_ida:
- ida_simple_remove(&rtc_ida, id);
+ ida_remove(&rtc_ida, id);
exit:
dev_err(dev, "rtc core: unable to register %s, err = %d\n",
diff --git a/drivers/scsi/osd/osd_uld.c b/drivers/scsi/osd/osd_uld.c
index 970031e57d1e..4720a8db65ca 100644
--- a/drivers/scsi/osd/osd_uld.c
+++ b/drivers/scsi/osd/osd_uld.c
@@ -407,7 +407,7 @@ static void __remove(struct device *dev)
if (oud->disk)
put_disk(oud->disk);
- ida_simple_remove(&osd_minor_ida, oud->minor);
+ ida_remove(&osd_minor_ida, oud->minor);
kfree(oud);
}
@@ -423,7 +423,7 @@ static int osd_probe(struct device *dev)
if (scsi_device->type != TYPE_OSD)
return -ENODEV;
- minor = ida_simple_get(&osd_minor_ida, 0, 0, GFP_KERNEL);
+ minor = ida_alloc(&osd_minor_ida, GFP_KERNEL);
if (minor < 0)
return -ENODEV;
@@ -508,7 +508,7 @@ err_free_osd:
dev_set_drvdata(dev, NULL);
kfree(oud);
err_retract_minor:
- ida_simple_remove(&osd_minor_ida, minor);
+ ida_remove(&osd_minor_ida, minor);
return error;
}
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index 133926b1bb78..94c85745d963 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -1686,7 +1686,7 @@ static void __iscsi_unbind_session(struct work_struct *work)
mutex_unlock(&ihost->mutex);
if (session->ida_used)
- ida_simple_remove(&iscsi_sess_ida, target_id);
+ ida_remove(&iscsi_sess_ida, target_id);
scsi_remove_target(&session->dev);
iscsi_session_event(session, ISCSI_KEVENT_UNBIND_SESSION);
@@ -1741,7 +1741,7 @@ int iscsi_add_session(struct iscsi_cls_session *session, unsigned int target_id)
session->sid = atomic_add_return(1, &iscsi_session_nr);
if (target_id == ISCSI_MAX_TARGET) {
- id = ida_simple_get(&iscsi_sess_ida, 0, 0, GFP_KERNEL);
+ id = ida_alloc(&iscsi_sess_ida, GFP_KERNEL);
if (id < 0) {
iscsi_cls_session_printk(KERN_ERR, session,
@@ -1772,7 +1772,7 @@ int iscsi_add_session(struct iscsi_cls_session *session, unsigned int target_id)
release_ida:
if (session->ida_used)
- ida_simple_remove(&iscsi_sess_ida, session->target_id);
+ ida_remove(&iscsi_sess_ida, session->target_id);
return err;
}
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index ae29efea4e09..81bcd0905868 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -2892,7 +2892,7 @@ static int sd_probe(struct device *dev)
if (!gd)
goto out_free;
- index = ida_simple_get(&sd_index_ida, 0, 0, GFP_KERNEL);
+ index = ida_alloc(&sd_index_ida, GFP_KERNEL);
if (index < 0) {
error = index;
goto out_put;
@@ -2936,7 +2936,7 @@ static int sd_probe(struct device *dev)
return 0;
out_free_index:
- ida_simple_remove(&sd_index_ida, index);
+ ida_remove(&sd_index_ida, index);
out_put:
put_disk(gd);
out_free:
@@ -2992,7 +2992,7 @@ static void scsi_disk_release(struct device *dev)
struct scsi_disk *sdkp = to_scsi_disk(dev);
struct gendisk *disk = sdkp->disk;
- ida_simple_remove(&sd_index_ida, sdkp->index);
+ ida_remove(&sd_index_ida, sdkp->index);
disk->private_data = NULL;
put_disk(disk);
diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c
index 49b098bedf9b..ff126968ac9f 100644
--- a/drivers/usb/chipidea/core.c
+++ b/drivers/usb/chipidea/core.c
@@ -311,7 +311,7 @@ struct platform_device *ci13xxx_add_device(struct device *dev,
struct platform_device *pdev;
int id, ret;
- id = ida_simple_get(&ci_ida, 0, 0, GFP_KERNEL);
+ id = ida_alloc(&ci_ida, GFP_KERNEL);
if (id < 0)
return ERR_PTR(id);
@@ -343,7 +343,7 @@ struct platform_device *ci13xxx_add_device(struct device *dev,
err:
platform_device_put(pdev);
put_id:
- ida_simple_remove(&ci_ida, id);
+ ida_remove(&ci_ida, id);
return ERR_PTR(ret);
}
EXPORT_SYMBOL_GPL(ci13xxx_add_device);
@@ -352,7 +352,7 @@ void ci13xxx_remove_device(struct platform_device *pdev)
{
int id = pdev->id;
platform_device_unregister(pdev);
- ida_simple_remove(&ci_ida, id);
+ ida_remove(&ci_ida, id);
}
EXPORT_SYMBOL_GPL(ci13xxx_remove_device);
diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c
index ee59b74768d9..17ca52883c99 100644
--- a/drivers/virtio/virtio.c
+++ b/drivers/virtio/virtio.c
@@ -193,7 +193,7 @@ int register_virtio_device(struct virtio_device *dev)
dev->dev.bus = &virtio_bus;
/* Assign a unique device index and hence name. */
- err = ida_simple_get(&virtio_index_ida, 0, 0, GFP_KERNEL);
+ err = ida_alloc(&virtio_index_ida, GFP_KERNEL);
if (err < 0)
goto out;
@@ -224,7 +224,7 @@ void unregister_virtio_device(struct virtio_device *dev)
int index = dev->index; /* save for after device release */
device_unregister(&dev->dev);
- ida_simple_remove(&virtio_index_ida, index);
+ ida_remove(&virtio_index_ida, index);
}
EXPORT_SYMBOL_GPL(unregister_virtio_device);
diff --git a/drivers/w1/slaves/w1_ds2760.c b/drivers/w1/slaves/w1_ds2760.c
index e86a69dc411e..6e47ec016b30 100644
--- a/drivers/w1/slaves/w1_ds2760.c
+++ b/drivers/w1/slaves/w1_ds2760.c
@@ -122,7 +122,7 @@ static int w1_ds2760_add_slave(struct w1_slave *sl)
int id;
struct platform_device *pdev;
- id = ida_simple_get(&bat_ida, 0, 0, GFP_KERNEL);
+ id = ida_alloc(&bat_ida, GFP_KERNEL);
if (id < 0) {
ret = id;
goto noid;
@@ -152,7 +152,7 @@ bin_attr_failed:
pdev_add_failed:
platform_device_put(pdev);
pdev_alloc_failed:
- ida_simple_remove(&bat_ida, id);
+ ida_remove(&bat_ida, id);
noid:
success:
return ret;
@@ -164,7 +164,7 @@ static void w1_ds2760_remove_slave(struct w1_slave *sl)
int id = pdev->id;
platform_device_unregister(pdev);
- ida_simple_remove(&bat_ida, id);
+ ida_remove(&bat_ida, id);
sysfs_remove_bin_file(&sl->dev.kobj, &w1_ds2760_bin_attr);
}
diff --git a/drivers/w1/slaves/w1_ds2780.c b/drivers/w1/slaves/w1_ds2780.c
index 98ed9c49cf50..39dea6b389c9 100644
--- a/drivers/w1/slaves/w1_ds2780.c
+++ b/drivers/w1/slaves/w1_ds2780.c
@@ -115,7 +115,7 @@ static int w1_ds2780_add_slave(struct w1_slave *sl)
int id;
struct platform_device *pdev;
- id = ida_simple_get(&bat_ida, 0, 0, GFP_KERNEL);
+ id = ida_alloc(&bat_ida, GFP_KERNEL);
if (id < 0) {
ret = id;
goto noid;
@@ -145,7 +145,7 @@ bin_attr_failed:
pdev_add_failed:
platform_device_put(pdev);
pdev_alloc_failed:
- ida_simple_remove(&bat_ida, id);
+ ida_remove(&bat_ida, id);
noid:
return ret;
}
@@ -156,7 +156,7 @@ static void w1_ds2780_remove_slave(struct w1_slave *sl)
int id = pdev->id;
platform_device_unregister(pdev);
- ida_simple_remove(&bat_ida, id);
+ ida_remove(&bat_ida, id);
sysfs_remove_bin_file(&sl->dev.kobj, &w1_ds2780_bin_attr);
}
diff --git a/drivers/w1/slaves/w1_ds2781.c b/drivers/w1/slaves/w1_ds2781.c
index 5140d7be67ab..75c07af9123d 100644
--- a/drivers/w1/slaves/w1_ds2781.c
+++ b/drivers/w1/slaves/w1_ds2781.c
@@ -113,7 +113,7 @@ static int w1_ds2781_add_slave(struct w1_slave *sl)
int id;
struct platform_device *pdev;
- id = ida_simple_get(&bat_ida, 0, 0, GFP_KERNEL);
+ id = ida_alloc(&bat_ida, GFP_KERNEL);
if (id < 0) {
ret = id;
goto noid;
@@ -143,7 +143,7 @@ bin_attr_failed:
pdev_add_failed:
platform_device_put(pdev);
pdev_alloc_failed:
- ida_simple_remove(&bat_ida, id);
+ ida_remove(&bat_ida, id);
noid:
return ret;
}
@@ -154,7 +154,7 @@ static void w1_ds2781_remove_slave(struct w1_slave *sl)
int id = pdev->id;
platform_device_unregister(pdev);
- ida_simple_remove(&bat_ida, id);
+ ida_remove(&bat_ida, id);
sysfs_remove_bin_file(&sl->dev.kobj, &w1_ds2781_bin_attr);
}
diff --git a/drivers/watchdog/watchdog_core.c b/drivers/watchdog/watchdog_core.c
index 05d18b4c661b..cbfb367c7622 100644
--- a/drivers/watchdog/watchdog_core.c
+++ b/drivers/watchdog/watchdog_core.c
@@ -128,26 +128,26 @@ int watchdog_register_device(struct watchdog_device *wdd)
*/
mutex_init(&wdd->lock);
- id = ida_simple_get(&watchdog_ida, 0, MAX_DOGS, GFP_KERNEL);
+ id = ida_alloc_range(&watchdog_ida, 0, MAX_DOGS, GFP_KERNEL);
if (id < 0)
return id;
wdd->id = id;
ret = watchdog_dev_register(wdd);
if (ret) {
- ida_simple_remove(&watchdog_ida, id);
+ ida_remove(&watchdog_ida, id);
if (!(id == 0 && ret == -EBUSY))
return ret;
/* Retry in case a legacy watchdog module exists */
- id = ida_simple_get(&watchdog_ida, 1, MAX_DOGS, GFP_KERNEL);
+ id = ida_alloc_range(&watchdog_ida, 1, MAX_DOGS, GFP_KERNEL);
if (id < 0)
return id;
wdd->id = id;
ret = watchdog_dev_register(wdd);
if (ret) {
- ida_simple_remove(&watchdog_ida, id);
+ ida_remove(&watchdog_ida, id);
return ret;
}
}
@@ -157,7 +157,7 @@ int watchdog_register_device(struct watchdog_device *wdd)
NULL, "watchdog%d", wdd->id);
if (IS_ERR(wdd->dev)) {
watchdog_dev_unregister(wdd);
- ida_simple_remove(&watchdog_ida, id);
+ ida_remove(&watchdog_ida, id);
ret = PTR_ERR(wdd->dev);
return ret;
}
@@ -186,7 +186,7 @@ void watchdog_unregister_device(struct watchdog_device *wdd)
if (ret)
pr_err("error unregistering /dev/watchdog (err=%d)\n", ret);
device_destroy(watchdog_class, devno);
- ida_simple_remove(&watchdog_ida, wdd->id);
+ ida_remove(&watchdog_ida, wdd->id);
wdd->dev = NULL;
}
EXPORT_SYMBOL_GPL(watchdog_unregister_device);
diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c
index d77702a8e887..9e83570551aa 100644
--- a/fs/devpts/inode.c
+++ b/fs/devpts/inode.c
@@ -522,7 +522,7 @@ int devpts_new_index(struct inode *ptmx_inode)
struct pts_fs_info *fsi = DEVPTS_SB(sb);
int index;
- index = ida_simple_get(&fsi->allocated_ptys, 0,
+ index = ida_alloc_range(&fsi->allocated_ptys, 0,
fsi->mount_opts.max, GFP_KERNEL);
if (index < 0)
return index;
@@ -531,7 +531,7 @@ int devpts_new_index(struct inode *ptmx_inode)
if (pty_count >= pty_limit -
(fsi->mount_opts.newinstance ? pty_reserve : 0)) {
mutex_unlock(&allocated_ptys_lock);
- ida_simple_remove(&fsi->allocated_ptys, index);
+ ida_remove(&fsi->allocated_ptys, index);
return -ENOSPC;
}
@@ -545,7 +545,7 @@ void devpts_kill_index(struct inode *ptmx_inode, int idx)
struct super_block *sb = pts_sb_from_inode(ptmx_inode);
struct pts_fs_info *fsi = DEVPTS_SB(sb);
- ida_simple_remove(&fsi->allocated_ptys, idx);
+ ida_remove(&fsi->allocated_ptys, idx);
mutex_lock(&allocated_ptys_lock);
pty_count--;
mutex_unlock(&allocated_ptys_lock);
diff --git a/fs/namespace.c b/fs/namespace.c
index 1cf0df48e9ba..3fdad2341f8b 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -68,7 +68,7 @@ static inline unsigned long hash(struct vfsmount *mnt, struct dentry *dentry)
*/
static int mnt_alloc_id(struct mount *mnt)
{
- int res = ida_simple_get(&mnt_id_ida, 0, 0, GFP_KERNEL);
+ int res = ida_alloc(&mnt_id_ida, GFP_KERNEL);
if (res < 0)
return res;
@@ -78,7 +78,7 @@ static int mnt_alloc_id(struct mount *mnt)
static void mnt_free_id(struct mount *mnt)
{
- ida_simple_remove(&mnt_id_ida, mnt->mnt_id);
+ ida_remove(&mnt_id_ida, mnt->mnt_id);
}
/*
@@ -88,7 +88,7 @@ static void mnt_free_id(struct mount *mnt)
*/
static int mnt_alloc_group_id(struct mount *mnt)
{
- int res = ida_simple_get(&mnt_id_ida, 1, 0, GFP_KERNEL);
+ int res = ida_alloc_range(&mnt_id_ida, 1, 0, GFP_KERNEL);
if (res < 0)
return res;
@@ -101,7 +101,7 @@ static int mnt_alloc_group_id(struct mount *mnt)
*/
void mnt_release_group_id(struct mount *mnt)
{
- ida_simple_remove(&mnt_group_ida, mnt->mnt_group_id);
+ ida_remove(&mnt_group_ida, mnt->mnt_group_id);
}
/*
diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index 5ed4bce576b5..fac3c03d6ab8 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -459,7 +459,7 @@ nfs4_remove_state_owner_locked(struct nfs4_state_owner *sp)
if (!RB_EMPTY_NODE(&sp->so_server_node))
rb_erase(&sp->so_server_node, &server->state_owners);
- ida_simple_remove(&server->openowner_id, sp->so_seqid.owner_id);
+ ida_remove(&server->openowner_id, sp->so_seqid.owner_id);
}
static void
@@ -580,7 +580,7 @@ struct nfs4_state_owner *nfs4_get_state_owner(struct nfs_server *server,
if (new == NULL)
goto out;
- id = ida_simple_get(&server->openowner_id, 0, 0, gfp_flags);
+ id = ida_alloc(&server->openowner_id, gfp_flags);
if (id < 0) {
nfs4_free_state_owner(new);
sp = ERR_PTR(id);
@@ -593,7 +593,7 @@ struct nfs4_state_owner *nfs4_get_state_owner(struct nfs_server *server,
spin_unlock(&clp->cl_lock);
if (sp != new) {
- ida_simple_remove(&server->openowner_id, new->so_seqid.owner_id);
+ ida_remove(&server->openowner_id, new->so_seqid.owner_id);
nfs4_free_state_owner(new);
}
out:
@@ -870,7 +870,7 @@ static struct nfs4_lock_state *nfs4_alloc_lock_state(struct nfs4_state *state, f
default:
goto out_free;
}
- lsp->ls_seqid.owner_id = ida_simple_get(&server->lockowner_id, 0, 0, GFP_NOFS);
+ lsp->ls_seqid.owner_id = ida_alloc(&server->lockowner_id, GFP_NOFS);
if (lsp->ls_seqid.owner_id < 0)
goto out_free;
INIT_LIST_HEAD(&lsp->ls_locks);
@@ -882,7 +882,7 @@ out_free:
void nfs4_free_lock_state(struct nfs_server *server, struct nfs4_lock_state *lsp)
{
- ida_simple_remove(&server->lockowner_id, lsp->ls_seqid.owner_id);
+ ida_remove(&server->lockowner_id, lsp->ls_seqid.owner_id);
nfs4_destroy_seqid_counter(&lsp->ls_seqid);
kfree(lsp);
}
diff --git a/fs/proc/generic.c b/fs/proc/generic.c
index 944ce2befc38..b6253a802bbe 100644
--- a/fs/proc/generic.c
+++ b/fs/proc/generic.c
@@ -129,7 +129,7 @@ static DEFINE_IDA(proc_inum_ida);
*/
int proc_alloc_inum(unsigned int *inum)
{
- int i = ida_simple_get(&proc_inum_ida, 0,
+ int i = ida_alloc_range(&proc_inum_ida, 0,
UINT_MAX - PROC_DYNAMIC_FIRST,
GFP_KERNEL);
if (i < 0)
@@ -141,7 +141,7 @@ int proc_alloc_inum(unsigned int *inum)
void proc_free_inum(unsigned int inum)
{
- ida_simple_remove(&proc_inum_ida, inum - PROC_DYNAMIC_FIRST);
+ ida_remove(&proc_inum_ida, inum - PROC_DYNAMIC_FIRST);
}
static void *proc_follow_link(struct dentry *dentry, struct nameidata *nd)
diff --git a/fs/super.c b/fs/super.c
index ec99b7eeeb7d..b83a8b1cd9e4 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -823,7 +823,7 @@ int get_anon_bdev(dev_t *p)
{
int dev;
- dev = ida_simple_get(&unnamed_dev_ida, 0,
+ dev = ida_alloc_range(&unnamed_dev_ida, 0,
1 << MINORBITS, GFP_ATOMIC);
if (dev == -ENOSPC)
return -EMFILE;
@@ -837,7 +837,7 @@ EXPORT_SYMBOL(get_anon_bdev);
void free_anon_bdev(dev_t dev)
{
- ida_simple_remove(&unnamed_dev_ida, MINOR(dev));
+ ida_remove(&unnamed_dev_ida, MINOR(dev));
}
EXPORT_SYMBOL(free_anon_bdev);
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c
index f999dbb4db7c..6329bf916297 100644
--- a/fs/sysfs/dir.c
+++ b/fs/sysfs/dir.c
@@ -233,7 +233,7 @@ static void sysfs_deactivate(struct sysfs_dirent *sd)
static int sysfs_alloc_ino(unsigned int *pino)
{
- int ino = ida_simple_get(&sysfs_ino_ida, 2, 0, GFP_KERNEL);
+ int ino = ida_alloc_range(&sysfs_ino_ida, 2, 0, GFP_KERNEL);
if (ino < 0)
return ino;
@@ -245,7 +245,7 @@ static int sysfs_alloc_ino(unsigned int *pino)
static void sysfs_free_ino(unsigned int ino)
{
- ida_simple_remove(&sysfs_ino_ida, ino);
+ ida_remove(&sysfs_ino_ida, ino);
}
void release_sysfs_dirent(struct sysfs_dirent * sd)
diff --git a/include/linux/idr.h b/include/linux/idr.h
index 43f915193fb6..c0e0c5446909 100644
--- a/include/linux/idr.h
+++ b/include/linux/idr.h
@@ -222,9 +222,14 @@ struct ida {
void ida_destroy(struct ida *ida);
void ida_init(struct ida *ida);
-int ida_simple_get(struct ida *ida, unsigned int start, unsigned int end,
+int ida_alloc_range(struct ida *ida, unsigned int start, unsigned int end,
gfp_t gfp_mask);
-void ida_simple_remove(struct ida *ida, unsigned int id);
+void ida_remove(struct ida *ida, unsigned int id);
+
+static inline int ida_alloc(struct ida *ida, gfp_t gfp_mask)
+{
+ return ida_alloc_range(ida, 0, 0, gfp_mask);
+}
void __init idr_init_cache(void);
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 690f67254f89..fd0fa326e4cc 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -846,7 +846,7 @@ static void cgroup_free_fn(struct work_struct *work)
*/
dput(cgrp->parent->dentry);
- ida_simple_remove(&cgrp->root->cgroup_ida, cgrp->id);
+ ida_remove(&cgrp->root->cgroup_ida, cgrp->id);
/*
* Drop the active superblock reference that we took when we
@@ -1426,7 +1426,7 @@ static void init_cgroup_root(struct cgroupfs_root *root)
static bool init_root_id(struct cgroupfs_root *root)
{
- int ret = ida_simple_get(&hierarchy_ida, 0, 0, GFP_KERNEL);
+ int ret = ida_alloc(&hierarchy_ida, GFP_KERNEL);
if (ret < 0)
return false;
@@ -1489,7 +1489,7 @@ static void cgroup_drop_root(struct cgroupfs_root *root)
return;
BUG_ON(!root->hierarchy_id);
- ida_simple_remove(&hierarchy_ida, root->hierarchy_id);
+ ida_remove(&hierarchy_ida, root->hierarchy_id);
ida_destroy(&root->cgroup_ida);
kfree(root);
}
@@ -4101,7 +4101,7 @@ static long cgroup_create(struct cgroup *parent, struct dentry *dentry,
goto err_free_cgrp;
rcu_assign_pointer(cgrp->name, name);
- cgrp->id = ida_simple_get(&root->cgroup_ida, 1, 0, GFP_KERNEL);
+ cgrp->id = ida_alloc_range(&root->cgroup_ida, 1, 0, GFP_KERNEL);
if (cgrp->id < 0)
goto err_free_name;
@@ -4210,7 +4210,7 @@ err_free_all:
/* Release the reference count that we took on the superblock */
deactivate_super(sb);
err_free_id:
- ida_simple_remove(&root->cgroup_ida, cgrp->id);
+ ida_remove(&root->cgroup_ida, cgrp->id);
err_free_name:
kfree(rcu_dereference_raw(cgrp->name));
err_free_cgrp:
diff --git a/lib/idr.c b/lib/idr.c
index d57bb81e481d..df2d32ec1c3e 100644
--- a/lib/idr.c
+++ b/lib/idr.c
@@ -1019,7 +1019,7 @@ static int ida_get_new_above(struct ida *ida, int starting_id, int *p_id)
return 0;
}
-static void ida_remove(struct ida *ida, int id)
+static void __ida_remove(struct ida *ida, int id)
{
struct idr_layer *p = ida->idr.top;
int shift = (ida->idr.layers - 1) * IDR_BITS;
@@ -1073,7 +1073,7 @@ void ida_destroy(struct ida *ida)
EXPORT_SYMBOL(ida_destroy);
/**
- * ida_simple_get - get a new id.
+ * ida_alloc_range - get a new id.
* @ida: the (initialized) ida.
* @start: the minimum id (inclusive, < 0x8000000)
* @end: the maximum id (exclusive, < 0x8000000 or 0)
@@ -1082,9 +1082,9 @@ EXPORT_SYMBOL(ida_destroy);
* Allocates an id in the range start <= id < end, or returns -ENOSPC.
* On memory allocation failure, returns -ENOMEM.
*
- * Use ida_simple_remove() to get rid of an id.
+ * Use ida_remove() to get rid of an id.
*/
-int ida_simple_get(struct ida *ida, unsigned int start, unsigned int end,
+int ida_alloc_range(struct ida *ida, unsigned int start, unsigned int end,
gfp_t gfp_mask)
{
int ret, id;
@@ -1109,7 +1109,7 @@ again:
ret = ida_get_new_above(ida, start, &id);
if (!ret) {
if (id > max) {
- ida_remove(ida, id);
+ __ida_remove(ida, id);
ret = -ENOSPC;
} else {
ret = id;
@@ -1122,23 +1122,23 @@ again:
return ret;
}
-EXPORT_SYMBOL(ida_simple_get);
+EXPORT_SYMBOL(ida_alloc_range);
/**
- * ida_simple_remove - remove an allocated id.
+ * ida_remove - remove an allocated id.
* @ida: the (initialized) ida.
- * @id: the id returned by ida_simple_get.
+ * @id: the id returned by ida_alloc_range.
*/
-void ida_simple_remove(struct ida *ida, unsigned int id)
+void ida_remove(struct ida *ida, unsigned int id)
{
unsigned long flags;
BUG_ON((int)id < 0);
spin_lock_irqsave(&simple_ida_lock, flags);
- ida_remove(ida, id);
+ __ida_remove(ida, id);
spin_unlock_irqrestore(&simple_ida_lock, flags);
}
-EXPORT_SYMBOL(ida_simple_remove);
+EXPORT_SYMBOL(ida_remove);
/**
* ida_init - initialize ida handle
diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 010d6c14129a..1c7d82f44bd0 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -657,7 +657,7 @@ static void disarm_kmem_keys(struct mem_cgroup *memcg)
{
if (memcg_kmem_is_active(memcg)) {
static_key_slow_dec(&memcg_kmem_enabled_key);
- ida_simple_remove(&kmem_limited_groups, memcg->kmemcg_id);
+ ida_remove(&kmem_limited_groups, memcg->kmemcg_id);
}
/*
* This check can't live in kmem destruction function,
@@ -3068,7 +3068,7 @@ int memcg_update_cache_sizes(struct mem_cgroup *memcg)
{
int num, ret;
- num = ida_simple_get(&kmem_limited_groups,
+ num = ida_alloc_range(&kmem_limited_groups,
0, MEMCG_CACHES_MAX_SIZE, GFP_KERNEL);
if (num < 0)
return num;
@@ -3083,7 +3083,7 @@ int memcg_update_cache_sizes(struct mem_cgroup *memcg)
ret = memcg_update_all_caches(num+1);
if (ret) {
- ida_simple_remove(&kmem_limited_groups, num);
+ ida_remove(&kmem_limited_groups, num);
memcg_kmem_clear_activated(memcg);
return ret;
}
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 33843c5c4939..485962fb7b7c 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -2181,10 +2181,10 @@ int hci_register_dev(struct hci_dev *hdev)
*/
switch (hdev->dev_type) {
case HCI_BREDR:
- id = ida_simple_get(&hci_index_ida, 0, 0, GFP_KERNEL);
+ id = ida_alloc(&hci_index_ida, GFP_KERNEL);
break;
case HCI_AMP:
- id = ida_simple_get(&hci_index_ida, 1, 0, GFP_KERNEL);
+ id = ida_alloc_range(&hci_index_ida, 1, 0, GFP_KERNEL);
break;
default:
return -EINVAL;
@@ -2248,7 +2248,7 @@ err_wqueue:
destroy_workqueue(hdev->workqueue);
destroy_workqueue(hdev->req_workqueue);
err:
- ida_simple_remove(&hci_index_ida, hdev->id);
+ ida_remove(&hci_index_ida, hdev->id);
write_lock(&hci_dev_list_lock);
list_del(&hdev->list);
write_unlock(&hci_dev_list_lock);
@@ -2312,7 +2312,7 @@ void hci_unregister_dev(struct hci_dev *hdev)
hci_dev_put(hdev);
- ida_simple_remove(&hci_index_ida, id);
+ ida_remove(&hci_index_ida, id);
}
EXPORT_SYMBOL(hci_unregister_dev);
diff --git a/net/core/net_namespace.c b/net/core/net_namespace.c
index e8c452de7e7b..7c474638ded5 100644
--- a/net/core/net_namespace.c
+++ b/net/core/net_namespace.c
@@ -500,7 +500,7 @@ static int register_pernet_operations(struct list_head *list,
int error;
if (ops->id) {
- int id = ida_simple_get(&net_generic_ids, 1, 0, GFP_KERNEL);
+ int id = ida_alloc_range(&net_generic_ids, 1, 0, GFP_KERNEL);
if (id < 0)
return id;
@@ -511,7 +511,7 @@ static int register_pernet_operations(struct list_head *list,
if (error) {
rcu_barrier();
if (ops->id)
- ida_simple_remove(&net_generic_ids, *ops->id);
+ ida_remove(&net_generic_ids, *ops->id);
}
return error;
@@ -522,7 +522,7 @@ static void unregister_pernet_operations(struct pernet_operations *ops)
__unregister_pernet_operations(ops);
rcu_barrier();
if (ops->id)
- ida_simple_remove(&net_generic_ids, *ops->id);
+ ida_remove(&net_generic_ids, *ops->id);
}
/**
diff --git a/net/nfc/core.c b/net/nfc/core.c
index 40d2527693da..0fc76f37fdd0 100644
--- a/net/nfc/core.c
+++ b/net/nfc/core.c
@@ -839,7 +839,7 @@ int nfc_register_device(struct nfc_dev *dev)
pr_debug("dev_name=%s\n", dev_name(&dev->dev));
- dev->idx = ida_simple_get(&nfc_index_ida, 0, 0, GFP_KERNEL);
+ dev->idx = ida_alloc(&nfc_index_ida, GFP_KERNEL);
if (dev->idx < 0)
return dev->idx;
@@ -915,7 +915,7 @@ void nfc_unregister_device(struct nfc_dev *dev)
device_del(&dev->dev);
mutex_unlock(&nfc_devlist_mutex);
- ida_simple_remove(&nfc_index_ida, id);
+ ida_remove(&nfc_index_ida, id);
}
EXPORT_SYMBOL(nfc_unregister_device);