Linux 3.2.82
[pandora-kernel.git] / drivers / md / dm-path-selector.c
index 96ea226..fa0ccc5 100644 (file)
@@ -10,6 +10,7 @@
  */
 
 #include <linux/device-mapper.h>
+#include <linux/module.h>
 
 #include "dm-path-selector.h"
 
@@ -17,9 +18,7 @@
 
 struct ps_internal {
        struct path_selector_type pst;
-
        struct list_head list;
-       long use;
 };
 
 #define pst_to_psi(__pst) container_of((__pst), struct ps_internal, pst)
@@ -45,12 +44,8 @@ static struct ps_internal *get_path_selector(const char *name)
 
        down_read(&_ps_lock);
        psi = __find_path_selector_type(name);
-       if (psi) {
-               if ((psi->use == 0) && !try_module_get(psi->pst.module))
-                       psi = NULL;
-               else
-                       psi->use++;
-       }
+       if (psi && !try_module_get(psi->pst.module))
+               psi = NULL;
        up_read(&_ps_lock);
 
        return psi;
@@ -84,11 +79,7 @@ void dm_put_path_selector(struct path_selector_type *pst)
        if (!psi)
                goto out;
 
-       if (--psi->use == 0)
-               module_put(psi->pst.module);
-
-       BUG_ON(psi->use < 0);
-
+       module_put(psi->pst.module);
 out:
        up_read(&_ps_lock);
 }
@@ -136,11 +127,6 @@ int dm_unregister_path_selector(struct path_selector_type *pst)
                return -EINVAL;
        }
 
-       if (psi->use) {
-               up_write(&_ps_lock);
-               return -ETXTBSY;
-       }
-
        list_del(&psi->list);
 
        up_write(&_ps_lock);