[Xenomai-git] Alexis Berlemont : analogy: fix buffer initialization/cleanup calls at open /close times

2010-08-02 Thread GIT version control
Module: xenomai-head
Branch: master
Commit: 71b31cfcfd305af88130ffae71714af89eec61a2
URL:
http://git.xenomai.org/?p=xenomai-head.git;a=commit;h=71b31cfcfd305af88130ffae71714af89eec61a2

Author: Alexis Berlemont 
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


[Xenomai-git] Alexis Berlemont : analogy: fix buffer initialization/cleanup calls at open /close times

2010-07-17 Thread GIT version control
Module: xenomai-2.5
Branch: master
Commit: 71b31cfcfd305af88130ffae71714af89eec61a2
URL:
http://git.xenomai.org/?p=xenomai-2.5.git;a=commit;h=71b31cfcfd305af88130ffae71714af89eec61a2

Author: Alexis Berlemont 
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


[Xenomai-git] Alexis Berlemont : analogy: fix buffer initialization/cleanup calls at open /close times

2010-07-09 Thread GIT version control
Module: xenomai-abe
Branch: analogy
Commit: 71b31cfcfd305af88130ffae71714af89eec61a2
URL:
http://git.xenomai.org/?p=xenomai-abe.git;a=commit;h=71b31cfcfd305af88130ffae71714af89eec61a2

Author: Alexis Berlemont 
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


[Xenomai-git] Alexis Berlemont : analogy: fix buffer initialization/cleanup calls at open /close times

2010-07-07 Thread GIT version control
Module: xenomai-abe
Branch: analogy
Commit: 69269ab2421b9983b3d08df00ecdc89112b8185b
URL:
http://git.xenomai.org/?p=xenomai-abe.git;a=commit;h=69269ab2421b9983b3d08df00ecdc89112b8185b

Author: Alexis Berlemont 
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


[Xenomai-git] Alexis Berlemont : analogy: fix buffer initialization/cleanup calls at open /close times

2010-06-24 Thread GIT version control
Module: xenomai-abe
Branch: analogy
Commit: 6926fd70c9a46dfd110e4367d41be0e5ecb33c3a
URL:
http://git.xenomai.org/?p=xenomai-abe.git;a=commit;h=6926fd70c9a46dfd110e4367d41be0e5ecb33c3a

Author: Alexis Berlemont 
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


[Xenomai-git] Alexis Berlemont : analogy: fix buffer initialization/cleanup calls at open /close times

2010-06-24 Thread GIT version control
Module: xenomai-abe
Branch: experimental
Commit: 6926fd70c9a46dfd110e4367d41be0e5ecb33c3a
URL:
http://git.xenomai.org/?p=xenomai-abe.git;a=commit;h=6926fd70c9a46dfd110e4367d41be0e5ecb33c3a

Author: Alexis Berlemont 
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


[Xenomai-git] Alexis Berlemont : analogy: fix buffer initialization/cleanup calls at open /close times

2010-06-13 Thread GIT version control
Module: xenomai-abe
Branch: experimental
Commit: 5542783fd6c6795032d102ca434a91d13ec29105
URL:
http://git.xenomai.org/?p=xenomai-abe.git;a=commit;h=5542783fd6c6795032d102ca434a91d13ec29105

Author: Alexis Berlemont 
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


[Xenomai-git] Alexis Berlemont : analogy: fix buffer initialization/cleanup calls at open /close times

2010-06-12 Thread GIT version control
Module: xenomai-abe
Branch: experimental
Commit: 063f75bed772cf6eea752e421ae1773ae6203ee0
URL:
http://git.xenomai.org/?p=xenomai-abe.git;a=commit;h=063f75bed772cf6eea752e421ae1773ae6203ee0

Author: Alexis Berlemont 
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