Merge tag 'asm-generic-fixes-5.19-2' of git://git.kernel.org/pub/scm/linux/kernel...
[linux-2.6-microblaze.git] / drivers / iommu / ioasid.c
index 06fee74..a786c03 100644 (file)
@@ -2,7 +2,7 @@
 /*
  * I/O Address Space ID allocator. There is one global IOASID space, split into
  * subsets. Users create a subset with DECLARE_IOASID_SET, then allocate and
- * free IOASIDs with ioasid_alloc and ioasid_put.
+ * free IOASIDs with ioasid_alloc() and ioasid_free().
  */
 #include <linux/ioasid.h>
 #include <linux/module.h>
@@ -15,7 +15,6 @@ struct ioasid_data {
        struct ioasid_set *set;
        void *private;
        struct rcu_head rcu;
-       refcount_t refs;
 };
 
 /*
@@ -315,7 +314,6 @@ ioasid_t ioasid_alloc(struct ioasid_set *set, ioasid_t min, ioasid_t max,
 
        data->set = set;
        data->private = private;
-       refcount_set(&data->refs, 1);
 
        /*
         * Custom allocator needs allocator data to perform platform specific
@@ -348,35 +346,11 @@ exit_free:
 EXPORT_SYMBOL_GPL(ioasid_alloc);
 
 /**
- * ioasid_get - obtain a reference to the IOASID
- * @ioasid: the ID to get
- */
-void ioasid_get(ioasid_t ioasid)
-{
-       struct ioasid_data *ioasid_data;
-
-       spin_lock(&ioasid_allocator_lock);
-       ioasid_data = xa_load(&active_allocator->xa, ioasid);
-       if (ioasid_data)
-               refcount_inc(&ioasid_data->refs);
-       else
-               WARN_ON(1);
-       spin_unlock(&ioasid_allocator_lock);
-}
-EXPORT_SYMBOL_GPL(ioasid_get);
-
-/**
- * ioasid_put - Release a reference to an ioasid
+ * ioasid_free - Free an ioasid
  * @ioasid: the ID to remove
- *
- * Put a reference to the IOASID, free it when the number of references drops to
- * zero.
- *
- * Return: %true if the IOASID was freed, %false otherwise.
  */
-bool ioasid_put(ioasid_t ioasid)
+void ioasid_free(ioasid_t ioasid)
 {
-       bool free = false;
        struct ioasid_data *ioasid_data;
 
        spin_lock(&ioasid_allocator_lock);
@@ -386,10 +360,6 @@ bool ioasid_put(ioasid_t ioasid)
                goto exit_unlock;
        }
 
-       free = refcount_dec_and_test(&ioasid_data->refs);
-       if (!free)
-               goto exit_unlock;
-
        active_allocator->ops->free(ioasid, active_allocator->ops->pdata);
        /* Custom allocator needs additional steps to free the xa element */
        if (active_allocator->flags & IOASID_ALLOCATOR_CUSTOM) {
@@ -399,9 +369,8 @@ bool ioasid_put(ioasid_t ioasid)
 
 exit_unlock:
        spin_unlock(&ioasid_allocator_lock);
-       return free;
 }
-EXPORT_SYMBOL_GPL(ioasid_put);
+EXPORT_SYMBOL_GPL(ioasid_free);
 
 /**
  * ioasid_find - Find IOASID data