@@ -54,10 +54,7 @@ extern int vchi_queue_kernel_message(unsigned handle, void *data,
// Routine to look at a message in place.
// The message is dequeued, so the caller is left holding it; the descriptor is
// filled in and must be released when the user has finished with the message.
-extern int32_t vchi_msg_hold(unsigned handle,
- void **data, // } may be NULL, as info can be
- uint32_t *msg_size, // } obtained from HELD_MSG_T
- struct vchiq_header **message);
+struct vchiq_header *vchi_msg_hold(unsigned handle);
/*******************************************************************************
* Global service support API - operations on held messages
@@ -154,20 +154,9 @@ EXPORT_SYMBOL(vchi_held_msg_release);
* Returns: int32_t - success == 0
*
***********************************************************/
-int32_t vchi_msg_hold(unsigned handle, void **data, uint32_t *msg_size,
- struct vchiq_header **message)
+struct vchiq_header *vchi_msg_hold(unsigned handle)
{
- struct vchiq_header *header;
-
- header = vchiq_msg_hold(handle);
- if (!header)
- return -ENOENT;
-
- *data = header->data;
- *msg_size = header->size;
- *message = header;
-
- return 0;
+ return vchiq_msg_hold(handle);
}
EXPORT_SYMBOL(vchi_msg_hold);
@@ -233,8 +233,13 @@ static int vc_sm_cma_vchi_videocore_io(void *arg)
} while (1);
- while (!vchi_msg_hold(instance->service_handle,
- (void **)&reply, &reply_len, &message)) {
+ while (1) {
+ message = vchi_msg_hold(instance->service_handle);
+ if (!message)
+ break;
+ reply = (struct vc_sm_result_t *)message->data;
+ reply_len = message->size;
+
if (reply->trans_id & 0x80000000) {
/* Async event or cmd from the VPU */
if (instance->vpu_event)
The services have access to struct vchiq_header's internals, so we can let them get the data pointer. This pretty much makes both functions exactly the same, which will allow us to make a switch to vchiq_msg_hold() further down the road. Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de> --- .../staging/vc04_services/interface/vchi/vchi.h | 5 +---- .../interface/vchiq_arm/vchiq_shim.c | 15 ++------------- .../vc04_services/vc-sm-cma/vc_sm_cma_vchi.c | 9 +++++++-- 3 files changed, 10 insertions(+), 19 deletions(-)