Reset the work_restart bool after the scanwork loop in case the driver flushes work synchronously.
Do the driver flush in avalon code lockless since it can lead to deadlocks.