Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 184943
b: refs/heads/master
c: 2a72f21
h: refs/heads/master
i:
  184941: eef562e
  184939: 6f016c3
  184935: acf1276
  184927: c6c11fd
v: v3
  • Loading branch information
Alexander Chiang authored and Roland Dreier committed Feb 24, 2010
1 parent f63db14 commit 20f0af6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 20 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: 055422ddbb0a7610c5f57a056743d7336a39e90f
refs/heads/master: 2a72f212263701b927559f6850446421d5906c41
24 changes: 5 additions & 19 deletions trunk/drivers/infiniband/core/uverbs_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ DEFINE_IDR(ib_uverbs_qp_idr);
DEFINE_IDR(ib_uverbs_srq_idr);

static DEFINE_SPINLOCK(map_lock);
static struct ib_uverbs_device *dev_table[IB_UVERBS_MAX_DEVICES];
static DECLARE_BITMAP(dev_map, IB_UVERBS_MAX_DEVICES);

static ssize_t (*uverbs_cmd_table[])(struct ib_uverbs_file *file,
Expand Down Expand Up @@ -616,28 +615,23 @@ static int ib_uverbs_mmap(struct file *filp, struct vm_area_struct *vma)
/*
* ib_uverbs_open() does not need the BKL:
*
* - dev_table[] accesses are protected by map_lock, the
* ib_uverbs_device structures are properly reference counted, and
* - the ib_uverbs_device structures are properly reference counted and
* everything else is purely local to the file being created, so
* races against other open calls are not a problem;
* - there is no ioctl method to race against;
* - the device is added to dev_table[] as the last part of module
* initialization, the open method will either immediately run
* -ENXIO, or all required initialization will be done.
* - the open method will either immediately run -ENXIO, or all
* required initialization will be done.
*/
static int ib_uverbs_open(struct inode *inode, struct file *filp)
{
struct ib_uverbs_device *dev;
struct ib_uverbs_file *file;
int ret;

spin_lock(&map_lock);
dev = dev_table[iminor(inode) - IB_UVERBS_BASE_MINOR];
dev = container_of(inode->i_cdev, struct ib_uverbs_device, cdev);
if (dev)
kref_get(&dev->ref);
spin_unlock(&map_lock);

if (!dev)
else
return -ENXIO;

if (!try_module_get(dev->ib_dev->owner)) {
Expand Down Expand Up @@ -778,10 +772,6 @@ static void ib_uverbs_add_one(struct ib_device *device)
if (device_create_file(uverbs_dev->dev, &dev_attr_abi_version))
goto err_class;

spin_lock(&map_lock);
dev_table[uverbs_dev->devnum] = uverbs_dev;
spin_unlock(&map_lock);

ib_set_client_data(device, &uverbs_client, uverbs_dev);

return;
Expand Down Expand Up @@ -811,10 +801,6 @@ static void ib_uverbs_remove_one(struct ib_device *device)
device_destroy(uverbs_class, uverbs_dev->cdev.dev);
cdev_del(&uverbs_dev->cdev);

spin_lock(&map_lock);
dev_table[uverbs_dev->devnum] = NULL;
spin_unlock(&map_lock);

clear_bit(uverbs_dev->devnum, dev_map);

kref_put(&uverbs_dev->ref, ib_uverbs_release_dev);
Expand Down

0 comments on commit 20f0af6

Please sign in to comment.