openwrt/target/linux/brcm2708/patches-3.10/0109-vchiq-fix-the-shim-mes...

90 lines
2.6 KiB
Diff

From 6d8dc87966b488c93a365657588690137de13ed1 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/174] 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(-)
--- 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(VCHI
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;
}