Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 359332
b: refs/heads/master
c: 37b6189
h: refs/heads/master
v: v3
  • Loading branch information
Tejun Heo authored and Linus Torvalds committed Feb 28, 2013
1 parent 939a82e commit 594e1c0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 18 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3bec60d511179853138836ae6e1b61fe34d9235f
refs/heads/master: 37b61890d757f606c25ac5a247572cb7d5efde96
19 changes: 10 additions & 9 deletions trunk/drivers/firewire/core-cdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -487,27 +487,28 @@ static int ioctl_get_info(struct client *client, union ioctl_arg *arg)
static int add_client_resource(struct client *client,
struct client_resource *resource, gfp_t gfp_mask)
{
bool preload = gfp_mask & __GFP_WAIT;
unsigned long flags;
int ret;

retry:
if (idr_pre_get(&client->resource_idr, gfp_mask) == 0)
return -ENOMEM;

if (preload)
idr_preload(gfp_mask);
spin_lock_irqsave(&client->lock, flags);

if (client->in_shutdown)
ret = -ECANCELED;
else
ret = idr_get_new(&client->resource_idr, resource,
&resource->handle);
ret = idr_alloc(&client->resource_idr, resource, 0, 0,
GFP_NOWAIT);
if (ret >= 0) {
resource->handle = ret;
client_get(client);
schedule_if_iso_resource(resource);
}
spin_unlock_irqrestore(&client->lock, flags);

if (ret == -EAGAIN)
goto retry;
spin_unlock_irqrestore(&client->lock, flags);
if (preload)
idr_preload_end();

return ret < 0 ? ret : 0;
}
Expand Down
11 changes: 3 additions & 8 deletions trunk/drivers/firewire/core-device.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 594e1c0

Please sign in to comment.