diff options
author | 2020-05-27 13:53:08 +0200 | |
---|---|---|
committer | 2020-05-27 14:03:35 +0200 | |
commit | a224f284d03b707a1f6f4aea279a4fecbd61246a (patch) | |
tree | 1037ed5b76ba615c5b421cd2f54426c1fb655ce7 /drivers/staging | |
parent | staging: vchi: Get rid of vchi_queue_user_message() (diff) | |
download | linux-a224f284d03b707a1f6f4aea279a4fecbd61246a.tar.gz linux-a224f284d03b707a1f6f4aea279a4fecbd61246a.tar.bz2 linux-a224f284d03b707a1f6f4aea279a4fecbd61246a.zip |
staging: vchiq: Move copy callback handling into vchiq
All vchi users use the kernel variant of the copy callback. The only
user for the user space variant of the copy callback is in the ioctl
implementation. So move all this copying logic into vchiq, and expose a
new function that explicitly passes kernel messages.
Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de>
Link: https://lore.kernel.org/r/20200527115400.31391-4-nsaenzjulienne@suse.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging')
4 files changed, 22 insertions, 33 deletions
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c index edcd97373809..67b2090c91db 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -3147,6 +3147,12 @@ error_exit: return status; } +enum vchiq_status vchiq_queue_kernel_message(unsigned int handle, void *context, + size_t size) +{ + return vchiq_queue_message(handle, memcpy_copy_callback, context, size); +} + void vchiq_release_message(unsigned int handle, struct vchiq_header *header) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h index cedd8e721aae..1fe6cd8b86c0 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h @@ -587,6 +587,13 @@ lock_service(struct vchiq_service *service); extern void unlock_service(struct vchiq_service *service); +extern enum vchiq_status +vchiq_queue_message(unsigned int handle, + ssize_t (*copy_callback)(void *context, void *dest, + size_t offset, size_t maxsize), + void *context, + size_t size); + /* The following functions are called from vchiq_core, and external ** implementations must be provided. */ diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h index 39b77ea19210..b62fd6d6f1ac 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_if.h @@ -105,12 +105,8 @@ extern enum vchiq_status vchiq_close_service(unsigned int service); extern enum vchiq_status vchiq_remove_service(unsigned int service); extern enum vchiq_status vchiq_use_service(unsigned int service); extern enum vchiq_status vchiq_release_service(unsigned int service); -extern enum vchiq_status -vchiq_queue_message(unsigned int handle, - ssize_t (*copy_callback)(void *context, void *dest, - size_t offset, size_t maxsize), - void *context, - size_t size); +extern enum vchiq_status vchiq_queue_kernel_message(unsigned int handle, + void *context, size_t size); extern void vchiq_release_message(unsigned int service, struct vchiq_header *header); extern enum vchiq_status vchiq_bulk_transmit(unsigned int service, 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 2c2bd7a9dc27..1c5ddea8b076 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c @@ -99,20 +99,15 @@ EXPORT_SYMBOL(vchi_msg_remove); * ***********************************************************/ static -int32_t vchi_msg_queue(struct vchi_service_handle *handle, - ssize_t (*copy_callback)(void *context, void *dest, - size_t offset, size_t maxsize), - void *context, - uint32_t data_size) +int32_t vchi_msg_queue(struct vchi_service_handle *handle, void *context, + uint32_t data_size) { struct shim_service *service = (struct shim_service *)handle; enum vchiq_status status; while (1) { - status = vchiq_queue_message(service->handle, - copy_callback, - context, - data_size); + status = vchiq_queue_kernel_message(service->handle, context, + data_size); /* * vchiq_queue_message() may return VCHIQ_RETRY, so we need to @@ -128,25 +123,10 @@ int32_t vchi_msg_queue(struct vchi_service_handle *handle, return vchiq_status_to_vchi(status); } -static ssize_t -vchi_queue_kernel_message_callback(void *context, - void *dest, - size_t offset, - size_t maxsize) +int vchi_queue_kernel_message(struct vchi_service_handle *handle, void *data, + unsigned int size) { - memcpy(dest, context + offset, maxsize); - return maxsize; -} - -int -vchi_queue_kernel_message(struct vchi_service_handle *handle, - void *data, - unsigned int size) -{ - return vchi_msg_queue(handle, - vchi_queue_kernel_message_callback, - data, - size); + return vchi_msg_queue(handle, data, size); } EXPORT_SYMBOL(vchi_queue_kernel_message); |