Commit 93dbb97a authored by Bryan O'Donoghue's avatar Bryan O'Donoghue Committed by Greg Kroah-Hartman

greybus: timesync: Rework timesync removal serialization logic

We need to make sure we adequately cancel and quiesce any scheduled
TimeSync synchronization operations in the case of greybus.ko being yanked
out of memory i.e. when doing an EHCI runtime suspend or just a plain
rmmod. The scenario is a new TimeSync sync operation has been scheduled.
Next gb_timesync_svc_remove() runs. In this case we should terminate any
scheduled work, terminate our ktime tracking timer and state transition to
GB_TIMESYNC_STATE_INVALID to ensure no other context may schedule any new
TimeSync operations.
Signed-off-by: default avatarBryan O'Donoghue <bryan.odonoghue@linaro.org>
Reviewed-by: default avatarVaibhav Hiremath <vaibhav.hiremath@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent 0cc3bc69
...@@ -1067,8 +1067,9 @@ void gb_timesync_svc_remove(struct gb_svc *svc) ...@@ -1067,8 +1067,9 @@ void gb_timesync_svc_remove(struct gb_svc *svc)
mutex_lock(&timesync_svc->mutex); mutex_lock(&timesync_svc->mutex);
gb_timesync_teardown(timesync_svc); gb_timesync_set_state_atomic(timesync_svc, GB_TIMESYNC_STATE_INVALID);
del_timer_sync(&timesync_svc->ktime_timer); del_timer_sync(&timesync_svc->ktime_timer);
gb_timesync_teardown(timesync_svc);
gb_timesync_hd_remove(timesync_svc, svc->hd); gb_timesync_hd_remove(timesync_svc, svc->hd);
list_for_each_entry_safe(timesync_interface, next, list_for_each_entry_safe(timesync_interface, next,
...@@ -1076,7 +1077,6 @@ void gb_timesync_svc_remove(struct gb_svc *svc) ...@@ -1076,7 +1077,6 @@ void gb_timesync_svc_remove(struct gb_svc *svc)
list_del(&timesync_interface->list); list_del(&timesync_interface->list);
kfree(timesync_interface); kfree(timesync_interface);
} }
gb_timesync_set_state_atomic(timesync_svc, GB_TIMESYNC_STATE_INVALID);
debugfs_remove(timesync_svc->frame_ktime_dentry); debugfs_remove(timesync_svc->frame_ktime_dentry);
debugfs_remove(timesync_svc->frame_time_dentry); debugfs_remove(timesync_svc->frame_time_dentry);
destroy_workqueue(timesync_svc->work_queue); destroy_workqueue(timesync_svc->work_queue);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment