You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
freifunkist-firmware/target/linux/brcm2708/patches-3.10/0109-vchiq-fix-the-shim-mes...

95 lines
2.8 KiB

From 4791194922d8ab361136d462a23e897b459d1a2a Mon Sep 17 00:00:00 2001
From: Vincent Sanders <vincent.sanders@collabora.co.uk>
Date: Mon, 30 Sep 2013 17:04:55 +0100
Subject: [PATCH 109/196] vchiq: fix the shim message release
Signed-off-by: Daniel Stone <daniels@collabora.com>
---
.../vc04_services/interface/vchiq_arm/vchiq_shim.c | 47 +++++++++++++---------
1 file changed, 29 insertions(+), 18 deletions(-)
diff --git a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_shim.c b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_shim.c
index f752f8d..fe9bd80 100644
--- a/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_shim.c
+++ b/drivers/misc/vc04_services/interface/vchiq_arm/vchiq_shim.c
@@ -545,47 +545,58 @@ static VCHIQ_STATUS_T shim_callback(VCHIQ_REASON_T reason,
SHIM_SERVICE_T *service =
(SHIM_SERVICE_T *)VCHIQ_GET_SERVICE_USERDATA(handle);
+ if (!service->callback)
+ goto release;
+
switch (reason) {
case VCHIQ_MESSAGE_AVAILABLE:
vchiu_queue_push(&service->queue, header);
- if (service->callback)
- service->callback(service->callback_param,
- VCHI_CALLBACK_MSG_AVAILABLE, NULL);
+ service->callback(service->callback_param,
+ VCHI_CALLBACK_MSG_AVAILABLE, NULL);
+
+ goto done;
break;
+
case VCHIQ_BULK_TRANSMIT_DONE:
- if (service->callback)
- service->callback(service->callback_param,
- VCHI_CALLBACK_BULK_SENT, bulk_user);
+ service->callback(service->callback_param,
+ VCHI_CALLBACK_BULK_SENT, bulk_user);
break;
+
case VCHIQ_BULK_RECEIVE_DONE:
- if (service->callback)
- service->callback(service->callback_param,
- VCHI_CALLBACK_BULK_RECEIVED, bulk_user);
+ service->callback(service->callback_param,
+ VCHI_CALLBACK_BULK_RECEIVED, bulk_user);
break;
+
case VCHIQ_SERVICE_CLOSED:
- if (service->callback)
- service->callback(service->callback_param,
- VCHI_CALLBACK_SERVICE_CLOSED, NULL);
+ service->callback(service->callback_param,
+ VCHI_CALLBACK_SERVICE_CLOSED, NULL);
break;
+
case VCHIQ_SERVICE_OPENED:
/* No equivalent VCHI reason */
break;
+
case VCHIQ_BULK_TRANSMIT_ABORTED:
- if (service->callback)
- service->callback(service->callback_param,
- VCHI_CALLBACK_BULK_TRANSMIT_ABORTED, bulk_user);
+ service->callback(service->callback_param,
+ VCHI_CALLBACK_BULK_TRANSMIT_ABORTED,
+ bulk_user);
break;
+
case VCHIQ_BULK_RECEIVE_ABORTED:
- if (service->callback)
- service->callback(service->callback_param,
- VCHI_CALLBACK_BULK_RECEIVE_ABORTED, bulk_user);
+ service->callback(service->callback_param,
+ VCHI_CALLBACK_BULK_RECEIVE_ABORTED,
+ bulk_user);
break;
+
default:
WARN(1, "not supported\n");
break;
}
+release:
+ vchiq_release_message(service->handle, header);
+done:
return VCHIQ_SUCCESS;
}
--
1.9.1