summaryrefslogtreecommitdiffstats
path: root/drivers/staging/vc04_services
diff options
context:
space:
mode:
authorMichael Zoran <mzoran@crowfest.net>2016-10-19 15:58:48 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2016-10-24 15:21:27 +0200
commit8e8e2e36f77ab074016f79ac63b7255f645da3ed (patch)
tree66d97d808ad006ac104d6bc7293858565d961559 /drivers/staging/vc04_services
parent24a4262afb10907fce3cdbc3ae336fcf4cdaece5 (diff)
downloadop-kernel-dev-8e8e2e36f77ab074016f79ac63b7255f645da3ed.zip
op-kernel-dev-8e8e2e36f77ab074016f79ac63b7255f645da3ed.tar.gz
staging: vc04_services: Handle conversion from VCHIQ_SERVICE_HANDLE_T to VCHI_SERVICE_HANDLE_T
A VCHIQ_SERVICE_HANDLE_T which is an int is stuffed into a VCHI_SERVICE_HANDLE_T which is a pointer, passed around, then converted back to a VCHIQ_SERVICE_HANDLE_T. Since the data is always actually a VCHIQ_SERVICE_HANDLE_T(int), never actually a pointer, it is safe to simply cast the two back in forth. Note that pointers are never stuffed into an int. Signed-off-by: Michael Zoran <mzoran@crowfest.net> Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/vc04_services')
-rw-r--r--drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
index 8072ff6..49f9d6a 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
@@ -400,8 +400,16 @@ EXPORT_SYMBOL(vchi_msg_queuev);
***********************************************************/
int32_t vchi_held_msg_release(VCHI_HELD_MSG_T *message)
{
- vchiq_release_message((VCHIQ_SERVICE_HANDLE_T)message->service,
- (VCHIQ_HEADER_T *)message->message);
+ /*
+ * Convert the service field pointer back to an
+ * VCHIQ_SERVICE_HANDLE_T which is an int.
+ * This pointer is opaque to everything except
+ * vchi_msg_hold which simply upcasted the int
+ * to a pointer.
+ */
+
+ vchiq_release_message((VCHIQ_SERVICE_HANDLE_T)(long)message->service,
+ (VCHIQ_HEADER_T *)message->message);
return 0;
}
@@ -445,8 +453,16 @@ int32_t vchi_msg_hold(VCHI_SERVICE_HANDLE_T handle,
*data = header->data;
*msg_size = header->size;
+ /*
+ * upcast the VCHIQ_SERVICE_HANDLE_T which is an int
+ * to a pointer and stuff it in the held message.
+ * This pointer is opaque to everything except
+ * vchi_held_msg_release which simply downcasts it back
+ * to an int.
+ */
+
message_handle->service =
- (struct opaque_vchi_service_t *)service->handle;
+ (struct opaque_vchi_service_t *)(long)service->handle;
message_handle->message = header;
return 0;
OpenPOWER on IntegriCloud