summaryrefslogtreecommitdiffstats
path: root/drivers/firewire/core-device.c
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2013-02-27 17:04:05 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2013-02-27 19:10:15 -0800
commit37b61890d757f606c25ac5a247572cb7d5efde96 (patch)
treeb81abfb289f4d2be4ee77a2b555c26bde6dae6e7 /drivers/firewire/core-device.c
parent3bec60d511179853138836ae6e1b61fe34d9235f (diff)
firewire: convert to idr_alloc()
Convert to the much saner new idr interface. v2: Stefan pointed out that add_client_resource() may be called from non-process context. Preload iff @gfp_mask contains __GFP_WAIT. Also updated to include minor upper limit check. [tim.gardner@canonical.com: fix accidentally orphaned 'minor'[ Signed-off-by: Tejun Heo <tj@kernel.org> Acked-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by: Tim Gardner <tim.gardner@canonical.com> Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/firewire/core-device.c')
-rw-r--r--drivers/firewire/core-device.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/firewire/core-device.c b/drivers/firewire/core-device.c
index af3e8aa5eed..03ce7d980c6 100644
--- a/drivers/firewire/core-device.c
+++ b/drivers/firewire/core-device.c
@@ -1017,16 +1017,11 @@ static void fw_device_init(struct work_struct *work)
fw_device_get(device);
down_write(&fw_device_rwsem);
- ret = idr_pre_get(&fw_device_idr, GFP_KERNEL) ?
- idr_get_new(&fw_device_idr, device, &minor) :
- -ENOMEM;
- if (minor >= 1 << MINORBITS) {
- idr_remove(&fw_device_idr, minor);
- minor = -ENOSPC;
- }
+ minor = idr_alloc(&fw_device_idr, device, 0, 1 << MINORBITS,
+ GFP_KERNEL);
up_write(&fw_device_rwsem);
- if (ret < 0)
+ if (minor < 0)
goto error;
device->device.bus = &fw_bus_type;