1 From 5d8eefe0b0b10b346c76cda1c99bceca33d66aac Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.org>
3 Date: Thu, 10 May 2018 12:42:09 -0700
4 Subject: [PATCH 369/454] staging: bcm2835-camera: Remove bulk_mutex as it is
7 commit 71fcbc4740ab24c5208a24cf48a8190dc8f5d9ae upstream.
9 There is no requirement to serialise bulk transfers as that is all
10 done in VCHI, and if a second MMAL_MSG_TYPE_BUFFER_TO_HOST happened
11 before the VCHI_CALLBACK_BULK_RECEIVED, then the service_callback
14 Remove the bulk_mutex so that multiple receives can be scheduled at a
17 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
18 Signed-off-by: Eric Anholt <eric@anholt.net>
19 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 .../vc04_services/bcm2835-camera/mmal-vchiq.c | 48 +------------------
22 1 file changed, 1 insertion(+), 47 deletions(-)
24 --- a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
25 +++ b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c
26 @@ -165,9 +165,6 @@ struct vchiq_mmal_instance {
27 /* ensure serialised access to service */
28 struct mutex vchiq_mutex;
30 - /* ensure serialised access to bulk operations */
31 - struct mutex bulk_mutex;
33 /* vmalloc page to receive scratch bulk xfers into */
36 @@ -335,13 +332,6 @@ static int bulk_receive(struct vchiq_mma
37 unsigned long flags = 0;
40 - /* bulk mutex stops other bulk operations while we have a
41 - * receive in progress - released in callback
43 - ret = mutex_lock_interruptible(&instance->bulk_mutex);
47 rd_len = msg->u.buffer_from_host.buffer_header.length;
49 /* take buffer from queue */
50 @@ -360,8 +350,6 @@ static int bulk_receive(struct vchiq_mma
51 * waiting bulk receive?
54 - mutex_unlock(&instance->bulk_mutex);
59 @@ -402,11 +390,6 @@ static int bulk_receive(struct vchiq_mma
61 vchi_service_release(instance->handle);
64 - /* callback will not be clearing the mutex */
65 - mutex_unlock(&instance->bulk_mutex);
71 @@ -416,13 +399,6 @@ static int dummy_bulk_receive(struct vch
75 - /* bulk mutex stops other bulk operations while we have a
76 - * receive in progress - released in callback
78 - ret = mutex_lock_interruptible(&instance->bulk_mutex);
82 /* zero length indicates this was a dummy transfer */
83 msg_context->u.bulk.buffer_used = 0;
85 @@ -438,11 +414,6 @@ static int dummy_bulk_receive(struct vch
87 vchi_service_release(instance->handle);
90 - /* callback will not be clearing the mutex */
91 - mutex_unlock(&instance->bulk_mutex);
97 @@ -497,18 +468,11 @@ buffer_from_host(struct vchiq_mmal_insta
99 pr_debug("instance:%p buffer:%p\n", instance->handle, buf);
101 - /* bulk mutex stops other bulk operations while we
102 - * have a receive in progress
104 - if (mutex_lock_interruptible(&instance->bulk_mutex))
108 if (!buf->msg_context) {
109 pr_err("%s: msg_context not allocated, buf %p\n", __func__,
115 msg_context = buf->msg_context;
117 @@ -562,9 +526,6 @@ buffer_from_host(struct vchiq_mmal_insta
119 vchi_service_release(instance->handle);
122 - mutex_unlock(&instance->bulk_mutex);
127 @@ -688,9 +649,6 @@ static void buffer_to_host_cb(struct vch
128 static void bulk_receive_cb(struct vchiq_mmal_instance *instance,
129 struct mmal_msg_context *msg_context)
131 - /* bulk receive operation complete */
132 - mutex_unlock(&msg_context->u.bulk.instance->bulk_mutex);
134 /* replace the buffer header */
135 port_buffer_from_host(msg_context->u.bulk.instance,
136 msg_context->u.bulk.port);
137 @@ -706,9 +664,6 @@ static void bulk_abort_cb(struct vchiq_m
139 pr_err("%s: bulk ABORTED msg_context:%p\n", __func__, msg_context);
141 - /* bulk receive operation complete */
142 - mutex_unlock(&msg_context->u.bulk.instance->bulk_mutex);
144 /* replace the buffer header */
145 port_buffer_from_host(msg_context->u.bulk.instance,
146 msg_context->u.bulk.port);
147 @@ -2047,7 +2002,6 @@ int vchiq_mmal_init(struct vchiq_mmal_in
150 mutex_init(&instance->vchiq_mutex);
151 - mutex_init(&instance->bulk_mutex);
153 instance->bulk_scratch = vmalloc(PAGE_SIZE);