From 5cb74976b9025b1a5e6e3bfd15fde0afbaf98ae4 Mon Sep 17 00:00:00 2001 From: Bryan O'Donoghue Date: Tue, 2 Aug 2016 13:18:28 +0100 Subject: [PATCH] greybus: timesync: Ensure parallel synchronous calls succeed The guard for initiating a new synchronization operation should allow for that resync to happen in every single state except for INVALID. This patch fixes by ensuring the guard does just that. With local testing it was possible to break a sync to a Module. This hasn't been observed in a buglog but should be fixed anyway. Signed-off-by: Bryan O'Donoghue Acked-by: David Lin Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/timesync.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/greybus/timesync.c b/drivers/staging/greybus/timesync.c index 744ae0c9d586..561bbea9ae17 100644 --- a/drivers/staging/greybus/timesync.c +++ b/drivers/staging/greybus/timesync.c @@ -806,8 +806,7 @@ static int gb_timesync_schedule(struct gb_timesync_svc *timesync_svc, int state) return -EINVAL; mutex_lock(×ync_svc->mutex); - if (timesync_svc->state == GB_TIMESYNC_STATE_INACTIVE || - timesync_svc->state == GB_TIMESYNC_STATE_ACTIVE) { + if (timesync_svc->state != GB_TIMESYNC_STATE_INVALID) { gb_timesync_set_state_atomic(timesync_svc, state); } else { ret = -ENODEV; -- 2.39.5