diff options
author | Subramaniam C.A <subramaniam.ca@ti.com> | 2012-01-18 17:45:48 -0600 |
---|---|---|
committer | Andy Green <andy.green@linaro.org> | 2012-03-13 11:20:26 +0800 |
commit | 85ab2cb55495014e57dfdce84f5541a144f62f17 (patch) | |
tree | 02303fa837d0852bb858d33899f30b15b69bda48 | |
parent | 2c7b52ba3100f67b67f769134b3cefc4aa6ee9d8 (diff) |
rpmsg: omx: add return values to the pa to da convert function
This patch adds return values to the pa to da conversion function.
This will help in propagation of proper error codes to the calling
functions.
Change-Id: Ie547f7b7e7c51eff4b7998cbd336a61663995708
Signed-off-by: Subramaniam C.A <subramaniam.ca@ti.com>
Signed-off-by: Suman Anna <s-anna@ti.com>
-rw-r--r-- | drivers/rpmsg/rpmsg_omx.c | 45 |
1 files changed, 21 insertions, 24 deletions
diff --git a/drivers/rpmsg/rpmsg_omx.c b/drivers/rpmsg/rpmsg_omx.c index 3c66d9d2650..e423cf9ef35 100644 --- a/drivers/rpmsg/rpmsg_omx.c +++ b/drivers/rpmsg/rpmsg_omx.c @@ -114,26 +114,29 @@ static LIST_HEAD(rpmsg_omx_services_list); #define ION_1D_START 0xBA300000 #define ION_1D_END 0xBFD00000 #define ION_1D_VA 0x88000000 -static u32 _rpmsg_pa_to_da(u32 pa) +static int _rpmsg_pa_to_da(u32 pa, u32 *da) { + int ret = 0; + if (pa >= TILER_START && pa < TILER_END) - return pa; + *da = pa; else if (pa >= ION_1D_START && pa < ION_1D_END) - return (pa - ION_1D_START + ION_1D_VA); + *da = (pa - ION_1D_START + ION_1D_VA); else - return 0; + ret = -EIO; + + return ret; } -static u32 _rpmsg_omx_buffer_lookup(struct rpmsg_omx_instance *omx, long buffer) +static int _rpmsg_omx_buffer_lookup(struct rpmsg_omx_instance *omx, + long buffer, u32 *va) { phys_addr_t pa; - u32 va; - + int ret; #ifdef CONFIG_ION_OMAP struct ion_handle *handle; ion_phys_addr_t paddr; size_t unused; - int fd; /* is it an ion handle? */ handle = (struct ion_handle *)buffer; @@ -145,7 +148,9 @@ static u32 _rpmsg_omx_buffer_lookup(struct rpmsg_omx_instance *omx, long buffer) #ifdef CONFIG_PVR_SGX /* how about an sgx buffer wrapping an ion handle? */ { + int fd; struct ion_client *pvr_ion_client; + fd = buffer; handle = PVRSRVExportFDToIONHandle(fd, &pvr_ion_client); if (handle && @@ -161,8 +166,8 @@ static u32 _rpmsg_omx_buffer_lookup(struct rpmsg_omx_instance *omx, long buffer) #ifdef CONFIG_ION_OMAP to_va: #endif - va = _rpmsg_pa_to_da(pa); - return va; + ret = _rpmsg_pa_to_da(pa, va); + return ret; } static int _rpmsg_omx_map_buf(struct rpmsg_omx_instance *omx, char *packet) @@ -187,33 +192,25 @@ static int _rpmsg_omx_map_buf(struct rpmsg_omx_instance *omx, char *packet) offset = *(int *)((int)data + sizeof(maptype)); buffer = (long *)((int)data + offset); - da = _rpmsg_omx_buffer_lookup(omx, *buffer); - if (da) { + ret = _rpmsg_omx_buffer_lookup(omx, *buffer, &da); + if (!ret) *buffer = da; - ret = 0; - } if (!ret && (maptype >= RPC_OMX_MAP_INFO_TWO_BUF)) { buffer = (long *)((int)data + offset + sizeof(*buffer)); if (*buffer != 0) { - ret = -EIO; - da = _rpmsg_omx_buffer_lookup(omx, *buffer); - if (da) { + ret = _rpmsg_omx_buffer_lookup(omx, *buffer, &da); + if (!ret) *buffer = da; - ret = 0; - } } } if (!ret && maptype >= RPC_OMX_MAP_INFO_THREE_BUF) { buffer = (long *)((int)data + offset + 2*sizeof(*buffer)); if (*buffer != 0) { - ret = -EIO; - da = _rpmsg_omx_buffer_lookup(omx, *buffer); - if (da) { + ret = _rpmsg_omx_buffer_lookup(omx, *buffer, &da); + if (!ret) *buffer = da; - ret = 0; - } } } return ret; |