]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/infiniband/core/uverbs_main.c
sony-laptop: complete the motion eye camera support in sony-laptop
[linux-2.6-omap-h63xx.git] / drivers / infiniband / core / uverbs_main.c
index e725cccc7cde245803a10791fec5c31c212a1b36..f8bc822a3cc3cca4ab26249e48a639670e397636 100644 (file)
@@ -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,
@@ -375,7 +375,7 @@ static int ib_uverbs_event_close(struct inode *inode, struct file *filp)
        return 0;
 }
 
-static struct file_operations uverbs_event_fops = {
+static const struct file_operations uverbs_event_fops = {
        .owner   = THIS_MODULE,
        .read    = ib_uverbs_event_read,
        .poll    = ib_uverbs_event_poll,
@@ -534,9 +534,9 @@ struct file *ib_uverbs_alloc_event_file(struct ib_uverbs_file *uverbs_file,
         * module reference.
         */
        filp->f_op         = fops_get(&uverbs_event_fops);
-       filp->f_vfsmnt     = mntget(uverbs_event_mnt);
-       filp->f_dentry     = dget(uverbs_event_mnt->mnt_root);
-       filp->f_mapping    = filp->f_dentry->d_inode->i_mapping;
+       filp->f_path.mnt           = mntget(uverbs_event_mnt);
+       filp->f_path.dentry        = dget(uverbs_event_mnt->mnt_root);
+       filp->f_mapping    = filp->f_path.dentry->d_inode->i_mapping;
        filp->f_flags      = O_RDONLY;
        filp->f_mode       = FMODE_READ;
        filp->private_data = ev_file;
@@ -679,14 +679,14 @@ static int ib_uverbs_close(struct inode *inode, struct file *filp)
        return 0;
 }
 
-static struct file_operations uverbs_fops = {
+static const struct file_operations uverbs_fops = {
        .owner   = THIS_MODULE,
        .write   = ib_uverbs_write,
        .open    = ib_uverbs_open,
        .release = ib_uverbs_close
 };
 
-static struct file_operations uverbs_mmap_fops = {
+static const struct file_operations uverbs_mmap_fops = {
        .owner   = THIS_MODULE,
        .write   = ib_uverbs_write,
        .mmap    = ib_uverbs_mmap,
@@ -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);
@@ -793,6 +794,8 @@ err_cdev:
 
 err:
        kref_put(&uverbs_dev->ref, ib_uverbs_release_dev);
+       wait_for_completion(&uverbs_dev->comp);
+       kfree(uverbs_dev);
        return;
 }
 
@@ -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,