From d9fb3754ecf807f6c6bbe63ff2fbd29e00fad131 Mon Sep 17 00:00:00 2001 From: Bryan O'Donoghue Date: Thu, 3 Dec 2015 17:29:38 +0000 Subject: [PATCH] greybus: loopback: Relax locking during loopback operations Currently a per-connection mutex is held during calls to gb_operation_send_sync. It is not necessary to hold this lock and later patches supporting multiple-outstanding bi-directional operations need to take the per-connection lock and the gb_dev level lock. Since gb_dev must always be taken before per-connection locks, it is both desirable and safe to drop the lock now. Signed-off-by: Bryan O'Donoghue Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/loopback.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/greybus/loopback.c b/drivers/staging/greybus/loopback.c index ef16ca579ca1..e0be130afb70 100644 --- a/drivers/staging/greybus/loopback.c +++ b/drivers/staging/greybus/loopback.c @@ -774,6 +774,8 @@ static int gb_loopback_fn(void *data) mutex_unlock(&gb->mutex); goto sleep; } + mutex_unlock(&gb->mutex); + /* Else operations to perform */ gb->apbridge_latency_ts = 0; gb->gpbridge_latency_ts = 0; @@ -783,7 +785,6 @@ static int gb_loopback_fn(void *data) error = gb_loopback_transfer(gb, size); else if (type == GB_LOOPBACK_TYPE_SINK) error = gb_loopback_sink(gb, size); - mutex_unlock(&gb->mutex); mutex_lock(&gb_dev.mutex); mutex_lock(&gb->mutex); -- 2.20.1