diff options
-rw-r--r-- | firmware/buflib.c | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/firmware/buflib.c b/firmware/buflib.c index a007603161..9b591ad786 100644 --- a/firmware/buflib.c +++ b/firmware/buflib.c | |||
@@ -208,18 +208,10 @@ move_block(struct buflib_context* ctx, union buflib_data* block, int shift) | |||
208 | new_block = block + shift; | 208 | new_block = block + shift; |
209 | new_start = tmp->alloc + shift*sizeof(union buflib_data); | 209 | new_start = tmp->alloc + shift*sizeof(union buflib_data); |
210 | 210 | ||
211 | /* disable IRQs to make accessing the buffer from interrupt context safe. */ | 211 | /* If move must be synchronized with use, user should have specified a |
212 | /* protect the move callback, as a cached global pointer might be updated | 212 | callback that handles this */ |
213 | * in it. and protect "tmp->alloc = new_start" for buflib_get_data() */ | ||
214 | /* call the callback before moving */ | ||
215 | if (ops && ops->sync_callback) | 213 | if (ops && ops->sync_callback) |
216 | { | ||
217 | ops->sync_callback(handle, true); | 214 | ops->sync_callback(handle, true); |
218 | } | ||
219 | else | ||
220 | { | ||
221 | disable_irq(); | ||
222 | } | ||
223 | 215 | ||
224 | bool retval = false; | 216 | bool retval = false; |
225 | if (!ops || ops->move_callback(handle, tmp->alloc, new_start) | 217 | if (!ops || ops->move_callback(handle, tmp->alloc, new_start) |
@@ -231,13 +223,7 @@ move_block(struct buflib_context* ctx, union buflib_data* block, int shift) | |||
231 | } | 223 | } |
232 | 224 | ||
233 | if (ops && ops->sync_callback) | 225 | if (ops && ops->sync_callback) |
234 | { | ||
235 | ops->sync_callback(handle, false); | 226 | ops->sync_callback(handle, false); |
236 | } | ||
237 | else | ||
238 | { | ||
239 | enable_irq(); | ||
240 | } | ||
241 | 227 | ||
242 | return retval; | 228 | return retval; |
243 | } | 229 | } |