Module: xenomai-abe Branch: experimental Commit: 6926fd70c9a46dfd110e4367d41be0e5ecb33c3a URL: http://git.xenomai.org/?p=xenomai-abe.git;a=commit;h=6926fd70c9a46dfd110e4367d41be0e5ecb33c3a
Author: Alexis Berlemont <alexis.berlem...@gmail.com> Date: Sun Jun 13 00:42:00 2010 +0200 analogy: fix buffer initialization/cleanup calls at open/close times --- include/analogy/buffer.h | 2 ++ ksrc/drivers/analogy/buffer.c | 16 ++++++++++++++-- ksrc/drivers/analogy/rtdm_interface.c | 6 +++++- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/include/analogy/buffer.h b/include/analogy/buffer.h index 148c07f..9e5ae8a 100644 --- a/include/analogy/buffer.h +++ b/include/analogy/buffer.h @@ -339,6 +339,8 @@ void a4l_free_buffer(a4l_buf_t *buf_desc); void a4l_init_buffer(a4l_buf_t * buf_desc); +void a4l_cleanup_buffer(a4l_buf_t * buf_desc); + int a4l_setup_buffer(a4l_cxt_t *cxt, a4l_cmd_t *cmd); int a4l_cancel_buffer(a4l_cxt_t *cxt); diff --git a/ksrc/drivers/analogy/buffer.c b/ksrc/drivers/analogy/buffer.c index 1134b8e..04922be 100644 --- a/ksrc/drivers/analogy/buffer.c +++ b/ksrc/drivers/analogy/buffer.c @@ -91,7 +91,7 @@ out_virt_contig_alloc: return ret; } -void a4l_init_buffer(a4l_buf_t *buf_desc) +static void a4l_reinit_buffer(a4l_buf_t *buf_desc) { /* No command to process yet */ buf_desc->cur_cmd = NULL; @@ -111,6 +111,18 @@ void a4l_init_buffer(a4l_buf_t *buf_desc) a4l_flush_sync(&buf_desc->sync); } +void a4l_init_buffer(a4l_buf_t *buf_desc) +{ + + a4l_init_sync(&buf_desc->sync); + a4l_reinit_buffer(buf_desc); +} + +void a4l_cleanup_buffer(a4l_buf_t *buf_desc) +{ + a4l_cleanup_sync(&buf_desc->sync); +} + int a4l_setup_buffer(a4l_cxt_t *cxt, a4l_cmd_t *cmd) { a4l_buf_t *buf_desc = cxt->buffer; @@ -182,7 +194,7 @@ int a4l_cancel_buffer(a4l_cxt_t *cxt) buf_desc->cur_cmd = NULL; } - a4l_init_buffer(buf_desc); + a4l_reinit_buffer(buf_desc); a4l_release_subd(subd); subd->buf = NULL; diff --git a/ksrc/drivers/analogy/rtdm_interface.c b/ksrc/drivers/analogy/rtdm_interface.c index 4eaada0..65acc86 100644 --- a/ksrc/drivers/analogy/rtdm_interface.c +++ b/ksrc/drivers/analogy/rtdm_interface.c @@ -156,9 +156,13 @@ int a4l_close(struct rtdm_dev_context *context, rtdm_user_info_t * user_info) return err; } - /* Free the buffer which was linked with this context */ + /* Free the buffer which was linked with this context and... */ a4l_free_buffer(cxt->buffer); + /* ...free the other buffer resources (sync) and... */ + a4l_cleanup_buffer(cxt->buffer); + + /* ...free the structure */ rtdm_free(cxt->buffer); return 0; _______________________________________________ Xenomai-git mailing list Xenomai-git@gna.org https://mail.gna.org/listinfo/xenomai-git