Commit 469fbb24 authored by Nicolas Saenz Julienne's avatar Nicolas Saenz Julienne Committed by Greg Kroah-Hartman

staging: vchi: Use vchiq's enum vchiq_reason

enum vchi_callback_reason maps 1:1 to enum vchiq_reason, in an effort to
simplify things, let's use the later, and get rid of the extra
indirection.
Signed-off-by: default avatarNicolas Saenz Julienne <nsaenzjulienne@suse.de>
Link: https://lore.kernel.org/r/20200629150945.10720-21-nsaenzjulienne@suse.deSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0abd7412
......@@ -89,8 +89,7 @@ static int bcm2835_audio_send_simple(struct bcm2835_audio_instance *instance,
return bcm2835_audio_send_msg(instance, &m, wait);
}
static void audio_vchi_callback(void *param,
const enum vchi_callback_reason reason,
static void audio_vchi_callback(void *param, const enum vchiq_reason reason,
void *msg_handle)
{
struct bcm2835_audio_instance *instance = param;
......@@ -99,7 +98,7 @@ static void audio_vchi_callback(void *param,
unsigned size;
int status;
if (reason != VCHI_CALLBACK_MSG_AVAILABLE)
if (reason != VCHIQ_MESSAGE_AVAILABLE)
return;
status = vchi_msg_hold(instance->service, (void **)&m, &size, &handle);
......
......@@ -4,27 +4,9 @@
#ifndef VCHI_COMMON_H_
#define VCHI_COMMON_H_
//callback reasons when an event occurs on a service
enum vchi_callback_reason {
/*
* This indicates that there is data available handle is the msg id that
* was transmitted with the data
* When a message is received and there was no FULL message available
* previously, send callback
* Tasks get kicked by the callback, reset their event and try and read
* from the fifo until it fails
*/
VCHI_CALLBACK_SERVICE_CLOSED,
VCHI_CALLBACK_MSG_AVAILABLE,
VCHI_CALLBACK_BULK_SENT,
VCHI_CALLBACK_BULK_RECEIVED,
VCHI_CALLBACK_BULK_TRANSMIT_ABORTED,
VCHI_CALLBACK_BULK_RECEIVE_ABORTED,
};
//Callback used by all services / bulk transfers
typedef void (*vchi_callback)(void *callback_param, //my service local param
enum vchi_callback_reason reason,
enum vchiq_reason reason,
void *handle); //for transmitting msg's only
#endif // VCHI_COMMON_H_
......@@ -274,46 +274,10 @@ static enum vchiq_status shim_callback(enum vchiq_reason reason,
if (!service->callback)
goto release;
switch (reason) {
case VCHIQ_MESSAGE_AVAILABLE:
if (reason == VCHIQ_MESSAGE_AVAILABLE)
vchiu_queue_push(&service->queue, header);
service->callback(service->callback_param,
VCHI_CALLBACK_MSG_AVAILABLE, NULL);
break;
case VCHIQ_BULK_TRANSMIT_DONE:
service->callback(service->callback_param,
VCHI_CALLBACK_BULK_SENT, bulk_user);
break;
case VCHIQ_BULK_RECEIVE_DONE:
service->callback(service->callback_param,
VCHI_CALLBACK_BULK_RECEIVED, bulk_user);
break;
case VCHIQ_SERVICE_CLOSED:
service->callback(service->callback_param,
VCHI_CALLBACK_SERVICE_CLOSED, NULL);
break;
case VCHIQ_BULK_TRANSMIT_ABORTED:
service->callback(service->callback_param,
VCHI_CALLBACK_BULK_TRANSMIT_ABORTED,
bulk_user);
break;
case VCHIQ_BULK_RECEIVE_ABORTED:
service->callback(service->callback_param,
VCHI_CALLBACK_BULK_RECEIVE_ABORTED,
bulk_user);
break;
default:
WARN(1, "not supported\n");
break;
}
service->callback(service->callback_param, reason, bulk_user);
release:
return VCHIQ_SUCCESS;
......
......@@ -549,8 +549,7 @@ static void bulk_abort_cb(struct vchiq_mmal_instance *instance,
}
/* incoming event service callback */
static void service_callback(void *param,
const enum vchi_callback_reason reason,
static void service_callback(void *param, const enum vchiq_reason reason,
void *bulk_ctx)
{
struct vchiq_mmal_instance *instance = param;
......@@ -566,7 +565,7 @@ static void service_callback(void *param,
}
switch (reason) {
case VCHI_CALLBACK_MSG_AVAILABLE:
case VCHIQ_MESSAGE_AVAILABLE:
status = vchi_msg_hold(instance->service, (void **)&msg,
&msg_len, &msg_handle);
if (status) {
......@@ -631,15 +630,15 @@ static void service_callback(void *param,
break;
case VCHI_CALLBACK_BULK_RECEIVED:
case VCHIQ_BULK_RECEIVE_DONE:
bulk_receive_cb(instance, bulk_ctx);
break;
case VCHI_CALLBACK_BULK_RECEIVE_ABORTED:
case VCHIQ_BULK_RECEIVE_ABORTED:
bulk_abort_cb(instance, bulk_ctx);
break;
case VCHI_CALLBACK_SERVICE_CLOSED:
case VCHIQ_SERVICE_CLOSED:
/* TODO: consider if this requires action if received when
* driver is not explicitly closing the service
*/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment