Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1237667
| From | Lee Duncan <lduncan@suse.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 3/5] block: nvme-core: simplify ida usage |
| Date | 2015-10-01 21:10 +0200 |
| Message-ID | <qeRoS-56r-29@gated-at.bofh.it> (permalink) |
| References | <qeRfc-4FF-13@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
Simplify ida index allocation and removal by
using the ida_simple_* helper functions.
Signed-off-by: Lee Duncan <lduncan@suse.com>
---
drivers/block/nvme-core.c | 16 ++++------------
1 file changed, 4 insertions(+), 12 deletions(-)
diff --git a/drivers/block/nvme-core.c b/drivers/block/nvme-core.c
index d1d6141920d3..d354a3391e4a 100644
--- a/drivers/block/nvme-core.c
+++ b/drivers/block/nvme-core.c
@@ -2713,18 +2713,10 @@ static DEFINE_IDA(nvme_instance_ida);
static int nvme_set_instance(struct nvme_dev *dev)
{
- int instance, error;
+ int instance;
- do {
- if (!ida_pre_get(&nvme_instance_ida, GFP_KERNEL))
- return -ENODEV;
-
- spin_lock(&dev_list_lock);
- error = ida_get_new(&nvme_instance_ida, &instance);
- spin_unlock(&dev_list_lock);
- } while (error == -EAGAIN);
-
- if (error)
+ instance = ida_simple_get(&nvme_instance_ida, 0, 0, GFP_KERNEL);
+ if (instance < 0)
return -ENODEV;
dev->instance = instance;
@@ -2734,7 +2726,7 @@ static int nvme_set_instance(struct nvme_dev *dev)
static void nvme_release_instance(struct nvme_dev *dev)
{
spin_lock(&dev_list_lock);
- ida_remove(&nvme_instance_ida, dev->instance);
+ ida_simple_remove(&nvme_instance_ida, dev->instance);
spin_unlock(&dev_list_lock);
}
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/5] Modify ida_* users to use ida_simple_* Lee Duncan <lduncan@suse.com> - 2015-10-01 21:00 +0200
[PATCH 2/5] block: rsxx: core: simplify ida usage Lee Duncan <lduncan@suse.com> - 2015-10-01 21:10 +0200
[PATCH 4/5] block: mtip32xx: simplify ida usage Lee Duncan <lduncan@suse.com> - 2015-10-01 21:10 +0200
[PATCH 5/5] base: soc: siplify ida usage Lee Duncan <lduncan@suse.com> - 2015-10-01 21:10 +0200
[PATCH 1/5] SCSI: sd: simplify ida usage Lee Duncan <lduncan@suse.com> - 2015-10-01 21:10 +0200
[PATCH 3/5] block: nvme-core: simplify ida usage Lee Duncan <lduncan@suse.com> - 2015-10-01 21:10 +0200
Re: [PATCH 0/5] Modify ida_* users to use ida_simple_* Tejun Heo <tj@kernel.org> - 2015-10-05 19:50 +0200
Re: [PATCH 0/5] Modify ida_* users to use ida_simple_* James Bottomley <James.Bottomley@HansenPartnership.com> - 2015-10-05 20:00 +0200
csiph-web