From: Michael Zoran Date: Mon, 30 Jan 2017 07:31:09 +0000 (-0800) Subject: staging: vc04_services: Add vchi_queue_kernel_message function X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=fbcaed9e324de3c17fd57f8c8e65069c4e1eab8f;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git staging: vc04_services: Add vchi_queue_kernel_message function The vchi_msg_queue function which is used by other drivers to queue a message is difficult to understand and overly generic. Add a new function which is a wrapper on top of vchi_msg_queue that is specifically for queuing a message located in kernel address space. int vchi_queue_kernel_message(VCHI_SERVICE_HANDLE_T handle, void *data, unsigned int size) Signed-off-by: Michael Zoran Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h b/drivers/staging/vc04_services/interface/vchi/vchi.h index 44169d6c5a36..7ab74f76f2f8 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi.h @@ -227,6 +227,12 @@ extern int32_t void *context, uint32_t data_size); +/* Routine to send a message from kernel memory across a service */ +extern int +vchi_queue_kernel_message(VCHI_SERVICE_HANDLE_T handle, + void *data, + unsigned int size); + // Routine to receive a msg from a service // Dequeue is equivalent to hold, copy into client buffer, release extern int32_t vchi_msg_dequeue( VCHI_SERVICE_HANDLE_T handle, 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 a6b2ae0c9bea..26edd6e69dcd 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c @@ -188,6 +188,28 @@ int32_t vchi_msg_queue(VCHI_SERVICE_HANDLE_T handle, } EXPORT_SYMBOL(vchi_msg_queue); +static ssize_t +vchi_queue_kernel_message_callback(void *context, + void *dest, + size_t offset, + size_t maxsize) +{ + memcpy(dest, context + offset, maxsize); + return maxsize; +} + +int +vchi_queue_kernel_message(VCHI_SERVICE_HANDLE_T handle, + void *data, + unsigned int size) +{ + return vchi_msg_queue(handle, + vchi_queue_kernel_message_callback, + data, + size); +} +EXPORT_SYMBOL(vchi_queue_kernel_message); + /*********************************************************** * Name: vchi_bulk_queue_receive *