[SCSI] SCSI core: better initialization for sdev->scsi_level
[firefly-linux-kernel-4.4.55.git] / drivers / infiniband / core / fmr_pool.c
index 615fe9cc6c568fe9b42dffdf007fda3254c81e1e..8926a2bd4a8707d7b765432253a400c3719e9860 100644 (file)
@@ -394,20 +394,12 @@ EXPORT_SYMBOL(ib_destroy_fmr_pool);
  */
 int ib_flush_fmr_pool(struct ib_fmr_pool *pool)
 {
-       int serial;
-
-       atomic_inc(&pool->req_ser);
-       /*
-        * It's OK if someone else bumps req_ser again here -- we'll
-        * just wait a little longer.
-        */
-       serial = atomic_read(&pool->req_ser);
+       int serial = atomic_inc_return(&pool->req_ser);
 
        wake_up_process(pool->thread);
 
        if (wait_event_interruptible(pool->force_wait,
-                                    atomic_read(&pool->flush_ser) -
-                                    atomic_read(&pool->req_ser) >= 0))
+                                    atomic_read(&pool->flush_ser) - serial >= 0))
                return -EINTR;
 
        return 0;
@@ -426,7 +418,7 @@ EXPORT_SYMBOL(ib_flush_fmr_pool);
 struct ib_pool_fmr *ib_fmr_pool_map_phys(struct ib_fmr_pool *pool_handle,
                                         u64                *page_list,
                                         int                 list_len,
-                                        u64                *io_virtual_address)
+                                        u64                 io_virtual_address)
 {
        struct ib_fmr_pool *pool = pool_handle;
        struct ib_pool_fmr *fmr;
@@ -440,7 +432,7 @@ struct ib_pool_fmr *ib_fmr_pool_map_phys(struct ib_fmr_pool *pool_handle,
        fmr = ib_fmr_cache_lookup(pool,
                                  page_list,
                                  list_len,
-                                 *io_virtual_address);
+                                 io_virtual_address);
        if (fmr) {
                /* found in cache */
                ++fmr->ref_count;
@@ -464,7 +456,7 @@ struct ib_pool_fmr *ib_fmr_pool_map_phys(struct ib_fmr_pool *pool_handle,
        spin_unlock_irqrestore(&pool->pool_lock, flags);
 
        result = ib_map_phys_fmr(fmr->fmr, page_list, list_len,
-                                *io_virtual_address);
+                                io_virtual_address);
 
        if (result) {
                spin_lock_irqsave(&pool->pool_lock, flags);
@@ -481,7 +473,7 @@ struct ib_pool_fmr *ib_fmr_pool_map_phys(struct ib_fmr_pool *pool_handle,
        fmr->ref_count = 1;
 
        if (pool->cache_bucket) {
-               fmr->io_virtual_address = *io_virtual_address;
+               fmr->io_virtual_address = io_virtual_address;
                fmr->page_list_len      = list_len;
                memcpy(fmr->page_list, page_list, list_len * sizeof(*page_list));