video: tegra: nvmap: remove unused nvmap_pin_array
Krishna Reddy [Wed, 28 Aug 2013 21:18:20 +0000 (14:18 -0700)]
remove unused nvmap_pin_array API.

Change-Id: I33d96c327decfc79a36efd51503ed9bb6956b9b9
Signed-off-by: Krishna Reddy <vdumpa@nvidia.com>
Reviewed-on: http://git-master/r/267545
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Jon Mayo <jmayo@nvidia.com>

drivers/video/tegra/nvmap/nvmap.c
include/linux/nvmap.h

index 552634f..3e58c50 100644 (file)
@@ -367,195 +367,6 @@ out:
        return ret;
 }
 
-static int nvmap_validate_get_pin_array(struct nvmap_client *client,
-                               unsigned long *h,
-                               long unsigned id_type_mask,
-                               long unsigned id_type,
-                               int nr,
-                               struct nvmap_handle **unique_handles,
-                               struct nvmap_handle_ref **unique_handle_refs)
-{
-       int i;
-       int err = 0;
-       int count = 0;
-       unsigned long last_h = 0;
-       struct nvmap_handle_ref *last_ref = 0;
-
-       nvmap_ref_lock(client);
-
-       for (i = 0; i < nr; i++) {
-               struct nvmap_handle_ref *ref;
-
-               if ((h[i] & id_type_mask) != id_type)
-                       continue;
-
-               if (last_h == h[i])
-                       continue;
-
-               ref = _nvmap_validate_id_locked(client, h[i]);
-
-               if (!ref)
-                       nvmap_err(client, "failed to validate id\n");
-               else if (!ref->handle)
-                       nvmap_err(client, "id had no associated handle\n");
-               else if (!ref->handle->alloc)
-                       nvmap_err(client, "handle had no allocation\n");
-
-               if (!ref || !ref->handle || !ref->handle->alloc) {
-                       err = -EPERM;
-                       break;
-               }
-
-               last_h = h[i];
-               last_ref = ref;
-               /* a handle may be referenced multiple times in arr, but
-                * it will only be pinned once; this ensures that the
-                * minimum number of sync-queue slots in the host driver
-                * are dedicated to storing unpin lists, which allows
-                * for greater parallelism between the CPU and graphics
-                * processor */
-               if (ref->handle->flags & NVMAP_HANDLE_VISITED)
-                       continue;
-
-               ref->handle->flags |= NVMAP_HANDLE_VISITED;
-
-               unique_handles[count] = nvmap_handle_get(ref->handle);
-
-               /* Duplicate handle */
-               atomic_inc(&ref->dupes);
-               nvmap_handle_get(ref->handle);
-               unique_handle_refs[count] = ref;
-
-               BUG_ON(!unique_handles[count]);
-               count++;
-       }
-
-       nvmap_ref_unlock(client);
-
-       if (err) {
-               for (i = 0; i < count; i++) {
-                       unique_handles[i]->flags &= ~NVMAP_HANDLE_VISITED;
-                       /* pin ref */
-                       nvmap_handle_put(unique_handles[i]);
-                       /* ref count */
-                       atomic_dec(&unique_handle_refs[i]->dupes);
-                       nvmap_handle_put(unique_handles[i]);
-               }
-       }
-
-       return err ? err : count;
-}
-
-/*
- * @client:       nvmap_client which should be used for validation;
- *                should be owned by the process which is submitting
- *                command buffers
- * @user_ids:     array of user nvmap_handle ids to pin
- * @id_type_mask: bitmask which defines handle type field in handle id.
- * @id_type:      only handles with of this type will be pinned. Handles with
- *                other type are ignored.
- * @nr:           number of entries in arr
- * @unique_arr:   list of nvmap_handle objects which were pinned by
- *                nvmap_pin_array. Must be unpinned after use
- * @unique_arr_ref: list of duplicated nvmap_handle_refs corresponding
- *                  to unique_arr. Must be freed after use.
- */
-int nvmap_pin_array(struct nvmap_client *client,
-               unsigned long   *user_ids,
-               long unsigned id_type_mask,
-               long unsigned id_type,
-               int nr,
-               struct nvmap_handle **unique_arr,
-               struct nvmap_handle_ref **unique_arr_refs)
-{
-       int count = 0;
-       int ret = 0;
-       int i;
-       unsigned long *ids;
-
-       if (!virt_addr_valid(client) ||
-           !user_ids ||
-           !unique_arr ||
-           !unique_arr_refs)
-               return -EINVAL;
-
-       ids = kmalloc(sizeof(ids) * nr, GFP_KERNEL);
-       if (!ids) {
-               ret = -ENOMEM;
-               goto exit;
-       }
-
-       if (mutex_lock_interruptible(&nvmap_share->pin_lock)) {
-               nvmap_err(client, "%s interrupted when acquiring pin lock\n",
-                          current->group_leader->comm);
-               ret = -EINTR;
-               goto kfree_out;
-       }
-
-       for (i = 0; i < nr; i++)
-               ids[i] = unmarshal_user_id(user_ids[i]);
-
-       count = nvmap_validate_get_pin_array(client, ids,
-                       id_type_mask, id_type, nr,
-                       unique_arr, unique_arr_refs);
-
-       if (count < 0) {
-               mutex_unlock(&nvmap_share->pin_lock);
-               kfree(ids);
-               nvmap_warn(client, "failed to validate pin array\n");
-               return count;
-       }
-
-       for (i = 0; i < count; i++)
-               unique_arr[i]->flags &= ~NVMAP_HANDLE_VISITED;
-
-       ret = wait_pin_array_locked(client, unique_arr, count);
-
-       mutex_unlock(&nvmap_share->pin_lock);
-
-       if (WARN_ON(ret)) {
-               goto err_out;
-       } else {
-               for (i = 0; i < count; i++) {
-                       if (unique_arr[i]->heap_pgalloc &&
-                           unique_arr[i]->pgalloc.dirty) {
-                               ret = map_iovmm_area(unique_arr[i]);
-                               while (ret && --i >= 0) {
-                                       tegra_iovmm_zap_vm(
-                                               unique_arr[i]->pgalloc.area);
-                                       atomic_dec(&unique_arr_refs[i]->pin);
-                               }
-                               if (ret)
-                                       goto err_out_unpin;
-                       }
-
-                       atomic_inc(&unique_arr_refs[i]->pin);
-               }
-       }
-       ret = count;
-       goto kfree_out;
-
-err_out_unpin:
-       for (i = 0; i < count; i++) {
-               /* inc ref counter, because handle_unpin decrements it */
-               nvmap_handle_get(unique_arr[i]);
-               /* unpin handles and free vm */
-               handle_unpin(client, unique_arr[i], true);
-       }
-err_out:
-       for (i = 0; i < count; i++) {
-               /* pin ref */
-               nvmap_handle_put(unique_arr[i]);
-               /* remove duplicate */
-               atomic_dec(&unique_arr_refs[i]->dupes);
-               nvmap_handle_put(unique_arr[i]);
-       }
-kfree_out:
-       kfree(ids);
-exit:
-       return ret;
-}
-
 static phys_addr_t handle_phys(struct nvmap_handle *h)
 {
        phys_addr_t addr;
index 25f4131..b5c69ab 100644 (file)
@@ -132,14 +132,6 @@ struct nvmap_handle_ref *nvmap_duplicate_handle_user_id(
                                                struct nvmap_client *client,
                                                unsigned long user_id);
 
-int nvmap_pin_array(struct nvmap_client *client,
-               unsigned long    *user_ids,
-               long unsigned id_type_mask,
-               long unsigned id_type,
-               int nr,
-               struct nvmap_handle **unique_arr,
-               struct nvmap_handle_ref **unique_arr_refs);
-
 ulong nvmap_get_handle_user_id(struct nvmap_client *client,
                                         unsigned long id);