nvscic2c-pcie: Fix MISRA rule 10.3 violations

Fix total 62 violations of rule 10.3

JIRA NVIPC-3121

Change-Id: I1eae97bdbd8e1b41363469a42c66c23e8899603f
Signed-off-by: cyeddu <cyeddu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3250504
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Reviewed-by: Sumeet Gupta <sumeetg@nvidia.com>
Reviewed-by: svcacv <svcacv@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
GVS: buildbot_gerritrpt <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
chandra
2024-11-18 05:57:43 +00:00
committed by Jon Hunter
parent 414c0b4cf7
commit 9dc7f5a20f
8 changed files with 58 additions and 58 deletions

View File

@@ -385,7 +385,7 @@ allocate_fence(struct syncpt_t *syncpt)
++syncpt->threshold; ++syncpt->threshold;
fence = host1x_fence_create(syncpt->sp, syncpt->threshold, false); fence = host1x_fence_create(syncpt->sp, syncpt->threshold, false);
if (IS_ERR_OR_NULL(fence)) { if (IS_ERR_OR_NULL(fence)) {
ret = PTR_ERR(fence); ret = (int)PTR_ERR(fence);
pr_err("host1x_fence_create failed with: %d\n", ret); pr_err("host1x_fence_create failed with: %d\n", ret);
return ret; return ret;
} }
@@ -455,7 +455,7 @@ start_msg_handling(struct comm_channel_ctx_t *comm_ctx)
"comm-channel-recv-task"); "comm-channel-recv-task");
if (IS_ERR_OR_NULL(r_task->task)) { if (IS_ERR_OR_NULL(r_task->task)) {
pr_err("Failed to create comm channel recv task\n"); pr_err("Failed to create comm channel recv task\n");
return PTR_ERR(r_task->task); return (int)PTR_ERR(r_task->task);
} }
r_task->created = true; r_task->created = true;
@@ -494,7 +494,7 @@ stop_msg_handling(struct comm_channel_ctx_t *comm_ctx)
mutex_lock(&syncpt->lock); mutex_lock(&syncpt->lock);
syncpt->fence_release = true; syncpt->fence_release = true;
if (syncpt->fence) { if (syncpt->fence) {
ret = dma_fence_remove_callback(syncpt->fence, ret = (int)dma_fence_remove_callback(syncpt->fence,
&syncpt->fence_cb); &syncpt->fence_cb);
if (ret) { if (ret) {
/* /*

View File

@@ -78,7 +78,7 @@ gen_desc(u32 peer_board_id, u32 peer_soc_id, u32 peer_cntrlr_id, u32 ep_id,
desc.bit.cntrlr_id = peer_cntrlr_id; desc.bit.cntrlr_id = peer_cntrlr_id;
desc.bit.endpoint_id = ep_id; desc.bit.endpoint_id = ep_id;
desc.bit.handle_type = handle_type; desc.bit.handle_type = handle_type;
desc.bit.handle_id = handle_id; desc.bit.handle_id = (u64)handle_id;
return desc.value; return desc.value;
} }

View File

@@ -509,7 +509,7 @@ parse_endpoint_db(struct driver_param_t *drv_param)
ENDPOINT_DB_PROP_NAME); ENDPOINT_DB_PROP_NAME);
return -EFAULT; return -EFAULT;
} }
nr_endpoint = ret; nr_endpoint = (u8)ret;
if (nr_endpoint == 0U) { if (nr_endpoint == 0U) {
ret = -EINVAL; ret = -EINVAL;

View File

@@ -474,13 +474,13 @@ ioctl_get_info_impl(struct endpoint_t *endpoint,
get_info->nframes = endpoint->nframes; get_info->nframes = endpoint->nframes;
get_info->frame_size = endpoint->frame_sz; get_info->frame_size = endpoint->frame_sz;
get_info->peer.offset = (PEER_MEM_MMAP << PAGE_SHIFT); get_info->peer.offset = (PEER_MEM_MMAP << PAGE_SHIFT);
get_info->peer.size = endpoint->peer_mem.size; get_info->peer.size = (__u32)endpoint->peer_mem.size;
get_info->self.offset = (SELF_MEM_MMAP << PAGE_SHIFT); get_info->self.offset = (SELF_MEM_MMAP << PAGE_SHIFT);
get_info->self.size = endpoint->self_mem.size; get_info->self.size = (__u32)endpoint->self_mem.size;
get_info->link.offset = (LINK_MEM_MMAP << PAGE_SHIFT); get_info->link.offset = (LINK_MEM_MMAP << PAGE_SHIFT);
get_info->link.size = PAGE_ALIGN(sizeof(enum nvscic2c_pcie_link)); get_info->link.size = (__u32)PAGE_ALIGN(sizeof(enum nvscic2c_pcie_link));
get_info->edma_err.offset = (EDMA_ERR_MEM_MMAP << PAGE_SHIFT); get_info->edma_err.offset = (EDMA_ERR_MEM_MMAP << PAGE_SHIFT);
get_info->edma_err.size = PAGE_ALIGN(sizeof(u32)); get_info->edma_err.size = (__u32)PAGE_ALIGN(sizeof(u32));
return 0; return 0;
} }
@@ -596,7 +596,7 @@ allocate_fence(struct syncpt_t *syncpt)
++syncpt->threshold; ++syncpt->threshold;
fence = host1x_fence_create(syncpt->sp, syncpt->threshold, false); fence = host1x_fence_create(syncpt->sp, syncpt->threshold, false);
if (IS_ERR(fence)) { if (IS_ERR(fence)) {
ret = PTR_ERR(fence); ret = (int)PTR_ERR(fence);
pr_err("host1x_fence_create failed with: %d\n", ret); pr_err("host1x_fence_create failed with: %d\n", ret);
return ret; return ret;
} }
@@ -682,7 +682,7 @@ free_syncpoint(struct endpoint_drv_ctx_t *eps_ctx,
mutex_lock(&syncpt->lock); mutex_lock(&syncpt->lock);
syncpt->fence_release = true; syncpt->fence_release = true;
if (syncpt->fence) { if (syncpt->fence) {
ret = dma_fence_remove_callback(syncpt->fence, ret = (int)dma_fence_remove_callback(syncpt->fence,
&syncpt->fence_cb); &syncpt->fence_cb);
if (ret) { if (ret) {
/* /*
@@ -994,7 +994,7 @@ create_endpoint_device(struct endpoint_drv_ctx_t *eps_ctx,
endpoint->name); endpoint->name);
if (IS_ERR(endpoint->device)) { if (IS_ERR(endpoint->device)) {
cdev_del(&endpoint->cdev); cdev_del(&endpoint->cdev);
ret = PTR_ERR(endpoint->device); ret = (int)PTR_ERR(endpoint->device);
pr_err("(%s): device_create() failed\n", endpoint->name); pr_err("(%s): device_create() failed\n", endpoint->name);
goto err; goto err;
} }
@@ -1042,7 +1042,7 @@ err:
int int
endpoints_setup(struct driver_ctx_t *drv_ctx, void **endpoints_h) endpoints_setup(struct driver_ctx_t *drv_ctx, void **endpoints_h)
{ {
u32 i = 0; u16 i = 0;
int ret = 0; int ret = 0;
struct endpoint_t *endpoint = NULL; struct endpoint_t *endpoint = NULL;
struct endpoint_prop_t *ep_prop = NULL; struct endpoint_prop_t *ep_prop = NULL;
@@ -1082,7 +1082,7 @@ endpoints_setup(struct driver_ctx_t *drv_ctx, void **endpoints_h)
eps_ctx->class = class_create(THIS_MODULE, eps_ctx->drv_name); eps_ctx->class = class_create(THIS_MODULE, eps_ctx->drv_name);
#endif #endif
if (IS_ERR_OR_NULL(eps_ctx->class)) { if (IS_ERR_OR_NULL(eps_ctx->class)) {
ret = PTR_ERR(eps_ctx->class); ret = (int)PTR_ERR(eps_ctx->class);
goto err; goto err;
} }
@@ -1180,7 +1180,7 @@ endpoints_waitfor_close(void *endpoints_h)
if (atomic_read(&endpoint->in_use)) { if (atomic_read(&endpoint->in_use)) {
if (timeout == -ERESTARTSYS) { if (timeout == -ERESTARTSYS) {
ret = timeout; ret = (int)timeout;
pr_err("(%s): Wait for endpoint:(%s) close - Interrupted\n", pr_err("(%s): Wait for endpoint:(%s) close - Interrupted\n",
eps_ctx->drv_name, endpoint->name); eps_ctx->drv_name, endpoint->name);
} else if (timeout == 0) { } else if (timeout == 0) {

View File

@@ -162,7 +162,7 @@ allocate_link_status_mem(struct pci_client_t *ctx)
if (WARN_ON(!mem->pva)) if (WARN_ON(!mem->pva))
return -ENOMEM; return -ENOMEM;
atomic_set(&ctx->link_status, NVSCIC2C_PCIE_LINK_DOWN); atomic_set(&ctx->link_status, (int)NVSCIC2C_PCIE_LINK_DOWN);
link_mem = ((struct nvscic2c_pcie_link_mem *)mem->pva); link_mem = ((struct nvscic2c_pcie_link_mem *)mem->pva);
link_mem->link_status = NVSCIC2C_PCIE_LINK_DOWN; link_mem->link_status = NVSCIC2C_PCIE_LINK_DOWN;
@@ -670,7 +670,7 @@ pci_client_change_link_status(void *pci_client_h,
* For consistent view of same phys_addr by user-space, flush the update * For consistent view of same phys_addr by user-space, flush the update
* Call is arm64 specific. * Call is arm64 specific.
*/ */
atomic_set(&ctx->link_status, status); atomic_set(&ctx->link_status, (__s32)status);
link_mem = ((struct nvscic2c_pcie_link_mem *)ctx->link_status_mem.pva); link_mem = ((struct nvscic2c_pcie_link_mem *)ctx->link_status_mem.pva);
link_mem->link_status = status; link_mem->link_status = status;
arch_invalidate_pmem(ctx->link_status_mem.pva, ctx->link_status_mem.size); arch_invalidate_pmem(ctx->link_status_mem.pva, ctx->link_status_mem.size);

View File

@@ -374,7 +374,7 @@ ioctl_free_obj(struct stream_ext_ctx_t *ctx,
if (ret) if (ret)
return ret; return ret;
filep = fget(args->handle); filep = fget((__u32)args->handle);
if (filep == NULL) if (filep == NULL)
return -EINVAL; return -EINVAL;
stream_obj = filep->private_data; stream_obj = filep->private_data;
@@ -388,7 +388,7 @@ ioctl_free_obj(struct stream_ext_ctx_t *ctx,
} }
/* this shall close the handle: resulting in fops_release().*/ /* this shall close the handle: resulting in fops_release().*/
close_fd(args->handle); close_fd((__u32)args->handle);
return 0; return 0;
} }
@@ -419,7 +419,7 @@ ioctl_export_obj(struct stream_ext_ctx_t *ctx,
else else
return -EINVAL; return -EINVAL;
filep = fget(args->in.handle); filep = fget((__u32)args->in.handle);
if (!filep) { if (!filep) {
pr_err("filep is NULL\n"); pr_err("filep is NULL\n");
return -EINVAL; return -EINVAL;
@@ -447,7 +447,7 @@ ioctl_export_obj(struct stream_ext_ctx_t *ctx,
/* generate export desc.*/ /* generate export desc.*/
peer = &ctx->peer_node; peer = &ctx->peer_node;
exp_desc = gen_desc(peer->board_id, peer->soc_id, peer->cntrlr_id, exp_desc = gen_desc(peer->board_id, peer->soc_id, peer->cntrlr_id,
ctx->ep_id, export_type, stream_obj->vmap.id); ctx->ep_id, (u32)export_type, stream_obj->vmap.id);
/*share it with peer for peer for corresponding import.*/ /*share it with peer for peer for corresponding import.*/
pr_debug("Exporting descriptor = (%llu)\n", exp_desc); pr_debug("Exporting descriptor = (%llu)\n", exp_desc);
@@ -500,7 +500,7 @@ ioctl_import_obj(struct stream_ext_ctx_t *ctx,
return handle; return handle;
pr_debug("Imported descriptor = (%llu)\n", args->in.desc); pr_debug("Imported descriptor = (%llu)\n", args->in.desc);
filep = fget(handle); filep = fget((__u32)handle);
if (!filep) if (!filep)
return -ENOMEM; return -ENOMEM;
@@ -1132,7 +1132,7 @@ cache_copy_request_handles(struct copy_req_params *params,
cr->num_remote_buf_objs = 0; cr->num_remote_buf_objs = 0;
for (i = 0; i < params->num_local_post_fences; i++) { for (i = 0; i < params->num_local_post_fences; i++) {
handle = params->local_post_fences[i]; handle = params->local_post_fences[i];
filep = fget(handle); filep = fget((__u32)handle);
if (filep == NULL) if (filep == NULL)
return -EINVAL; return -EINVAL;
stream_obj = filep->private_data; stream_obj = filep->private_data;
@@ -1152,7 +1152,7 @@ cache_copy_request_handles(struct copy_req_params *params,
} }
for (i = 0; i < params->num_remote_post_fences; i++) { for (i = 0; i < params->num_remote_post_fences; i++) {
handle = params->remote_post_fences[i]; handle = params->remote_post_fences[i];
filep = fget(handle); filep = fget((__u32)handle);
if (filep == NULL) if (filep == NULL)
return -EINVAL; return -EINVAL;
stream_obj = filep->private_data; stream_obj = filep->private_data;
@@ -1172,7 +1172,7 @@ cache_copy_request_handles(struct copy_req_params *params,
} }
for (i = 0; i < params->num_flush_ranges; i++) { for (i = 0; i < params->num_flush_ranges; i++) {
handle = params->flush_ranges[i].src_handle; handle = params->flush_ranges[i].src_handle;
filep = fget(handle); filep = fget((__u32)handle);
if (filep == NULL) if (filep == NULL)
return -EINVAL; return -EINVAL;
stream_obj = filep->private_data; stream_obj = filep->private_data;
@@ -1185,7 +1185,7 @@ cache_copy_request_handles(struct copy_req_params *params,
fput(filep); fput(filep);
handle = params->flush_ranges[i].dst_handle; handle = params->flush_ranges[i].dst_handle;
filep = fget(handle); filep = fget((__u32)handle);
if (filep == NULL) if (filep == NULL)
return -EINVAL; return -EINVAL;
stream_obj = filep->private_data; stream_obj = filep->private_data;
@@ -1213,7 +1213,7 @@ validate_handle(struct stream_ext_ctx_t *ctx, s32 handle,
{ {
int ret = -EINVAL; int ret = -EINVAL;
struct stream_ext_obj *stream_obj = NULL; struct stream_ext_obj *stream_obj = NULL;
struct file *filep = fget(handle); struct file *filep = fget((__u32)handle);
if (!filep) if (!filep)
goto exit; goto exit;
@@ -1385,25 +1385,25 @@ copy_args_from_user(struct stream_ext_ctx_t *ctx,
params->num_remote_post_fences = args->num_remote_post_fences; params->num_remote_post_fences = args->num_remote_post_fences;
params->num_flush_ranges = args->num_flush_ranges; params->num_flush_ranges = args->num_flush_ranges;
ret = copy_from_user(params->local_post_fences, ret = (int)copy_from_user(params->local_post_fences,
(void __user *)args->local_post_fences, (void __user *)args->local_post_fences,
(params->num_local_post_fences * sizeof(s32))); (params->num_local_post_fences * sizeof(s32)));
if (ret < 0) if (ret < 0)
return -EFAULT; return -EFAULT;
ret = copy_from_user(params->remote_post_fences, ret = (int)copy_from_user(params->remote_post_fences,
(void __user *)args->remote_post_fences, (void __user *)args->remote_post_fences,
(params->num_remote_post_fences * sizeof(s32))); (params->num_remote_post_fences * sizeof(s32)));
if (ret < 0) if (ret < 0)
return -EFAULT; return -EFAULT;
ret = copy_from_user(params->remote_post_fence_values, ret = (int)copy_from_user(params->remote_post_fence_values,
(void __user *)args->remote_post_fence_values, (void __user *)args->remote_post_fence_values,
(params->num_remote_post_fences * sizeof(u64))); (params->num_remote_post_fences * sizeof(u64)));
if (ret < 0) if (ret < 0)
return -EFAULT; return -EFAULT;
ret = copy_from_user(params->flush_ranges, ret = (int)copy_from_user(params->flush_ranges,
(void __user *)args->flush_ranges, (void __user *)args->flush_ranges,
(params->num_flush_ranges * (params->num_flush_ranges *
sizeof(struct nvscic2c_pcie_flush_range))); sizeof(struct nvscic2c_pcie_flush_range)));

View File

@@ -63,13 +63,13 @@ memobj_devmngd_pin(struct vmap_ctx_t *vmap_ctx,
pin->attach = pci_client_dmabuf_attach(vmap_ctx->pci_client_h, pin->attach = pci_client_dmabuf_attach(vmap_ctx->pci_client_h,
pin->dmabuf); pin->dmabuf);
if (IS_ERR_OR_NULL(pin->attach)) { if (IS_ERR_OR_NULL(pin->attach)) {
ret = PTR_ERR(pin->attach); ret = (int)PTR_ERR(pin->attach);
goto err; goto err;
} }
pin->sgt = dma_buf_map_attachment(pin->attach, pin->dir); pin->sgt = dma_buf_map_attachment(pin->attach, pin->dir);
if (IS_ERR_OR_NULL(pin->sgt)) { if (IS_ERR_OR_NULL(pin->sgt)) {
ret = PTR_ERR(pin->sgt); ret = (int)PTR_ERR(pin->sgt);
goto err; goto err;
} }
@@ -157,13 +157,13 @@ memobj_clientmngd_pin(struct vmap_ctx_t *vmap_ctx,
*/ */
pin->attach = dma_buf_attach(pin->dmabuf, &vmap_ctx->dummy_pdev->dev); pin->attach = dma_buf_attach(pin->dmabuf, &vmap_ctx->dummy_pdev->dev);
if (IS_ERR_OR_NULL(pin->attach)) { if (IS_ERR_OR_NULL(pin->attach)) {
ret = PTR_ERR(pin->attach); ret = (int)PTR_ERR(pin->attach);
pr_err("client_mngd dma_buf_attach failed\n"); pr_err("client_mngd dma_buf_attach failed\n");
goto err; goto err;
} }
pin->sgt = dma_buf_map_attachment(pin->attach, pin->dir); pin->sgt = dma_buf_map_attachment(pin->attach, pin->dir);
if (IS_ERR_OR_NULL(pin->sgt)) { if (IS_ERR_OR_NULL(pin->sgt)) {
ret = PTR_ERR(pin->sgt); ret = (int)PTR_ERR(pin->sgt);
pr_err("client_mngd dma_buf_attachment failed\n"); pr_err("client_mngd dma_buf_attachment failed\n");
goto err; goto err;
} }
@@ -355,7 +355,7 @@ syncobj_pin(struct vmap_ctx_t *vmap_ctx,
*/ */
pin->sp = tegra_drm_get_syncpt(pin->fd, pin->syncpt_id); pin->sp = tegra_drm_get_syncpt(pin->fd, pin->syncpt_id);
if (IS_ERR_OR_NULL(pin->sp)) { if (IS_ERR_OR_NULL(pin->sp)) {
ret = PTR_ERR(pin->sp); ret = (int)PTR_ERR(pin->sp);
pr_err("Failed to get syncpoint from id\n"); pr_err("Failed to get syncpoint from id\n");
goto err; goto err;
} }

View File

@@ -85,13 +85,13 @@ static int dma_mem_get_size(struct vmap_ctx_t *vmap_ctx, struct memobj_pin_t *pi
*/ */
pin->attach = dma_buf_attach(pin->dmabuf, &vmap_ctx->dummy_pdev->dev); pin->attach = dma_buf_attach(pin->dmabuf, &vmap_ctx->dummy_pdev->dev);
if (IS_ERR_OR_NULL(pin->attach)) { if (IS_ERR_OR_NULL(pin->attach)) {
ret = PTR_ERR(pin->attach); ret = (int)PTR_ERR(pin->attach);
pr_err("client_mngd dma_buf_attach failed\n"); pr_err("client_mngd dma_buf_attach failed\n");
goto fn_exit; goto fn_exit;
} }
pin->sgt = dma_buf_map_attachment(pin->attach, pin->dir); pin->sgt = dma_buf_map_attachment(pin->attach, pin->dir);
if (IS_ERR_OR_NULL(pin->sgt)) { if (IS_ERR_OR_NULL(pin->sgt)) {
ret = PTR_ERR(pin->sgt); ret = (int)PTR_ERR(pin->sgt);
pr_err("client_mngd dma_buf_attachment failed\n"); pr_err("client_mngd dma_buf_attachment failed\n");
goto fn_exit; goto fn_exit;
} }
@@ -130,7 +130,7 @@ memobj_map(struct vmap_ctx_t *vmap_ctx,
/* check if the dma_buf is already mapped ? */ /* check if the dma_buf is already mapped ? */
id_exist = idr_for_each(&vmap_ctx->mem_idr, match_dmabuf, &dmabuf); id_exist = idr_for_each(&vmap_ctx->mem_idr, match_dmabuf, &dmabuf);
if (id_exist > 0) if (id_exist > 0)
map = idr_find(&vmap_ctx->mem_idr, id_exist); map = idr_find(&vmap_ctx->mem_idr, (unsigned long)id_exist);
if (map) { if (map) {
/* already mapped.*/ /* already mapped.*/
@@ -175,14 +175,14 @@ memobj_map(struct vmap_ctx_t *vmap_ctx,
ret = dma_mem_get_size(vmap_ctx, &map->pin, &map_size); ret = dma_mem_get_size(vmap_ctx, &map->pin, &map_size);
if (ret != 0) { if (ret != 0) {
pr_err("Failed in dma buf mem get size\n"); pr_err("Failed in dma buf mem get size\n");
idr_remove(&vmap_ctx->mem_idr, map->obj_id); idr_remove(&vmap_ctx->mem_idr, (unsigned long)map->obj_id);
kfree(map); kfree(map);
goto err; goto err;
} }
ret = dev_map_limit_check(aperture_limit, *aperture_inuse, map_size); ret = dev_map_limit_check(aperture_limit, *aperture_inuse, map_size);
if (ret != 0) { if (ret != 0) {
pr_err("Failed in aperture limit check\n"); pr_err("Failed in aperture limit check\n");
idr_remove(&vmap_ctx->mem_idr, map->obj_id); idr_remove(&vmap_ctx->mem_idr, (unsigned long)map->obj_id);
kfree(map); kfree(map);
goto err; goto err;
} }
@@ -192,7 +192,7 @@ memobj_map(struct vmap_ctx_t *vmap_ctx,
ret = memobj_pin(vmap_ctx, &map->pin); ret = memobj_pin(vmap_ctx, &map->pin);
if (ret) { if (ret) {
pr_err("Failed to pin mem obj fd: (%d)\n", params->fd); pr_err("Failed to pin mem obj fd: (%d)\n", params->fd);
idr_remove(&vmap_ctx->mem_idr, map->obj_id); idr_remove(&vmap_ctx->mem_idr, (unsigned long)map->obj_id);
kfree(map); kfree(map);
goto err; goto err;
} }
@@ -223,7 +223,7 @@ memobj_free(struct kref *kref)
map = container_of(kref, struct memobj_map_ref, refcount); map = container_of(kref, struct memobj_map_ref, refcount);
if (map) { if (map) {
memobj_unpin(map->vmap_ctx, &map->pin); memobj_unpin(map->vmap_ctx, &map->pin);
idr_remove(&map->vmap_ctx->mem_idr, map->obj_id); idr_remove(&map->vmap_ctx->mem_idr, (unsigned long)map->obj_id);
kfree(map); kfree(map);
} }
} }
@@ -234,7 +234,7 @@ memobj_unmap(struct vmap_ctx_t *vmap_ctx, s32 obj_id)
struct memobj_map_ref *map = NULL; struct memobj_map_ref *map = NULL;
mutex_lock(&vmap_ctx->mem_idr_lock); mutex_lock(&vmap_ctx->mem_idr_lock);
map = idr_find(&vmap_ctx->mem_idr, obj_id); map = idr_find(&vmap_ctx->mem_idr, (unsigned long)obj_id);
if (!map) { if (!map) {
mutex_unlock(&vmap_ctx->mem_idr_lock); mutex_unlock(&vmap_ctx->mem_idr_lock);
return -EBADF; return -EBADF;
@@ -258,7 +258,7 @@ memobj_getref(struct vmap_ctx_t *vmap_ctx, s32 obj_id)
struct memobj_map_ref *map = NULL; struct memobj_map_ref *map = NULL;
mutex_lock(&vmap_ctx->mem_idr_lock); mutex_lock(&vmap_ctx->mem_idr_lock);
map = idr_find(&vmap_ctx->mem_idr, obj_id); map = idr_find(&vmap_ctx->mem_idr, (unsigned long)obj_id);
if (WARN_ON(!map)) { if (WARN_ON(!map)) {
mutex_unlock(&vmap_ctx->mem_idr_lock); mutex_unlock(&vmap_ctx->mem_idr_lock);
return -EBADF; return -EBADF;
@@ -301,7 +301,7 @@ syncobj_map(struct vmap_ctx_t *vmap_ctx,
id_exist = idr_for_each(&vmap_ctx->sync_idr, match_syncpt_id, id_exist = idr_for_each(&vmap_ctx->sync_idr, match_syncpt_id,
&syncpt_id); &syncpt_id);
if (id_exist > 0) if (id_exist > 0)
map = idr_find(&vmap_ctx->sync_idr, id_exist); map = idr_find(&vmap_ctx->sync_idr, (unsigned long)id_exist);
if (map) { if (map) {
/* mapping again a SYNC obj(local or remote) is not permitted.*/ /* mapping again a SYNC obj(local or remote) is not permitted.*/
@@ -330,7 +330,7 @@ syncobj_map(struct vmap_ctx_t *vmap_ctx,
ret = dev_map_limit_check(aperture_limit, *aperture_inuse, SP_MAP_SIZE); ret = dev_map_limit_check(aperture_limit, *aperture_inuse, SP_MAP_SIZE);
if (ret != 0) { if (ret != 0) {
pr_err("Failed in aperture limit check\n"); pr_err("Failed in aperture limit check\n");
idr_remove(&vmap_ctx->sync_idr, map->obj_id); idr_remove(&vmap_ctx->sync_idr, (unsigned long)map->obj_id);
kfree(map); kfree(map);
goto err; goto err;
} }
@@ -346,7 +346,7 @@ syncobj_map(struct vmap_ctx_t *vmap_ctx,
if (ret) { if (ret) {
pr_err("Failed to pin sync obj Id: (%d)\n", pr_err("Failed to pin sync obj Id: (%d)\n",
syncpt_id); syncpt_id);
idr_remove(&vmap_ctx->sync_idr, map->obj_id); idr_remove(&vmap_ctx->sync_idr, (unsigned long)map->obj_id);
kfree(map); kfree(map);
goto err; goto err;
} }
@@ -378,7 +378,7 @@ syncobj_free(struct kref *kref)
map = container_of(kref, struct syncobj_map_ref, refcount); map = container_of(kref, struct syncobj_map_ref, refcount);
if (map) { if (map) {
syncobj_unpin(map->vmap_ctx, &map->pin); syncobj_unpin(map->vmap_ctx, &map->pin);
idr_remove(&map->vmap_ctx->sync_idr, map->obj_id); idr_remove(&map->vmap_ctx->sync_idr, (unsigned long)map->obj_id);
kfree(map); kfree(map);
} }
} }
@@ -389,7 +389,7 @@ syncobj_unmap(struct vmap_ctx_t *vmap_ctx, s32 obj_id)
struct syncobj_map_ref *map = NULL; struct syncobj_map_ref *map = NULL;
mutex_lock(&vmap_ctx->sync_idr_lock); mutex_lock(&vmap_ctx->sync_idr_lock);
map = idr_find(&vmap_ctx->sync_idr, obj_id); map = idr_find(&vmap_ctx->sync_idr, (unsigned long)obj_id);
if (!map) { if (!map) {
mutex_unlock(&vmap_ctx->sync_idr_lock); mutex_unlock(&vmap_ctx->sync_idr_lock);
return -EBADF; return -EBADF;
@@ -416,7 +416,7 @@ syncobj_getref(struct vmap_ctx_t *vmap_ctx, s32 obj_id)
return -EINVAL; return -EINVAL;
mutex_lock(&vmap_ctx->sync_idr_lock); mutex_lock(&vmap_ctx->sync_idr_lock);
map = idr_find(&vmap_ctx->sync_idr, obj_id); map = idr_find(&vmap_ctx->sync_idr, (unsigned long)obj_id);
if (WARN_ON(!map)) { if (WARN_ON(!map)) {
mutex_unlock(&vmap_ctx->sync_idr_lock); mutex_unlock(&vmap_ctx->sync_idr_lock);
return -EBADF; return -EBADF;
@@ -455,7 +455,7 @@ importobj_map(struct vmap_ctx_t *vmap_ctx,
id_exist = idr_for_each(&vmap_ctx->import_idr, match_export_desc, id_exist = idr_for_each(&vmap_ctx->import_idr, match_export_desc,
&params->export_desc); &params->export_desc);
if (id_exist > 0) if (id_exist > 0)
map = idr_find(&vmap_ctx->import_idr, id_exist); map = idr_find(&vmap_ctx->import_idr, (unsigned long)id_exist);
if (!map) { if (!map) {
ret = -EAGAIN; ret = -EAGAIN;
@@ -493,7 +493,7 @@ importobj_free(struct kref *kref)
map = container_of(kref, struct importobj_map_ref, refcount); map = container_of(kref, struct importobj_map_ref, refcount);
if (map) { if (map) {
idr_remove(&map->vmap_ctx->import_idr, map->obj_id); idr_remove(&map->vmap_ctx->import_idr, (unsigned long)map->obj_id);
kfree(map); kfree(map);
} }
} }
@@ -506,7 +506,7 @@ importobj_unmap(struct vmap_ctx_t *vmap_ctx, s32 obj_id)
mutex_lock(&vmap_ctx->import_idr_lock); mutex_lock(&vmap_ctx->import_idr_lock);
map = idr_find(&vmap_ctx->import_idr, obj_id); map = idr_find(&vmap_ctx->import_idr, (unsigned long)obj_id);
if (!map) { if (!map) {
mutex_unlock(&vmap_ctx->import_idr_lock); mutex_unlock(&vmap_ctx->import_idr_lock);
return -EINVAL; return -EINVAL;
@@ -547,7 +547,7 @@ importobj_getref(struct vmap_ctx_t *vmap_ctx, s32 obj_id)
struct memobj_map_ref *map = NULL; struct memobj_map_ref *map = NULL;
mutex_lock(&vmap_ctx->import_idr_lock); mutex_lock(&vmap_ctx->import_idr_lock);
map = idr_find(&vmap_ctx->import_idr, obj_id); map = idr_find(&vmap_ctx->import_idr, (unsigned long)obj_id);
if (WARN_ON(!map)) { if (WARN_ON(!map)) {
mutex_unlock(&vmap_ctx->import_idr_lock); mutex_unlock(&vmap_ctx->import_idr_lock);
return -EBADF; return -EBADF;
@@ -688,10 +688,10 @@ vmap_importobj_unregister(void *data, void *ctx)
pr_debug("Unregister Desc: (%llu)\n", desc.value); pr_debug("Unregister Desc: (%llu)\n", desc.value);
if (desc.bit.handle_type == STREAM_OBJ_TYPE_MEM) if (desc.bit.handle_type == STREAM_OBJ_TYPE_MEM)
vmap_obj_putref(vmap_ctx, VMAP_OBJ_TYPE_MEM, vmap_obj_putref(vmap_ctx, VMAP_OBJ_TYPE_MEM,
desc.bit.handle_id); (s32)desc.bit.handle_id);
else else
vmap_obj_putref(vmap_ctx, VMAP_OBJ_TYPE_SYNC, vmap_obj_putref(vmap_ctx, VMAP_OBJ_TYPE_SYNC,
desc.bit.handle_id); (s32)desc.bit.handle_id);
} }
static void static void
@@ -712,7 +712,7 @@ vmap_importobj_register(void *data, void *ctx)
id_exist = idr_for_each(&vmap_ctx->import_idr, match_export_desc, id_exist = idr_for_each(&vmap_ctx->import_idr, match_export_desc,
&msg->u.reg.export_desc); &msg->u.reg.export_desc);
if (id_exist > 0) if (id_exist > 0)
map = idr_find(&vmap_ctx->import_idr, id_exist); map = idr_find(&vmap_ctx->import_idr, (unsigned long)id_exist);
if (map) { if (map) {
if (msg->u.reg.iova != map->reg.attrib.iova) { if (msg->u.reg.iova != map->reg.attrib.iova) {