Merge "msm: camera: Find and return mapped fd's from the list"
This commit is contained in:
commit
8ddeb3ad18
1 changed files with 22 additions and 2 deletions
|
@ -1,4 +1,4 @@
|
|||
/* Copyright (c) 2014-2016, The Linux Foundation. All rights reserved.
|
||||
/* Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License version 2 and
|
||||
|
@ -1212,6 +1212,25 @@ static enum cam_smmu_buf_state cam_smmu_check_fd_in_list(int idx,
|
|||
return CAM_SMMU_BUFF_NOT_EXIST;
|
||||
}
|
||||
|
||||
static enum cam_smmu_buf_state cam_smmu_check_secure_fd_in_list(int idx,
|
||||
int ion_fd, dma_addr_t *paddr_ptr,
|
||||
size_t *len_ptr)
|
||||
{
|
||||
struct cam_sec_buff_info *mapping;
|
||||
|
||||
list_for_each_entry(mapping,
|
||||
&iommu_cb_set.cb_info[idx].smmu_buf_list,
|
||||
list) {
|
||||
if (mapping->ion_fd == ion_fd) {
|
||||
mapping->ref_count++;
|
||||
*paddr_ptr = mapping->paddr;
|
||||
*len_ptr = mapping->len;
|
||||
return CAM_SMMU_BUFF_EXIST;
|
||||
}
|
||||
}
|
||||
return CAM_SMMU_BUFF_NOT_EXIST;
|
||||
}
|
||||
|
||||
int cam_smmu_get_handle(char *identifier, int *handle_ptr)
|
||||
{
|
||||
int ret = 0;
|
||||
|
@ -1935,7 +1954,8 @@ int cam_smmu_get_stage2_phy_addr(int handle,
|
|||
goto get_addr_end;
|
||||
}
|
||||
|
||||
buf_state = cam_smmu_check_fd_in_list(idx, ion_fd, paddr_ptr, len_ptr);
|
||||
buf_state = cam_smmu_check_secure_fd_in_list(idx, ion_fd, paddr_ptr,
|
||||
len_ptr);
|
||||
if (buf_state == CAM_SMMU_BUFF_EXIST) {
|
||||
CDBG("ion_fd:%d already in the list, give same addr back",
|
||||
ion_fd);
|
||||
|
|
Loading…
Add table
Reference in a new issue