Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 33119
b: refs/heads/master
c: fd60ae4
h: refs/heads/master
i:
  33117: 2aac7dd
  33115: e95bd19
  33111: ae3d0e5
  33103: 1de9c7e
  33087: ba5d56b
v: v3
  • Loading branch information
Jack Morgenstein authored and Roland Dreier committed Aug 3, 2006
1 parent 7becb42 commit 009a80c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 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: 8ddc7c5326064434048ec1ecfe57659e08345cc1
refs/heads/master: fd60ae404f104f12369e654af9cf03b1f1047661
2 changes: 2 additions & 0 deletions trunk/drivers/infiniband/core/uverbs.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include <linux/kref.h>
#include <linux/idr.h>
#include <linux/mutex.h>
#include <linux/completion.h>

#include <rdma/ib_verbs.h>
#include <rdma/ib_user_verbs.h>
Expand Down Expand Up @@ -69,6 +70,7 @@

struct ib_uverbs_device {
struct kref ref;
struct completion comp;
int devnum;
struct cdev *dev;
struct class_device *class_dev;
Expand Down
8 changes: 7 additions & 1 deletion trunk/drivers/infiniband/core/uverbs_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ static void ib_uverbs_release_dev(struct kref *ref)
struct ib_uverbs_device *dev =
container_of(ref, struct ib_uverbs_device, ref);

kfree(dev);
complete(&dev->comp);
}

void ib_uverbs_release_ucq(struct ib_uverbs_file *file,
Expand Down Expand Up @@ -740,6 +740,7 @@ static void ib_uverbs_add_one(struct ib_device *device)
return;

kref_init(&uverbs_dev->ref);
init_completion(&uverbs_dev->comp);

spin_lock(&map_lock);
uverbs_dev->devnum = find_first_zero_bit(dev_map, IB_UVERBS_MAX_DEVICES);
Expand Down Expand Up @@ -793,6 +794,8 @@ static void ib_uverbs_add_one(struct ib_device *device)

err:
kref_put(&uverbs_dev->ref, ib_uverbs_release_dev);
wait_for_completion(&uverbs_dev->comp);
kfree(uverbs_dev);
return;
}

Expand All @@ -812,7 +815,10 @@ static void ib_uverbs_remove_one(struct ib_device *device)
spin_unlock(&map_lock);

clear_bit(uverbs_dev->devnum, dev_map);

kref_put(&uverbs_dev->ref, ib_uverbs_release_dev);
wait_for_completion(&uverbs_dev->comp);
kfree(uverbs_dev);
}

static int uverbs_event_get_sb(struct file_system_type *fs_type, int flags,
Expand Down

0 comments on commit 009a80c

Please sign in to comment.