aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/staging/vc04_services/interface
diff options
context:
space:
mode:
authorNicolas Saenz Julienne <nsaenzjulienne@suse.de>2020-06-29 17:09:26 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-07-01 15:47:06 +0200
commit3c5da06f9969959f5cd85e8baaef9d96059b3924 (patch)
tree2ceeb778b5ced64cab7d5d07e1c57d7316d4dc57 /drivers/staging/vc04_services/interface
parentstaging: vchiq: Export vchiq_msg_queue_push (diff)
downloadwireguard-linux-3c5da06f9969959f5cd85e8baaef9d96059b3924.tar.xz
wireguard-linux-3c5da06f9969959f5cd85e8baaef9d96059b3924.zip
staging: vchi: Get rid of vchiq_shim's message callback
As vchiq_shim's callback does nothing aside from pushing messages into the service's queue, let's bypass it and jump directly to the service's callbacks, letting them choose whether to use the message queue. It turns out most services don't need to use the message queue, which makes for simpler code in the end. Signed-off-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de> Link: https://lore.kernel.org/r/20200629150945.10720-29-nsaenzjulienne@suse.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/vc04_services/interface')
-rw-r--r--drivers/staging/vc04_services/interface/vchi/vchi.h9
-rw-r--r--drivers/staging/vc04_services/interface/vchi/vchi_common.h12
-rw-r--r--drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c42
3 files changed, 11 insertions, 52 deletions
diff --git a/drivers/staging/vc04_services/interface/vchi/vchi.h b/drivers/staging/vc04_services/interface/vchi/vchi.h
index 789acb7999d1..fdc243f3f60a 100644
--- a/drivers/staging/vc04_services/interface/vchi/vchi.h
+++ b/drivers/staging/vc04_services/interface/vchi/vchi.h
@@ -4,8 +4,6 @@
#ifndef VCHI_H_
#define VCHI_H_
-#include "vchi_common.h"
-
/******************************************************************************
* Global defs
*****************************************************************************/
@@ -31,16 +29,13 @@ struct vchi_held_msg {
struct vchi_service {
unsigned int handle;
-
- vchi_callback callback;
- void *callback_param;
};
// structure used to provide the information needed to open a server or a client
struct service_creation {
struct vchi_version version;
int32_t service_id;
- vchi_callback callback;
+ vchiq_callback callback;
void *callback_param;
};
@@ -88,7 +83,7 @@ extern int vchi_queue_kernel_message(struct vchi_service *service, 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(struct vchi_service *service,
+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 vchi_held_msg *message_descriptor);
diff --git a/drivers/staging/vc04_services/interface/vchi/vchi_common.h b/drivers/staging/vc04_services/interface/vchi/vchi_common.h
deleted file mode 100644
index 24e8665e214a..000000000000
--- a/drivers/staging/vc04_services/interface/vchi/vchi_common.h
+++ /dev/null
@@ -1,12 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */
-/* Copyright (c) 2010-2012 Broadcom. All rights reserved. */
-
-#ifndef VCHI_COMMON_H_
-#define VCHI_COMMON_H_
-
-//Callback used by all services / bulk transfers
-typedef void (*vchi_callback)(void *callback_param, //my service local param
- enum vchiq_reason reason,
- void *handle); //for transmitting msg's only
-
-#endif // VCHI_COMMON_H_
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 bec78f0ff44b..fb9fd5fec42c 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_shim.c
@@ -158,12 +158,12 @@ EXPORT_SYMBOL(vchi_held_msg_release);
* Returns: int32_t - success == 0
*
***********************************************************/
-int32_t vchi_msg_hold(struct vchi_service *service, void **data,
- uint32_t *msg_size, struct vchi_held_msg *message_handle)
+int32_t vchi_msg_hold(unsigned handle, void **data, uint32_t *msg_size,
+ struct vchi_held_msg *message_handle)
{
struct vchiq_header *header;
- header = vchiq_msg_hold(service->handle);
+ header = vchiq_msg_hold(handle);
if (!header)
return -ENOENT;
@@ -179,7 +179,7 @@ int32_t vchi_msg_hold(struct vchi_service *service, void **data,
*/
message_handle->service =
- (struct opaque_vchi_service_t *)(long)service->handle;
+ (struct opaque_vchi_service_t *)(long)handle;
message_handle->message = header;
return 0;
@@ -253,33 +253,9 @@ EXPORT_SYMBOL(vchi_disconnect);
*
***********************************************************/
-static enum vchiq_status shim_callback(enum vchiq_reason reason,
- struct vchiq_header *header,
- unsigned int handle,
- void *bulk_user)
+static struct vchi_service *service_alloc(void)
{
- struct vchi_service *service =
- (struct vchi_service *)VCHIQ_GET_SERVICE_USERDATA(handle);
-
- if (reason == VCHIQ_MESSAGE_AVAILABLE)
- vchiq_msg_queue_push(service->handle, header);
-
- service->callback(service->callback_param, reason, bulk_user);
-
- return VCHIQ_SUCCESS;
-}
-
-static struct vchi_service *service_alloc(struct vchiq_instance *instance,
- struct service_creation *setup)
-{
- struct vchi_service *service = kzalloc(sizeof(struct vchi_service), GFP_KERNEL);
-
- if (service) {
- service->callback = setup->callback;
- service->callback_param = setup->callback_param;
- }
-
- return service;
+ return kzalloc(sizeof(struct vchi_service), GFP_KERNEL);
}
static void service_free(struct vchi_service *service)
@@ -293,15 +269,15 @@ int32_t vchi_service_open(struct vchiq_instance *instance,
struct vchi_service **service)
{
- *service = service_alloc(instance, setup);
+ *service = service_alloc();
if (*service) {
struct vchiq_service_params params;
enum vchiq_status status;
memset(&params, 0, sizeof(params));
params.fourcc = setup->service_id;
- params.callback = shim_callback;
- params.userdata = *service;
+ params.callback = setup->callback;
+ params.userdata = setup->callback_param;
params.version = setup->version.version;
params.version_min = setup->version.version_min;