1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
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;
}
|